Random Money Rob - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random Money Rob (
/showthread.php?tid=498488)
Random Money Rob -
alishvasis - 03.03.2014
HI.How To Seet Rob a Player Whith Random Money?
and Maximum Robbery About 500 K.This is My Code But Not Work + Rep
Code:
new current_zone = player_zone[playerid];
new mrand = random(500000)+0; // A random number between 0 and 500000
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Robber_]]");
format(string,sizeof(string),"You Robbed $%d From %s(%d).Nic Rob!",mrand,PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_RED,string);
GivePlayerCash(ID, mrand); // Remove the money that was stolen from the player
IncreaseWantedLevel(playerid,8);
HasRobbedRecently[playerid] =180;
IncreasePlayerScore(playerid,1);
SendClientMessage(ID,COLOR_DEADCONNECT,"[[Robber]]");
format(string,sizeof(string),"Robbed You $%d By %s(%d) !",mrand,PlayerName(playerid),playerid);
SendClientMessage(ID,COLOR_RED,string);
GivePlayerCash(ID, -mrand); // Remove the money that was stolen from the player
format(string,sizeof(string),"[POLICE RADIO] Dozdi Shod: %s(%d) Mablaghe $%d Az %s(%d) JibZani Kard. Mahal: %s.",PlayerName(playerid),playerid,mrand,PlayerName(ID),ID,zones[current_zone][zone_name]);
SendClientMessageToAllCops(string);
return 1;
}
Re: Random Money Rob -
Aerotactics - 03.03.2014
pawn Code:
GivePlayerCash(ID, -mrand)
Could be written like:
pawn Code:
new mrandtake=mrand * -1
GivePlayerCash(ID, mrandtake)
Because it just turns mrand into a negative number.
ALSO, it looks like you're using the same variable (ID) for both the taker and the giver.
Off topic: Error 404, post not found XD