move some more vip code into appropriate modules

This commit is contained in:
Lorenc Pekaj 2018-12-22 22:08:05 +11:00
parent 2f793c7a89
commit 641cc82753
2 changed files with 26 additions and 20 deletions

View File

@ -88,6 +88,18 @@ new
; ;
/* ** Hooks ** */ /* ** Hooks ** */
hook OnPlayerUpdateEx( playerid )
{
CheckPlayerVipExpiry( playerid );
return 1;
}
hook OnPlayerLogin( playerid )
{
CheckPlayerVipExpiry( playerid );
return 1;
}
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{ {
if ( dialogid == DIALOG_IC_MARKET && response ) if ( dialogid == DIALOG_IC_MARKET && response )
@ -669,3 +681,17 @@ stock SetPlayerVipLevel( playerid, level, interval = 2592000, bool: credit_asset
} }
} }
} }
static stock CheckPlayerVipExpiry( playerid )
{
if ( p_VIPLevel[ playerid ] > 0 && g_iTime > p_VIPExpiretime[ playerid ] )
{
SetPlayerArmour( playerid, 0.0 );
p_VIPExpiretime[ playerid ] = 0;
SendClientMessage( playerid, -1, ""COL_GREY"[NOTIFICATION]"COL_WHITE" Your V.I.P has expired, consider another donation to have your V.I.P restored again for another period." );
p_VIPLevel[ playerid ] = 0;
p_VIPWep1{ playerid } = 0;
p_VIPWep2{ playerid } = 0;
p_VIPWep3{ playerid } = 0;
}
}

View File

@ -656,9 +656,6 @@ public OnServerUpdateTimer( )
} }
} }
// Check if the player's VIP has expired
CheckPlayerVipExpiry( playerid );
// Anti Money Hack // Anti Money Hack
if ( GetPlayerCash( playerid ) != GetPlayerMoney( playerid ) ) { if ( GetPlayerCash( playerid ) != GetPlayerMoney( playerid ) ) {
ResetPlayerMoney( playerid ); ResetPlayerMoney( playerid );
@ -7269,9 +7266,6 @@ thread OnAttemptPlayerLogin( playerid, password[ ] )
// p_CitySet { playerid } = true; // p_CitySet { playerid } = true;
p_Muted { playerid } = p_MutedTime[ playerid ] > 0 ? true : false; // Save muting :X p_Muted { playerid } = p_MutedTime[ playerid ] > 0 ? true : false; // Save muting :X
// Check if vip expired
CheckPlayerVipExpiry( playerid );
// Load other player related variables // Load other player related variables
CallLocalFunction( "OnPlayerLogin", "d", playerid ); CallLocalFunction( "OnPlayerLogin", "d", playerid );
@ -11499,20 +11493,6 @@ stock HidePlayerTogglableTextdraws( playerid, bool: force = true )
} }
} }
stock CheckPlayerVipExpiry( playerid )
{
if ( p_VIPLevel[ playerid ] > 0 && g_iTime > p_VIPExpiretime[ playerid ] )
{
SetPlayerArmour( playerid, 0.0 );
p_VIPExpiretime[ playerid ] = 0;
SendClientMessage( playerid, -1, ""COL_GREY"[NOTIFICATION]"COL_WHITE" Your V.I.P has expired, consider another donation to have your V.I.P restored again for another period." );
p_VIPLevel[ playerid ] = 0;
p_VIPWep1{ playerid } = 0;
p_VIPWep2{ playerid } = 0;
p_VIPWep3{ playerid } = 0;
}
}
thread OnNewNameCheckBanned( playerid, Float: iCoinRequirement, newName[ ] ) thread OnNewNameCheckBanned( playerid, Float: iCoinRequirement, newName[ ] )
{ {
new new