moved more irresisitble guard code and gang code to modules

This commit is contained in:
Lorenc Pekaj 2018-10-17 02:59:36 +11:00
parent df49d0abf7
commit e6b7d0ec23
4 changed files with 422 additions and 406 deletions

View File

@ -251,7 +251,7 @@ public OnPlayerLeaveGang( playerid, gangid, reason )
/* ** Commands ** */ /* ** Commands ** */
CMD:clans( playerid, params[ ] ) CMD:clans( playerid, params[ ] )
{ {
mysql_function_query( dbHandle, "SELECT * FROM `GANGS` WHERE `CLAN_TAG` IS NOT NULL ORDER BY `SCORE` DESC", true, "readclans", "d", playerid ); mysql_function_query( dbHandle, "SELECT * FROM `GANGS` WHERE `CLAN_TAG` IS NOT NULL ORDER BY `SCORE` DESC", true, "OnListClans", "d", playerid );
return 1; return 1;
} }
@ -650,7 +650,38 @@ thread OnGangColeaderLoad( gangid ) {
} }
} }
thread readclans( playerid ) thread OnListGangMembers( playerid, gangid, page )
{
new
rows, i;
cache_get_data( rows, tmpVariable );
if ( rows )
{
static
userName[ MAX_PLAYER_NAME ];
for( i = 0, szLargeString[ 0 ] = '\0'; i < rows; i++ )
{
cache_get_field_content( i, "NAME", userName );
format( szLargeString, sizeof( szLargeString ), "%s%s%s\n", szLargeString, cache_get_field_content_int( i, "ONLINE", dbHandle ) ? ( #COL_GREEN ) : ( #COL_WHITE ), userName );
}
SetPVarInt( playerid, "gang_members_id", gangid );
SetPVarInt( playerid, "gang_members_results", rows );
SetPVarInt( playerid, "gang_members_page", page );
ShowPlayerDialog( playerid, DIALOG_GANG_LIST_MEMBERS, DIALOG_STYLE_LIST, sprintf( ""COL_WHITE"Gang Members - Page %d", page + 1 ), szLargeString, rows >= 20 ? ( "Next" ) : ( "Close" ), "Back" );
}
else
{
// Notify user
SendError( playerid, "This gang no longer has any members." );
}
return 1;
}
thread OnListClans( playerid )
{ {
new new
rows, fields rows, fields
@ -1026,3 +1057,18 @@ stock SplitPlayerCashForGang( playerid, Float: cashRobbed )
} }
return 1; return 1;
} }
stock GetOnlineGangMembers( gangid, &afk_members = 0 )
{
if ( gangid == INVALID_GANG_ID )
return 0;
new
iPlayers = 0;
foreach ( new playerid : Player ) if ( p_GangID[ playerid ] == gangid ) {
if ( IsPlayerAFK( playerid ) ) afk_members ++;
iPlayers ++;
}
return iPlayers;
}

View File

