How to make random?
#5

Quote:
Originally Posted by DarrenReeder
Посмотреть сообщение
He wouldn't be able to use this. It would only work if all 500 player slots were filled.

Not quite sure how you could do this. I'm sure a more experienced Pawn Programmer will know how to do this properly.
Yes, it was just an example. To do this, could be used variables.
Example:

Код:
new totalplayers;

public OnPlayerConnect(playerid)
{
    if(totalplayers < GetMaxPlayers()) totalplayers++;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    if(totalplayers > 0) totalplayers--;
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_CROUCH)
    {
	SendClientMessage(playerid,0xFFFFFFFF, "WORKING");
	new randomid = random(totalplayers);
	TogglePlayerControllable(randomid, false);
	SendClientMessage(randomid,0xFFFFFFFF, "You've been freezed by someone.");
    }
    return 1;
}
Reply


Messages In This Thread
How to make random? - by Ben7544 - 13.04.2011, 23:50
Re: How to make random? - by DarrenReeder - 14.04.2011, 00:06
Re: How to make random? - by Shelby - 14.04.2011, 00:07
Re: How to make random? - by DarrenReeder - 14.04.2011, 00:12
Re: How to make random? - by Shelby - 14.04.2011, 00:23
Re: How to make random? - by Ben7544 - 14.04.2011, 09:33
Re: How to make random? - by Mean - 14.04.2011, 09:55
Re: How to make random? - by Shelby - 14.04.2011, 10:33

Forum Jump:


Users browsing this thread: 1 Guest(s)