29.02.2012, 12:53
Hello i have an atm code that i want to edit a little bit.
The code is /atmwithdraw that if the player is near an atm machine he can simply /atmwithdraw but i made an atm card that he can buy from the 24/7 and if he got it he can /atmwithdraw but i want to set that every time he buys that card the player gets a code that if he got the atm car and he /atmwithdraw he needs to set a code like
/atmwithdraw [Code] [Amount]
Any ideas?
The code is /atmwithdraw that if the player is near an atm machine he can simply /atmwithdraw but i made an atm card that he can buy from the 24/7 and if he got it he can /atmwithdraw but i want to set that every time he buys that card the player gets a code that if he got the atm car and he /atmwithdraw he needs to set a code like
/atmwithdraw [Code] [Amount]
Any ideas?
Код:
if(strcmp(cmd, "/atmwithdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid, 3, -32.276363,-57.995586,1003.139953) && !IsPlayerInRangeOfPoint(playerid, 3, 374.718902,167.128982,1007.987304) && !IsPlayerInRangeOfPoint(playerid, 3, 1748.79980469,-1863.50000000,13.19999981))
{
SendClientMessage(playerid, COLOR_GREY, " You are not at an ATM!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /atmwithdraw [amount]");
format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /atmwithdraw [amount]");
format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " You dont have that much !");
return 1;
}
if (cashdeposit > 5000)
{
SendClientMessage(playerid, COLOR_GRAD2, " You can only withdraw up to $5000!");
return 1;
}
ConsumingMoney[playerid] = 1;
SafeGivePlayerMoney(playerid,cashdeposit);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
format(string, sizeof(string), " You Have Withdrawn $%d from your account Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pJobTimer] = 12;
GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), " ID(%d) -%s has withdrawn %d from their bank.", playerid,giveplayer,cashdeposit);
ABroadCast(COLOR_YELLOW,string, 5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /atmwithdraw ($%d)",d,m,y,h,mi,s,sendername, cashdeposit);
PayLog(string);
return 1;
}
return 1;
}


