26.11.2012, 19:15
changed, and heres my code for it on my server,
pawn Код:
COMMAND:withdraw(playerid, params[])
{
new ammount;
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][AdminLevel] >= 0 && PlayerInfo[playerid][pInarea] == 1)
{
if(!sscanf(params, "i", ammount))
{
if(ammount <= PlayerInfo[playerid][pBank])
{
if(ammount > -1)
{
new string[64];
new PName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PName, sizeof(PName));
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+ammount;
PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]-ammount;
SendClientMessage(playerid, 0xD8D8D8FF, "----Bank Statement----");
format(string, sizeof(string), "New Balance %d", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_GREEN, string);
SetPlayerMoney(playerid, PlayerInfo[playerid][pCash]);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You Can't withdraw less than $0 nice try tho.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You don't have enough cash.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /withdraw [amount]");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not near a bank.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
COMMAND:deposit(playerid, params[])
{
new ammount;
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][AdminLevel] >= 0 && PlayerInfo[playerid][pInarea] == 1)
{
if(!sscanf(params, "i", ammount))
{
if(ammount <= PlayerInfo[playerid][pCash])
{
if(ammount > -1)
{
new string[64];
new PName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PName, sizeof(PName));
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-ammount;
PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]+ammount;
SendClientMessage(playerid, 0xD8D8D8FF, "----Bank Statement----");
format(string, sizeof(string), "New Balance %d", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_GREEN, string);
SetPlayerMoney(playerid, PlayerInfo[playerid][pCash]);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You Can't deposit less than $0 nice try tho.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You don't have enough cash.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /deposit [amount]");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not near a bank.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}