SA-MP Forums Archive
How can I randomize this? - 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: How can I randomize this? (/showthread.php?tid=524190)



How can I randomize this? - K9IsGodly - 05.07.2014

Hey guys I was just working on a ups job, and I wanted to know how I can randomize which set of checkpoints the script displays for the player. I didn't know if I could just switch it and then use cases or what. Any help would be nice.

Код:
CMD:getcargo(playerid, params[])
{
	if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
	{
	    SendClientMessage(playerid, -1, "Drive through the checkpoints in order to do the UPS job.");
	    
	}
}
That is the command so far (I have all of the checkpoints too, I just didn't add them because I want to know how to randomize them).


Re: How can I randomize this? - Dignity - 05.07.2014

Assuming you already linked the checkpoints to each other, use switch.

pawn Код:
switch(random(4))
{
   case 0: SetPlayerCP(etc...
   case 1: SetPlayerCP(etc...
   case 2: SetPlayerCP(etc...
   case 3: SetPlayerCP(etc...
   case 4: SetPlayerCP(etc...
}
You get the point.