Random player - 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 player (
/showthread.php?tid=374088)
Random player -
RowdyrideR - 01.09.2012
Hi guys.
First of all please nobody tell me to search, because i'm doing that since 5 days, trying to get it..
I want the server to pick a random player from players online, and changes his Team.. etc..
Also i want it to not get a "TEAMLESS" player.
like:
if(gTeam[i] != TEAMLESS){ get the random one} ..
like i want a random player , except a team..
I want someone to explain it for me..
Thanks
Re: Random player -
[MWR]Blood - 01.09.2012
Seriously? I searched and I immediately got many results - for example,
https://sampforum.blast.hk/showthread.php?tid=261708
Re: Random player -
RowdyrideR - 01.09.2012
Oh i saw that before..
if you are talking about this:
Код:
if(strcmp(cmd, "/mission", true) == 0)
{
new onlineids[MAX_PLAYERS]; // to store all online playerids
new playersonline; // to store the amount of current online players
new pname[16]; // to store the chosen player's name
for(new i=0; i<MAX_PLAYERS; i++) // loop through max amount of players (hopefully redefined from default!)
{
if(IsPlayerConnected(i)) // check to see if current id in the loop is connected
{
onlineids[playersonline] = i; // store the current id into the onlineids variable
playersonline++; // increase the playersonline by 1
}
}
GetPlayerName(onlineids[random(playersonline)], pname, sizeof(pname)); // use the random function to randomly select a store online id
format(pname, sizeof(pname), "Player name is %s", pname);
SendClientMessage(playerid, COLOR_WHITE, pname);
return 1;
}
where should i put team thing..?
i tried :
Код:
if(IsPlayerConnected(i) && gTeam[i] != TEAMLESS)
nothing happened.. it picked a TEAMLESS dude.
Re: Random player -
RowdyrideR - 01.09.2012
So anyone?!...