05.08.2011, 17:37
pawn Код:
if(strcmp(cmd, "/Depositar", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,BankPosition[X],BankPosition[Y],BankPosition[Z]))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /Depositar [Quantidade]");
return 1;
}
new cashdeposit = strval(tmp);
if(cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GREY, "[Erro:] Invalid value!");
return 1;
}
if(GetPlayerCash(playerid) >= cashdeposit)
{
GivePlayerCash(playerid,-cashdeposit);
PlayerInfo[playerid][pBank]=cashdeposit+PlayerInfo[playerid][pBank];
format(string, sizeof(string), "[Info:] Depositaste $%d, Novo balan?o: $%d", cashdeposit,PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_WHITE, string);
PlayerActionMessage(playerid,15.0,"Entrega algum dinheiro ao banqueiro.");
OnPlayerDataSave(playerid);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Erro:] N?o tens esse dinheiro todo!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Erro:] N?o estas no banco!");
}
return 1;
}