19.07.2013, 13:38
Hello basically i want to create a system i which random bonus player is selected, when some one kills that bonus player then killer get reward.. here i have created so far it this correct?
Thanks, if this is wrong please correct it
pawn Код:
//
stock SelectRandomPlayer()
{
new random = Random(MAX_PLAYERS);
if(IsPlayerConnected(random))
{
return random;
}
else
{
SelectRandomPlayer();
}
}
//
// under OnFilterScriptInit
SetTimer("BonusPlayer", 60*1000);
//
forward BonusPlayer();
public BonusPlayer()
{
new randomplayer = SelectRandomPlayer();
new str[100];
new pname;
GetPlayerName(randomplayer, pname, sizeof(pname));
format(str, sizeof(str),"* %s (%d) Has Been Selected As Bonus Player.", pname, randomplayer);
SendClientMessageToAll(COLOR_WHITE, str);
}
//
// under OnPlayerDeath
if(randomplayer == playerid)
{
new str1[100];
new pname, kname;
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(killerid, kname, sizeof(pname));
format(str1, sizeof(str1),"* %s (%d) Has Killed Bonus Player %s (%d)."kname, killerid, pname, playerid);
SendClientMessageToAll(COLOR_SKYBLUE, str1);
}