13.06.2011, 14:29
Hello i want to make command that will display random player name who is online, can i have any help with this ?
new i = random(10); // would store a random integer between 0 - 10 into the i variable
if(random(5) == 1) // would give a 1 in 5 chance of passing the IF statement
new screenie = random(13);
if(screenie == 1)
{
SetPlayerPos(playerid, 720.4771,-1744.3759,7.3889);
SetPlayerCameraPos(playerid, 693.2117,-1794.4960,53.9965);
SetPlayerCameraLookAt(playerid, 767.3105,-1609.9528,17.4037);
}
else if( screenie == 2)
{
SetPlayerPos(playerid, 2246.4504,-1705.5930,22.8527);
SetPlayerCameraPos(playerid, 2227.4084,-1715.7412,49.0753);
SetPlayerCameraLookAt(playerid, 2261.9358,-1772.0881,13.5469);
}
else if( screenie == 3)
{
format(string, sizeof(string), "* %s .",RANDOM PLAYER NAME);
SendClientMessage(i, COLOR_YELLOW, string);
new OnlineID[MAX_SERVER_SLOTS],Add; // replace MAX_SERVER_SLOTS
for(new d,g=GetMaxPlayers(); d < g; d++)
if(IsPlayerConnected(d))
{
OnlineID[Add] = d;
Add++;
}
new RandomID = OnlineID[random(Add)];