Random Money Rob
#1

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;
	}
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)