17.02.2013, 17:32
This is the part I use to calculate how much he stole, but it gives me huge ass numbers or numbers like -974372912
pidy=Targets id.
pidy=Targets id.
Код:
new targetsmoney = GetPlayerMoney(pidy);
new int:moneystolen = targetsmoney*0.02;
new randomchance[][7] = {1,2,3,4,5,6,7};
new rand = random(sizeof(randomchance));
if(randomchance[rand][0] == 0 || randomchance[rand][0] == 3 || randomchance[rand][0] == 7)
{
SetTimerEx("robwait",30000,false,"i",playerid);
return SendClientMessage(playerid, 0xFF0000FF, "Robbery failed.");
}
if(targetsmoney == 0)
{
new string[128];
format(string, sizeof(string), "%s does not have any money.", pName);
SetTimerEx("robwait",30000,false,"i",playerid);
return SendClientMessage(playerid, 0xFF0000FF,string);
}
if(moneystolen > 250000)
{
GivePlayerMoney(pidy, -250000);
GivePlayerMoney(playerid, 250000);
new string[128];
format(string, sizeof(string), "You have stolen 250000$ from %s.",pName);
SendClientMessage(playerid, COLOR_GREEN,string);
format(string, sizeof(string), "%s stole 2500000 from you.",ppName);
SendClientMessage(pidy, 0xFF0000FF,string);
SetTimerEx("robwait",30000,false,"i",playerid);
return 1;
}
new string[128];
GivePlayerMoney(pidy, -moneystolen);
GivePlayerMoney(playerid, moneystolen);
format(string, sizeof(string), "You have stolen %i$ from %s.", moneystolen, pName);
SendClientMessage(playerid, COLOR_GREEN,string);
format(string, sizeof(string), "%s stole %i$ from you.",ppName,moneystolen);
SendClientMessage(pidy, 0xFF0000FF,string);
SetTimerEx("robwait",30000,false,"i",playerid);
return 1;
}


