[pawn]else if ( strcmp( cmd, "!deposit", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: !deposit [Amount/All]" );
else if ( strcmp( GetPlayerLocation( playerid ), "Bank-Little-Havana-Vice-City-Mainland", true ) == 1 ) SendClientMessage( playerid, COLOR_GREEN, "Error: You have to be at the bank!" );
else
{
if ( strcmp( tmp, "all", true ) == 0 )
{
format( szMsg, sizeof( szMsg ), "You have deposited:[ $%d ] into your bank account.",GetPlayerHandCash(gPlayers[ playerid ]) );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
IncPlayerBankCash( playerid,GetPlayerHandCash(gPlayers[ playerid ]) );
DecPlayerHandCash( playerid,GetPlayerHandCash(gPlayers[ playerid ]) );
}
else
{
if ( !IsNumeric( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "Error: Invalid Amount!" );
else if (GetPlayerHandCash(gPlayers[ playerid ]) < StrToInt( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );
else
{
format( szMsg, sizeof( szMsg ), "You have deposited:[ $%d ] into your bank account.",tmp);
SendClientMessage( playerid, COLOR_GREEN, szMsg );
DecPlayerHandCash( playerid,StrToInt( tmp ) );
IncPlayerBankCash( playerid,StrToInt( tmp ) );
}
}
}
return 1;
}
else if ( strcmp( cmd, "!withdraw", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: !withdraw [Amount/All]" );
else if ( strcmp( GetPlayerLocation( playerid ), "Bank-Little-Havana-Vice-City-Mainland", true ) == 1 ) SendClientMessage( playerid, COLOR_GREEN, "Error: You have to be at the bank!" );
else
{
if ( strcmp( tmp, "all", true ) == 0 )
{
format( szMsg, sizeof( szMsg ), "You have withdrawed:[ $%d ] ftom your bank account.",GetPlayerBankCash(gPlayers[ playerid ]) );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
IncPlayerHandCash( playerid,GetPlayerBankCash(gPlayers[ playerid ]) );
SetPlayerBankCash( playerid,0 );
}
else
{
if ( !IsNumeric( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "Error: Invalid Amount!" );
else if (GetPlayerBankCash(gPlayers[ playerid ]) < StrToInt( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );
else
{
format( szMsg, sizeof( szMsg ), "You have withdrawed:[ $%d ] from your bank account.",tmp);
SendClientMessage( playerid, COLOR_GREEN, szMsg );
DecPlayerBankCash( playerid,StrToInt( tmp ) );
IncPlayerHandCash( playerid,StrToInt( tmp ) );
}
}
}
return 1;
}
else if (strcmp(cmd, "!givecash", true) == 0) {
new tmp2[256], plr;
tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
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 ]",tmp2,gPlayers[plr]);
SendClientMessage(playerid,COLOR_GREEN, szMsg);
DecPlayerHandCash(playerid,StrToInt(tmp));
IncPlayerHandCash(plr,StrToInt(tmp));
}
return 1;
}
[/pawn]
[pawn]else if ( strcmp( cmd, "!cash", true ) == 0 )
{
if ( !IsPlayerRegistered(gPlayers[ playerid ]) )
{
format( szMsg, sizeof( szMsg ), "Error: %s is not a registered nick.", gPlayers[ playerid ] );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
else
{
format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
new cash, bank;
cash = dini_Int( file, "Cash" ), bank = dini_Int( file, "Bank" );
format( szMsg, sizeof( szMsg ), "Cash:[ $%d ] Bank:[ $%d ]", cash, bank );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
}
return 1;
}[/pawn]