Random playerID?
#1

So lets say I have this code:

PHP код:
SendClientMessage(playeridCOLOR_GREEN"You're the one who got randomly picked, and won 500$!"); 
The server will pick a random "playerid", and will send the message up (^) to that player. Is it possible? Thanks already :>
Reply
#2

Edit: Nevermind it didn't work. :/ Any of you got any ideas?
Reply
#3

include foreach
https://sampforum.blast.hk/showthread.php?tid=92679

and use Iter_Random(Player);

pawn Код:
SendClientMessage(Iter_Random(Player), COLOR_GREEN, "You're the one who got randomly picked, and won 500$!");
Reply
#4

Is it possible to choose a random vehicleID?
Reply
#5

there are many ways to do that.

if you want to use foreach:
pawn Код:
//OnTop
new Iterator:Vehicle<MAX_VEHICLES>;

//Replace Your CreateVehicle Lines with this
Iter_Add(Vehicle, CreateVehicle(....................................................));
Iter_Add(Vehicle, CreateVehicle(....................................................));
Iter_Add(Vehicle, CreateVehicle(....................................................));
Iter_Add(Vehicle, CreateVehicle(....................................................));


//Then , to choose a random vehicle use this
Iter_Random(Vehicle);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)