06.12.2012, 23:18
pawn Код:
//topo:
new Evento[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/irevento", cmdtext, true, 10) == 0)
{
Evento[playerid] = 1;
return 1;
}
if (strcmp("/sairevento", cmdtext, true, 10) == 0)
{
Evento[playerid] = 0;
return 1;
}
if (strcmp("/sortearchucknorris", cmdtext, true, 18) == 0)
{
new Nome[24], string[128];
new Random = RandomPlayer();
GetPlayerName(Random, Nome, sizeof(Nome));
format(string, 128, "{FFFFFF}O Player {94ED40}%s {FFFFFF}Foi Sorteado e Virou o {94ED40}Chuck Norris", Nome);
SendClientMessageToAll(-1, string);
GivePlayerMoney(Random, 10000);
return 1;
}
return 0;
}
stock RandomPlayer()
{
new z = 0, w, y = GetMaxPlayers();
static Conectados[MAX_PLAYERS];
while(z < y)
{
if(IsPlayerConnected(z) && Evento[z] == 1)
{
Conectados[w] = z;
w++;
}
z++;
}
return !w ? -1 : Conectados[random(w)];
}