@ -33,9 +33,16 @@ hook OnPlayerDisconnect( playerid, reason )
return 1; return 1;
} }
hook OnPlayerLogin( playerid )
{
format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `EMAILS` WHERE `USER_ID`=%d", GetPlayerAccountID( playerid ) );
mysql_function_query( dbHandle, szNormalString, true, "OnEmailLoad", "d", playerid );
return 1;
}
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{ {
if ( ( dialogid == DIALOG_ACC_GUARD ) && response ) if ( dialogid == DIALOG_ACC_GUARD && response )
{ {
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ) if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED )
return SendError( playerid, "You must be verified to use this feature." ); return SendError( playerid, "You must be verified to use this feature." );
@ -121,10 +128,360 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
SendServerMessage( playerid, "Your Irresistible Guard mode is now set to "COL_GREY"%s"COL_WHITE".", SecurityModeToString( listitem ) ); SendServerMessage( playerid, "Your Irresistible Guard mode is now set to "COL_GREY"%s"COL_WHITE".", SecurityModeToString( listitem ) );
return ShowPlayerAccountGuard( playerid ); return ShowPlayerAccountGuard( playerid );
} }
else if ( dialogid == DIALOG_ACC_GUARD_EMAIL && response )
{
new
email[ 64 ];
if ( sscanf( inputtext, "s[64]", email ) )
return SendError( playerid, "Your email must be between 4 and 64 characters long." );
if ( ! ( 3 < strlen( email ) < 64 ) )
return SendError( playerid, "Your email must be between 4 and 64 characters long." );
if ( ! regex_match( email, "[a-zA-Z0-9_\\.]+@([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,4}" ) )
return SendError( playerid, "Your email must be valid (foo@example.com)." );
format( szBigString, sizeof( szBigString ), "INSERT INTO `EMAIL_VERIFY`(`USER_ID`, `EMAIL`) VALUES (%d, '%s') ON DUPLICATE KEY UPDATE `EMAIL`='%s',`DATE`=CURRENT_TIMESTAMP", p_AccountID[ playerid ], mysql_escape( email ), mysql_escape( email ) );
mysql_function_query( dbHandle, szBigString, true, "OnQueueEmailVerification", "ds", playerid, email );
return 1;
}
return 1;
}
/* ** SQL Threads ** */
thread OnQueueEmailVerification( playerid, email[ ] )
{
new
verification_id = cache_insert_id( );
// alert
SendServerMessage( playerid, "An email has been sent to "COL_GREY"%s"COL_WHITE" with instructions to confirm your account.", email );
// sending an email
format( szLargeString, sizeof( szLargeString ), "<p>Hello %s, you are receiving this email because you want to add Irresistible Guard to your account.</p><p><a href='http://" # MAILING_URL "/email/verify/%d/%d'>Click here to verify your email</a></p>", ReturnPlayerName( playerid ), p_AccountID[ playerid ], verification_id );
SendMail( email, ReturnPlayerName( playerid ), sprintf( "Verify your account, %s", ReturnPlayerName( playerid ) ), szLargeString );
return 1;
}
thread OnAccountGuardVerify( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( rows )
{
new
userConfirmedIpId = cache_get_field_content_int( 0, "ID", dbHandle );
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = true;
mysql_single_query( sprintf( "UPDATE `USER_CONFIRMED_IPS` SET `CONFIRMED`=1 WHERE `ID`=%d", userConfirmedIpId ) );
// alert
SendServerMessage( playerid, "You have confirmed your IP address. Thank you!" );
}
else
{
SendError( playerid, "Incorrect verification code has been specified. Please try again." );
ShowPlayerAccountVerification( playerid );
}
return 1;
}
thread OnAccountEmailVerify( playerid, login_force )
{
new
rows, fields, timestamp;
cache_get_data( rows, fields );
if ( rows )
{
new
confirmed = cache_get_field_content_int( 0, "CONFIRMED", dbHandle );
if ( confirmed )
{
// verify
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = true;
// alert
return SendServerMessage( playerid, "This account is protected by Irresistible Guard. "COL_GREEN"The IP you are playing with has been already verified." ), 1;
}
// assign last time
timestamp = cache_get_field_content_int( 0, "DATE", dbHandle );
}
// No point making a disabled user validate
if ( login_force && p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_DISABLED )
return 1;
// No point forcing a mild mode user to validate
if ( login_force && p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_MILD )
return SendError( playerid, "This account is protected by Irresistible Guard. "COL_RED"Please verify your IP through your email to transact in-game." );
if ( g_iTime - timestamp >= 300 )
{
new
iRandom = RandomEx( 10000000, 99999999 );
// insert into database
format( szBigString, sizeof( szBigString ), "INSERT INTO `USER_CONFIRMED_IPS`(`USER_ID`,`IP`,`TOKEN`,`CONFIRMED`) VALUES (%d,'%s','%d',0) ON DUPLICATE KEY UPDATE `TOKEN`='%d',`DATE`=CURRENT_TIMESTAMP", p_AccountID[ playerid ], ReturnPlayerIP( playerid ), iRandom, iRandom );
mysql_single_query( szBigString );
// email
format( szLargeString, sizeof( szLargeString ), "<p>Hey %s, you are receiving this email because an unauthorized IP is accessing your account.</p>"\
"<p>IP: %s<br>Country: %s (may be inaccurate)</p>"\
"<p>Your verification token is <strong>%d</strong> - keep this only to yourself!</p>"\
"<p style='color: red'>If you did not authorize this, change your password in-game or contact an administrator!</p>",
ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ), GetPlayerCountryName( playerid ), iRandom );
SendMail( p_accountSecurityData[ playerid ] [ E_EMAIL ], ReturnPlayerName( playerid ), sprintf( "Someones accessing your account, %s", ReturnPlayerName( playerid ) ), szLargeString );
}
else
{
SendServerMessage( playerid, "Please check your email for another token. A new code can be generated in %s.", secondstotime( 300 - ( g_iTime - timestamp ) ) );
}
// force verification
ShowPlayerAccountVerification( playerid );
// alert
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_PARANOID ) {
SendError( playerid, "This account is protected by Irresistible Guard. "COL_RED"Please verify your IP through your email to play." );
} else if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_MILD ) {
SendError( playerid, "This account is protected by Irresistible Guard. "COL_RED"Please verify your IP through your email to transact in-game." );
}
return 1;
}
thread OnEmailLoad( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( rows )
{
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = false;
p_accountSecurityData[ playerid ] [ E_ID ] = cache_get_field_content_int( 0, "ID", dbHandle );
p_accountSecurityData[ playerid ] [ E_MODE ] = cache_get_field_content_int( 0, "MODE", dbHandle );
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = cache_get_field_content_int( 0, "LAST_DISABLED", dbHandle );
cache_get_field_content( 0, "EMAIL", p_accountSecurityData[ playerid ] [ E_EMAIL ], dbHandle, 64 );
// IP Check
format( szBigString, 196, "SELECT `CONFIRMED`,UNIX_TIMESTAMP(`DATE`) as `DATE` FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d AND `IP`='%s'", p_AccountID[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ) );
mysql_function_query( dbHandle, szBigString, true, "OnAccountEmailVerify", "dd", playerid, 1 );
}
}
thread OnEmailConfirm( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( rows )
{
// fill data
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = true;
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
p_accountSecurityData[ playerid ] [ E_ID ] = cache_get_field_content_int( 0, "ID", dbHandle );
p_accountSecurityData[ playerid ] [ E_MODE ] = cache_get_field_content_int( 0, "MODE", dbHandle );
cache_get_field_content( 0, "EMAIL", p_accountSecurityData[ playerid ] [ E_EMAIL ], dbHandle, 64 );
// log ip and alert
format( szNormalString, sizeof( szNormalString ), "INSERT INTO `USER_CONFIRMED_IPS`(`USER_ID`,`IP`,`CONFIRMED`) VALUES (%d,'%s',1)", p_AccountID[ playerid ], ReturnPlayerIP( playerid ) );
mysql_single_query( szNormalString );
// alert
SendServerMessage( playerid, "Your email has been confirmed, %s.", ReturnPlayerName( playerid ) );
}
else
{
format( szNormalString, sizeof( szNormalString ), "SELECT `EMAIL`,UNIX_TIMESTAMP(`DATE`) as `DATE` FROM `EMAIL_VERIFY` WHERE `USER_ID`=%d", p_AccountID[ playerid ] );
mysql_function_query( dbHandle, szNormalString, true, "OnEmailVerifying", "d", playerid );
}
return 1;
}
thread OnEmailVerifying( playerid )
{
new
rows, fields, email[ 64 ];
cache_get_data( rows, fields );
if ( rows )
{
new
timestamp = cache_get_field_content_int( 0, "DATE", dbHandle );
if ( g_iTime - timestamp < 300 )
{
cache_get_field_content( 0, "EMAIL", email );
return SendError( playerid, "An email has been sent to "COL_GREY"%s"COL_WHITE", please verify it within %s.", email, secondstotime( 300 - ( g_iTime - timestamp ) ) ), 1;
}
}
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_EMAIL, DIALOG_STYLE_INPUT, "{FFFFFF}Irresistible Guard", ""COL_WHITE"Please type your email below. Your email may be used also to promote in-game and/or community associated events.\n\n"COL_ORANGE"This feature can only be used once every 5 minutes.", "Select", "Cancel" ), 1;
}
thread OnAccountGuardDelete( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( !rows ) SendError( playerid, "It appears there is no email associated to your account." );
else
{
new
id = cache_get_field_content_int( 0, "ID", dbHandle ),
last_disabled = cache_get_field_content_int( 0, "LAST_DISABLED", dbHandle ),
last_changed = cache_get_field_content_int( 0, "LAST_CHANGED", dbHandle )
;
if ( id != p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "Something is wrong with your email. Talk to Lorenc." ), 1;
if ( g_iTime - last_changed < 300 ) {
return SendError( playerid, "You can use this feature in %s.", secondstotime( 300 - ( g_iTime - last_changed ) ) );
}
if ( ! last_disabled )
{
// first time disabling
SendServerMessage( playerid, "You are now beginning to remove the email from your account. This will take 24 hours." );
mysql_single_query( sprintf( "UPDATE `EMAILS` SET `LAST_DISABLED`=%d WHERE `ID`=%d", g_iTime + 86400, id ) );
// email
format( szLargeString, sizeof( szLargeString ), "<p>Hey %s, you are receiving this email because you are removing your Irresistible Guard.</p>"\
"<p>IP: %s<br>Country: %s</p>"\
"<p style='color: red'>If you did not authorize this, change your password in-game or contact an administrator!</p>",
ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ), GetPlayerCountryName( playerid ) );
SendMail( p_accountSecurityData[ playerid ] [ E_EMAIL ], ReturnPlayerName( playerid ), sprintf( "You are removing Irresistible Guard, %s", ReturnPlayerName( playerid ) ), szLargeString );
// update variables
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = g_iTime + 86400;
}
else if ( g_iTime > last_disabled )
{
// under process of disabling
mysql_single_query( sprintf( "DELETE FROM `EMAILS` WHERE `USER_ID`=%d", p_AccountID[ playerid ] ) );
mysql_single_query( sprintf( "DELETE FROM `EMAIL_VERIFY` WHERE `USER_ID`=%d", p_AccountID[ playerid ] ) );
mysql_single_query( sprintf( "DELETE FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d", p_AccountID[ playerid ] ) );
// email
format( szLargeString, sizeof( szLargeString ), "<p>Hey %s, you are receiving this email because Irresistible Guard is removed from your account.</p>"\
"<p>IP: %s<br>Country: %s</p>"\
"<p style='color: red'>If you did not authorize this, change your password in-game or contact an administrator!</p>",
ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ), GetPlayerCountryName( playerid ) );
SendMail( p_accountSecurityData[ playerid ] [ E_EMAIL ], ReturnPlayerName( playerid ), sprintf( "Irresistible Guard is removed, %s", ReturnPlayerName( playerid ) ), szLargeString );
// reset variables
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = false;
p_accountSecurityData[ playerid ] [ E_ID ] = 0;
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
// alert
SendServerMessage( playerid, "You have successfully removed Irresistible Guard from your account." );
}
else
{
// update last disabled anyway
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = last_disabled;
// show dialog
format( szNormalString, sizeof( szNormalString ), ""COL_WHITE"You must wait another %s until you can remove your email.\n\nDo you wish to stop this process?", secondstotime( last_disabled - g_iTime ) );
ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_DEL_CANCEL, DIALOG_STYLE_MSGBOX, "{FFFFFF}Irresistible Guard - Stop Deletion", szNormalString, "Yes", "No" );
}
}
return 1;
}
/* ** Commands ** */
CMD:email( playerid, params[ ] ) {
return ShowPlayerAccountGuard( playerid );
}
CMD:verify( playerid, params[ ] )
{
if ( ! p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "You do not have an email assigned to your account." );
if ( p_accountSecurityData[ playerid ] [ E_VERIFIED ] )
return SendError( playerid, "You are already verified." );
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_DISABLED )
return SendError( playerid, "Your security mode is set to disabled." );
format( szBigString, 196, "SELECT `CONFIRMED`,UNIX_TIMESTAMP(`DATE`) as `DATE` FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d AND `IP`='%s'", p_AccountID[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ) );
mysql_function_query( dbHandle, szBigString, true, "OnAccountEmailVerify", "dd", playerid, 0 );
return 1; return 1;
} }
/* ** Functions ** */ /* ** Functions ** */
stock SecurityModeToString( modeid )
{
static
szMode[ 9 ];
switch ( modeid )
{
case 0: szMode = "Mild";
case 1: szMode = "Paranoid";
case 2: szMode = "Disabled";
default: szMode = "n/a";
}
return szMode;
}
stock ShowPlayerAccountGuard( playerid )
{
if ( p_accountSecurityData[ playerid ] [ E_ID ] != 0 ) {
if ( p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] && p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] < g_iTime ) {
format( szBigString, sizeof( szBigString ), ""COL_WHITE"Your account email is "COL_GREEN"confirmed\t \nConfirm Email\t"COL_GREEN"%s\nSecurity Mode\t%s\n"COL_RED"Remove Irresistible Guard\t"COL_GREEN"Ready", CensoreString( p_accountSecurityData[ playerid ] [ E_EMAIL ] ), SecurityModeToString( p_accountSecurityData[ playerid ] [ E_MODE ] ) );
} else if ( p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] ) {
format( szBigString, sizeof( szBigString ), ""COL_WHITE"Your account email is "COL_GREEN"confirmed\t \nConfirm Email\t"COL_GREEN"%s\nSecurity Mode\t%s\n"COL_ORANGE"Stop Pending Removal\t"COL_ORANGE"%s", CensoreString( p_accountSecurityData[ playerid ] [ E_EMAIL ] ), SecurityModeToString( p_accountSecurityData[ playerid ] [ E_MODE ] ), secondstotime( p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] - g_iTime ) );
} else {
format( szBigString, sizeof( szBigString ), ""COL_WHITE"Your account email is "COL_GREEN"confirmed\t \nConfirm Email\t"COL_GREEN"%s\nSecurity Mode\t%s\n"COL_RED"Remove Irresistible Guard\t"COL_RED"approx. 24h", CensoreString( p_accountSecurityData[ playerid ] [ E_EMAIL ] ), SecurityModeToString( p_accountSecurityData[ playerid ] [ E_MODE ] ) );
}
// award user for adding their email
if ( p_AddedEmail{ playerid } == false ) {
strcat( szBigString, "\n"COL_GOLD"Claim Free 3 Days Of Regular VIP!\t"COL_GOLD">>>" );
}
} else {
szBigString = ""COL_WHITE"Your account email is "COL_RED"unconfirmed\t \nConfirm Email\t"COL_GREY">>>";
}
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Irresistible Guard", szBigString, "Select", "Close" );
}
stock ShowPlayerAccountVerification( playerid )
{
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == 1 ) {
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_CONFIRM, DIALOG_STYLE_INPUT, "{FFFFFF}Irresistible Guard", ""COL_WHITE"Please type the verification token that has been emailed to you.", "Confirm", "Quit" ), 1;
} else {
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_CONFIRM, DIALOG_STYLE_INPUT, "{FFFFFF}Irresistible Guard", ""COL_WHITE"Please type the verification token that has been emailed to you.", "Confirm", "Close" ), 1;
}
}
stock IsPlayerSecurityFullyVerified( playerid ) { // paranoid check
return ! ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_PARANOID );
}
stock IsPlayerSecurityVerified( playerid ) { stock IsPlayerSecurityVerified( playerid ) {
return ! ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ); return ! ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED );
} }
stock IsPlayerEmailVerified( playerid ) {
return p_accountSecurityData[ playerid ] [ E_ID ];
}

