GiveCash Bug . Fixed Here Is The Code!!
else if ( strcmp( cmd, "!givecash", true ) == 0 )
{
new tmp2[ 256 ], plr;
tmp = strtok( cmdtext, idx ), tmp2 = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !strlen(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: !givecash [Nick/ID] [Amount]" );
else if (GetPlayerHandCash(gPlayers[ playerid ]) < StrToInt(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );
else if ( plr != INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
else if ( !IsPlayerRegistered(gPlayers[ plr ]) ) SendClientMessage( playerid, COLOR_RED, "Error: That nick is not registered!" );
else if ( !IsNumeric(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "Error: Invalid Amount!" );
else
{
format( szMsg, sizeof( szMsg ), "You have sent:[ $%d ] to:[ %s ]",strval(tmp2), gPlayers[ playerid ] );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
DecPlayerHandCash( playerid,StrToInt( tmp2 ) );
IncPlayerHandCash( plr,StrToInt( tmp2 ) );
}
return 1;
}