View File

@ -15,7 +15,8 @@
#define SERVER_IP "54.36.127.43:7777" #define SERVER_IP "54.36.127.43:7777"
/* ** Functions ** */ /* ** Functions ** */
stock IsPlayerLeadMaintainer( playerid ) { stock IsPlayerLeadMaintainer( playerid )
{
return GetPlayerAccountID( playerid ) == 1; // limits money, coin, xp spawning to this user return GetPlayerAccountID( playerid ) == 1; // limits money, coin, xp spawning to this user
} }
@ -26,3 +27,11 @@ stock IsPlayerServerMaintainer( playerid )
return IsPlayerLeadMaintainer( playerid ) || account_id == 277833 || account_id == 758617; // same as lead maintainer, just cant spawn money/xp/coins return IsPlayerLeadMaintainer( playerid ) || account_id == 277833 || account_id == 758617; // same as lead maintainer, just cant spawn money/xp/coins
} }
stock IsPlayerUnderCover( playerid ) // StefiTV852, Shepard23, JamesComey
{
new
account_id = GetPlayerAccountID( playerid );
return ( account_id == 577142 || account_id == 536230 || account_id == 668504 ) && IsPlayerLoggedIn( playerid );
}

View File

@ -3645,7 +3645,7 @@ CMD:t( playerid, params[ ] )
CMD:ic( playerid, params[ ] ) return cmd_irresistiblecoins( playerid, params ); CMD:ic( playerid, params[ ] ) return cmd_irresistiblecoins( playerid, params );
CMD:irresistiblecoins( playerid, params[ ] ) CMD:irresistiblecoins( playerid, params[ ] )
{ {
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ) if ( ! IsPlayerSecurityVerified( playerid ) )
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" ); return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
if ( strmatch( params, "balance" ) ) if ( strmatch( params, "balance" ) )
@ -4873,10 +4873,6 @@ CMD:savestats( playerid, params[ ] )
return 1; return 1;
} }
CMD:email( playerid, params[ ] ) {
return ShowPlayerAccountGuard( playerid );
}
CMD:ask( playerid, params[ ] ) CMD:ask( playerid, params[ ] )
{ {
new szMessage[ 96 ]; new szMessage[ 96 ];
@ -5662,7 +5658,7 @@ CMD:sendmoney( playerid, params[ ] )
iTime = g_iTime iTime = g_iTime
; ;
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ) if ( ! IsPlayerSecurityVerified( playerid ) )
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" ); return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
/* ** Anti Tie Spam ** */ /* ** Anti Tie Spam ** */
@ -5908,7 +5904,7 @@ CMD:shop( playerid, params[ ] )
CMD:placehit( playerid, params[ ] ) CMD:placehit( playerid, params[ ] )
{ {
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ) if ( ! IsPlayerSecurityVerified( playerid ) )
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" ); return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
/* ** Anti Spammy Commands ** */ /* ** Anti Spammy Commands ** */
@ -7908,11 +7904,11 @@ public OnPlayerRequestSpawn( playerid )
stock approveClassSpawned( playerid ) { stock approveClassSpawned( playerid ) {
// is logged in // is logged in
if ( !p_PlayerLogged{ playerid } ) if ( ! IsPlayerLoggedIn( playerid ) )
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You must be authenticated to play the game." ), 0; return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You must be authenticated to play the game." ), 0;
// is verified // is verified
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_PARANOID ) if ( ! IsPlayerSecurityFullyVerified( playerid ) )
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You must be verified to play the game." ), 0; return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You must be verified to play the game." ), 0;
// is cop/army banned // is cop/army banned
@ -8763,9 +8759,6 @@ thread OnAttemptPlayerLogin( playerid, password[ ] )
CallLocalFunction( "OnPlayerLogin", "d", playerid ); CallLocalFunction( "OnPlayerLogin", "d", playerid );
// Load some more linking tables // Load some more linking tables
format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `EMAILS` WHERE `USER_ID`=%d", p_AccountID[ playerid ] );
mysql_function_query( dbHandle, szNormalString, true, "OnEmailLoad", "d", playerid );
format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `VEHICLES` WHERE `OWNER`=%d", p_AccountID[ playerid ] ); format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `VEHICLES` WHERE `OWNER`=%d", p_AccountID[ playerid ] );
mysql_function_query( dbHandle, szNormalString, true, "OnVehicleLoad", "d", playerid ); mysql_function_query( dbHandle, szNormalString, true, "OnVehicleLoad", "d", playerid );
@ -9290,7 +9283,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
if ( !response ) if ( !response )
return ShowPlayerBankMenuDialog( playerid ); return ShowPlayerBankMenuDialog( playerid );
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ) if ( ! IsPlayerSecurityVerified( playerid ) )
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" ); return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
new new
@ -10066,24 +10059,6 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
ShowPlayerDialog( playerid, DIALOG_JOB, DIALOG_STYLE_LIST, "{FFFFFF}Job Selection", "Rapist\nKidnapper\nTerrorist\nHitman\nProstitute\nWeapon Dealer\nDrug Dealer\nDirty Mechanic\nBurglar", "Select", "" ); ShowPlayerDialog( playerid, DIALOG_JOB, DIALOG_STYLE_LIST, "{FFFFFF}Job Selection", "Rapist\nKidnapper\nTerrorist\nHitman\nProstitute\nWeapon Dealer\nDrug Dealer\nDirty Mechanic\nBurglar", "Select", "" );
return 1; return 1;
} }
if ( dialogid == DIALOG_ACC_GUARD_EMAIL && response )
{
new
email[ 64 ];
if ( sscanf( inputtext, "s[64]", email ) )
return SendError( playerid, "Your email must be between 4 and 64 characters long." );
if ( ! ( 3 < strlen( email ) < 64 ) )
return SendError( playerid, "Your email must be between 4 and 64 characters long." );
if ( ! regex_match( email, "[a-zA-Z0-9_\\.]+@([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,4}" ) )
return SendError( playerid, "Your email must be valid (foo@example.com)." );
format( szBigString, sizeof( szBigString ), "INSERT INTO `EMAIL_VERIFY`(`USER_ID`, `EMAIL`) VALUES (%d, '%s') ON DUPLICATE KEY UPDATE `EMAIL`='%s',`DATE`=CURRENT_TIMESTAMP", p_AccountID[ playerid ], mysql_escape( email ), mysql_escape( email ) );
mysql_function_query( dbHandle, szBigString, true, "OnQueueEmailVerification", "ds", playerid, email );
return 1;
}
if ( dialogid == DIALOG_WEAPON_DEAL ) if ( dialogid == DIALOG_WEAPON_DEAL )
{ {
if ( !response ) if ( !response )
@ -13662,21 +13637,6 @@ stock SetPlayerPosition( playerid, Float: x, Float: y, Float: z, interiorid = 0,
return SetPlayerPos( playerid, x, y, z ); return SetPlayerPos( playerid, x, y, z );
} }
stock GetOnlineGangMembers( gangid, &afk_members = 0 )
{
if ( gangid == INVALID_GANG_ID )
return 0;
new
iPlayers = 0;
foreach ( new playerid : Player ) if ( p_GangID[ playerid ] == gangid ) {
if ( IsPlayerAFK( playerid ) ) afk_members ++;
iPlayers ++;
}
return iPlayers;
}
stock ShowPlayerTogglableTextdraws( playerid, bool: force = false ) stock ShowPlayerTogglableTextdraws( playerid, bool: force = false )
{ {
// Current Coins // Current Coins
@ -13785,36 +13745,6 @@ thread OnPlayerChangeName( playerid, Float: iCoinRequirement, newName[ ] )
return 1; return 1;
} }
thread OnListGangMembers( playerid, gangid, page )
{
new
rows, i;
cache_get_data( rows, tmpVariable );
if ( rows )
{
static
userName[ MAX_PLAYER_NAME ];
for( i = 0, szLargeString[ 0 ] = '\0'; i < rows; i++ )
{
cache_get_field_content( i, "NAME", userName );
format( szLargeString, sizeof( szLargeString ), "%s%s%s\n", szLargeString, cache_get_field_content_int( i, "ONLINE", dbHandle ) ? ( #COL_GREEN ) : ( #COL_WHITE ), userName );
}
SetPVarInt( playerid, "gang_members_id", gangid );
SetPVarInt( playerid, "gang_members_results", rows );
SetPVarInt( playerid, "gang_members_page", page );
ShowPlayerDialog( playerid, DIALOG_GANG_LIST_MEMBERS, DIALOG_STYLE_LIST, sprintf( ""COL_WHITE"Gang Members - Page %d", page + 1 ), szLargeString, rows >= 20 ? ( "Next" ) : ( "Close" ), "Back" );
}
else
{
// Notify user
SendError( playerid, "This gang no longer has any members." );
}
return 1;
}
stock GivePlayerLeoWeapons( playerid ) { stock GivePlayerLeoWeapons( playerid ) {
GivePlayerWeapon( playerid, 3, 1 ); GivePlayerWeapon( playerid, 3, 1 );
@ -14005,326 +13935,6 @@ stock TextDrawShowForAllSpawned( Text: textdrawid ) {
} }
} }
stock SecurityModeToString( modeid )
{
static
szMode[ 9 ];
switch ( modeid )
{
case 0: szMode = "Mild";
case 1: szMode = "Paranoid";
case 2: szMode = "Disabled";
default: szMode = "n/a";
}
return szMode;
}
stock ShowPlayerAccountGuard( playerid )
{
if ( p_accountSecurityData[ playerid ] [ E_ID ] != 0 ) {
if ( p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] && p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] < g_iTime ) {
format( szBigString, sizeof( szBigString ), ""COL_WHITE"Your account email is "COL_GREEN"confirmed\t \nConfirm Email\t"COL_GREEN"%s\nSecurity Mode\t%s\n"COL_RED"Remove Irresistible Guard\t"COL_GREEN"Ready", CensoreString( p_accountSecurityData[ playerid ] [ E_EMAIL ] ), SecurityModeToString( p_accountSecurityData[ playerid ] [ E_MODE ] ) );
} else if ( p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] ) {
format( szBigString, sizeof( szBigString ), ""COL_WHITE"Your account email is "COL_GREEN"confirmed\t \nConfirm Email\t"COL_GREEN"%s\nSecurity Mode\t%s\n"COL_ORANGE"Stop Pending Removal\t"COL_ORANGE"%s", CensoreString( p_accountSecurityData[ playerid ] [ E_EMAIL ] ), SecurityModeToString( p_accountSecurityData[ playerid ] [ E_MODE ] ), secondstotime( p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] - g_iTime ) );
} else {
format( szBigString, sizeof( szBigString ), ""COL_WHITE"Your account email is "COL_GREEN"confirmed\t \nConfirm Email\t"COL_GREEN"%s\nSecurity Mode\t%s\n"COL_RED"Remove Irresistible Guard\t"COL_RED"approx. 24h", CensoreString( p_accountSecurityData[ playerid ] [ E_EMAIL ] ), SecurityModeToString( p_accountSecurityData[ playerid ] [ E_MODE ] ) );
}
// award user for adding their email
if ( p_AddedEmail{ playerid } == false ) {
strcat( szBigString, "\n"COL_GOLD"Claim Free 3 Days Of Regular VIP!\t"COL_GOLD">>>" );
}
} else {
szBigString = ""COL_WHITE"Your account email is "COL_RED"unconfirmed\t \nConfirm Email\t"COL_GREY">>>";
}
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Irresistible Guard", szBigString, "Select", "Close" );
}
thread OnQueueEmailVerification( playerid, email[ ] )
{
new
verification_id = cache_insert_id( );
// alert
SendServerMessage( playerid, "An email has been sent to "COL_GREY"%s"COL_WHITE" with instructions to confirm your account.", email );
// sending an email
format( szLargeString, sizeof( szLargeString ), "<p>Hello %s, you are receiving this email because you want to add Irresistible Guard to your account.</p><p><a href='http://" # MAILING_URL "/email/verify/%d/%d'>Click here to verify your email</a></p>", ReturnPlayerName( playerid ), p_AccountID[ playerid ], verification_id );
SendMail( email, ReturnPlayerName( playerid ), sprintf( "Verify your account, %s", ReturnPlayerName( playerid ) ), szLargeString );
return 1;
}
CMD:verify( playerid, params[ ] )
{
if ( ! p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "You do not have an email assigned to your account." );
if ( p_accountSecurityData[ playerid ] [ E_VERIFIED ] )
return SendError( playerid, "You are already verified." );
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_DISABLED )
return SendError( playerid, "Your security mode is set to disabled." );
format( szBigString, 196, "SELECT `CONFIRMED`,UNIX_TIMESTAMP(`DATE`) as `DATE` FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d AND `IP`='%s'", p_AccountID[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ) );
mysql_function_query( dbHandle, szBigString, true, "OnAccountEmailVerify", "dd", playerid, 0 );
return 1;
}
thread OnAccountGuardVerify( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( rows )
{
new
userConfirmedIpId = cache_get_field_content_int( 0, "ID", dbHandle );
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = true;
mysql_single_query( sprintf( "UPDATE `USER_CONFIRMED_IPS` SET `CONFIRMED`=1 WHERE `ID`=%d", userConfirmedIpId ) );
// alert
SendServerMessage( playerid, "You have confirmed your IP address. Thank you!" );
}
else
{
SendError( playerid, "Incorrect verification code has been specified. Please try again." );
ShowPlayerAccountVerification( playerid );
}
return 1;
}
thread OnAccountEmailVerify( playerid, login_force )
{
new
rows, fields, timestamp;
cache_get_data( rows, fields );
if ( rows )
{
new
confirmed = cache_get_field_content_int( 0, "CONFIRMED", dbHandle );
if ( confirmed )
{
// verify
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = true;
// alert
return SendServerMessage( playerid, "This account is protected by Irresistible Guard. "COL_GREEN"The IP you are playing with has been already verified." ), 1;
}
// assign last time
timestamp = cache_get_field_content_int( 0, "DATE", dbHandle );
}
// No point making a disabled user validate
if ( login_force && p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_DISABLED )
return 1;
// No point forcing a mild mode user to validate
if ( login_force && p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_MILD )
return SendError( playerid, "This account is protected by Irresistible Guard. "COL_RED"Please verify your IP through your email to transact in-game." );
if ( g_iTime - timestamp >= 300 )
{
new
iRandom = RandomEx( 10000000, 99999999 );
// insert into database
format( szBigString, sizeof( szBigString ), "INSERT INTO `USER_CONFIRMED_IPS`(`USER_ID`,`IP`,`TOKEN`,`CONFIRMED`) VALUES (%d,'%s','%d',0) ON DUPLICATE KEY UPDATE `TOKEN`='%d',`DATE`=CURRENT_TIMESTAMP", p_AccountID[ playerid ], ReturnPlayerIP( playerid ), iRandom, iRandom );
mysql_single_query( szBigString );
// email
format( szLargeString, sizeof( szLargeString ), "<p>Hey %s, you are receiving this email because an unauthorized IP is accessing your account.</p>"\
"<p>IP: %s<br>Country: %s (may be inaccurate)</p>"\
"<p>Your verification token is <strong>%d</strong> - keep this only to yourself!</p>"\
"<p style='color: red'>If you did not authorize this, change your password in-game or contact an administrator!</p>",
ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ), GetPlayerCountryName( playerid ), iRandom );
SendMail( p_accountSecurityData[ playerid ] [ E_EMAIL ], ReturnPlayerName( playerid ), sprintf( "Someones accessing your account, %s", ReturnPlayerName( playerid ) ), szLargeString );
}
else
{
SendServerMessage( playerid, "Please check your email for another token. A new code can be generated in %s.", secondstotime( 300 - ( g_iTime - timestamp ) ) );
}
// force verification
ShowPlayerAccountVerification( playerid );
// alert
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_PARANOID ) {
SendError( playerid, "This account is protected by Irresistible Guard. "COL_RED"Please verify your IP through your email to play." );
} else if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_MILD ) {
SendError( playerid, "This account is protected by Irresistible Guard. "COL_RED"Please verify your IP through your email to transact in-game." );
}
return 1;
}
stock ShowPlayerAccountVerification( playerid )
{
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == 1 ) {
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_CONFIRM, DIALOG_STYLE_INPUT, "{FFFFFF}Irresistible Guard", ""COL_WHITE"Please type the verification token that has been emailed to you.", "Confirm", "Quit" ), 1;
} else {
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_CONFIRM, DIALOG_STYLE_INPUT, "{FFFFFF}Irresistible Guard", ""COL_WHITE"Please type the verification token that has been emailed to you.", "Confirm", "Close" ), 1;
}
}
thread OnEmailLoad( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( rows )
{
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = false;
p_accountSecurityData[ playerid ] [ E_ID ] = cache_get_field_content_int( 0, "ID", dbHandle );
p_accountSecurityData[ playerid ] [ E_MODE ] = cache_get_field_content_int( 0, "MODE", dbHandle );
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = cache_get_field_content_int( 0, "LAST_DISABLED", dbHandle );
cache_get_field_content( 0, "EMAIL", p_accountSecurityData[ playerid ] [ E_EMAIL ], dbHandle, 64 );
// IP Check
format( szBigString, 196, "SELECT `CONFIRMED`,UNIX_TIMESTAMP(`DATE`) as `DATE` FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d AND `IP`='%s'", p_AccountID[ playerid ], mysql_escape( ReturnPlayerIP( playerid ) ) );
mysql_function_query( dbHandle, szBigString, true, "OnAccountEmailVerify", "dd", playerid, 1 );
}
}
thread OnEmailConfirm( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( rows )
{
// fill data
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = true;
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
p_accountSecurityData[ playerid ] [ E_ID ] = cache_get_field_content_int( 0, "ID", dbHandle );
p_accountSecurityData[ playerid ] [ E_MODE ] = cache_get_field_content_int( 0, "MODE", dbHandle );
cache_get_field_content( 0, "EMAIL", p_accountSecurityData[ playerid ] [ E_EMAIL ], dbHandle, 64 );
// log ip and alert
format( szNormalString, sizeof( szNormalString ), "INSERT INTO `USER_CONFIRMED_IPS`(`USER_ID`,`IP`,`CONFIRMED`) VALUES (%d,'%s',1)", p_AccountID[ playerid ], ReturnPlayerIP( playerid ) );
mysql_single_query( szNormalString );
// alert
SendServerMessage( playerid, "Your email has been confirmed, %s.", ReturnPlayerName( playerid ) );
}
else
{
format( szNormalString, sizeof( szNormalString ), "SELECT `EMAIL`,UNIX_TIMESTAMP(`DATE`) as `DATE` FROM `EMAIL_VERIFY` WHERE `USER_ID`=%d", p_AccountID[ playerid ] );
mysql_function_query( dbHandle, szNormalString, true, "OnEmailVerifying", "d", playerid );
}
return 1;
}
thread OnEmailVerifying( playerid )
{
new
rows, fields, email[ 64 ];
cache_get_data( rows, fields );
if ( rows )
{
new
timestamp = cache_get_field_content_int( 0, "DATE", dbHandle );
if ( g_iTime - timestamp < 300 )
{
cache_get_field_content( 0, "EMAIL", email );
return SendError( playerid, "An email has been sent to "COL_GREY"%s"COL_WHITE", please verify it within %s.", email, secondstotime( 300 - ( g_iTime - timestamp ) ) ), 1;
}
}
return ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_EMAIL, DIALOG_STYLE_INPUT, "{FFFFFF}Irresistible Guard", ""COL_WHITE"Please type your email below. Your email may be used also to promote in-game and/or community associated events.\n\n"COL_ORANGE"This feature can only be used once every 5 minutes.", "Select", "Cancel" ), 1;
}
thread OnAccountGuardDelete( playerid )
{
new
rows, fields;
cache_get_data( rows, fields );
if ( !rows ) SendError( playerid, "It appears there is no email associated to your account." );
else
{
new
id = cache_get_field_content_int( 0, "ID", dbHandle ),
last_disabled = cache_get_field_content_int( 0, "LAST_DISABLED", dbHandle ),
last_changed = cache_get_field_content_int( 0, "LAST_CHANGED", dbHandle )
;
if ( id != p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "Something is wrong with your email. Talk to Lorenc." ), 1;
if ( g_iTime - last_changed < 300 ) {
return SendError( playerid, "You can use this feature in %s.", secondstotime( 300 - ( g_iTime - last_changed ) ) );
}
if ( ! last_disabled )
{
// first time disabling
SendServerMessage( playerid, "You are now beginning to remove the email from your account. This will take 24 hours." );
mysql_single_query( sprintf( "UPDATE `EMAILS` SET `LAST_DISABLED`=%d WHERE `ID`=%d", g_iTime + 86400, id ) );
// email
format( szLargeString, sizeof( szLargeString ), "<p>Hey %s, you are receiving this email because you are removing your Irresistible Guard.</p>"\
"<p>IP: %s<br>Country: %s</p>"\
"<p style='color: red'>If you did not authorize this, change your password in-game or contact an administrator!</p>",
ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ), GetPlayerCountryName( playerid ) );
SendMail( p_accountSecurityData[ playerid ] [ E_EMAIL ], ReturnPlayerName( playerid ), sprintf( "You are removing Irresistible Guard, %s", ReturnPlayerName( playerid ) ), szLargeString );
// update variables
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = g_iTime + 86400;
}
else if ( g_iTime > last_disabled )
{
// under process of disabling
mysql_single_query( sprintf( "DELETE FROM `EMAILS` WHERE `USER_ID`=%d", p_AccountID[ playerid ] ) );
mysql_single_query( sprintf( "DELETE FROM `EMAIL_VERIFY` WHERE `USER_ID`=%d", p_AccountID[ playerid ] ) );
mysql_single_query( sprintf( "DELETE FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d", p_AccountID[ playerid ] ) );
// email
format( szLargeString, sizeof( szLargeString ), "<p>Hey %s, you are receiving this email because Irresistible Guard is removed from your account.</p>"\
"<p>IP: %s<br>Country: %s</p>"\
"<p style='color: red'>If you did not authorize this, change your password in-game or contact an administrator!</p>",
ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ), GetPlayerCountryName( playerid ) );
SendMail( p_accountSecurityData[ playerid ] [ E_EMAIL ], ReturnPlayerName( playerid ), sprintf( "Irresistible Guard is removed, %s", ReturnPlayerName( playerid ) ), szLargeString );
// reset variables
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = false;
p_accountSecurityData[ playerid ] [ E_ID ] = 0;
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
// alert
SendServerMessage( playerid, "You have successfully removed Irresistible Guard from your account." );
}
else
{
// update last disabled anyway
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = last_disabled;
// show dialog
format( szNormalString, sizeof( szNormalString ), ""COL_WHITE"You must wait another %s until you can remove your email.\n\nDo you wish to stop this process?", secondstotime( last_disabled - g_iTime ) );
ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_DEL_CANCEL, DIALOG_STYLE_MSGBOX, "{FFFFFF}Irresistible Guard - Stop Deletion", szNormalString, "Yes", "No" );
}
}
return 1;
}
/** /**
* Read all incoming UDP data from discord users that fire commands * Read all incoming UDP data from discord users that fire commands
* @return true * @return true
@ -14480,10 +14090,6 @@ stock GivePlayerFireworks( playerid, fireworks ) {
mysql_single_query( sprintf( "UPDATE `USERS` SET `FIREWORKS`=%d WHERE `ID`=%d", p_Fireworks[ playerid ], p_AccountID[ playerid ] ) ); mysql_single_query( sprintf( "UPDATE `USERS` SET `FIREWORKS`=%d WHERE `ID`=%d", p_Fireworks[ playerid ], p_AccountID[ playerid ] ) );
} }
stock IsPlayerUnderCover( playerid ) { // StefiTV852, Shepard23, JamesComey
return ( p_AccountID[ playerid ] == 577142 || p_AccountID[ playerid ] == 536230 || p_AccountID[ playerid ] == 668504 ) && p_PlayerLogged{ playerid };
}
stock ShowPlayerSpawnMenu( playerid ) { stock ShowPlayerSpawnMenu( playerid ) {
return ShowPlayerDialog( playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST, "{FFFFFF}Spawn Location", ""COL_GREY"Reset Back To Default\nHouse\nBusiness\nGang Facility\nVisage Casino", "Select", "Cancel" ); return ShowPlayerDialog( playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST, "{FFFFFF}Spawn Location", ""COL_GREY"Reset Back To Default\nHouse\nBusiness\nGang Facility\nVisage Casino", "Select", "Cancel" );
} }
@ -14760,8 +14366,6 @@ stock BreakPlayerCuffs( playerid, &attempts = 0 )
return 1; return 1;
} }
stock IsPlayerEmailVerified( playerid ) return p_accountSecurityData[ playerid ] [ E_ID ];
stock IsPlayerAFK( playerid ) return ( ( GetTickCount( ) - p_AFKTime[ playerid ] ) >= 2595 ); stock IsPlayerAFK( playerid ) return ( ( GetTickCount( ) - p_AFKTime[ playerid ] ) >= 2595 );
stock GetPlayerVIPDuration( playerid ) return p_VIPExpiretime[ playerid ] - g_iTime; stock GetPlayerVIPDuration( playerid ) return p_VIPExpiretime[ playerid ] - g_iTime;