Need help
#1

Hy,Can somebody tells me how to make:
First who kill (someplayer[random id]) get award?
pls help,thx
Reply
#2

this is my example
pawn Код:
new bool:FirstKill = false;
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(FirstKill == false)
  {
    FirstKill = true;
    GivePlayerMoney(killerid, ...);
  }
  return 1;
}
Reply
#3

thx for try,but i need also random id for player who need to be killed and other staffs if you can help to me i will kiss you xD kidding
Reply
#4

I picked this up
pawn Код:
stock GetRandomID() //thanks to Boylett
{
  new bool:connected[ALL_PLAYERS] = false, amount = 0;
  for(new i = 0; i < MAX_PLAYERS; i++) {
    if(IsPlayerConnected(i))
    {
      connected[i] = true;
      amount++;
    }
  }
  if(amount == 0) return -1;
  new rand = random(amount), done = 0;
  for(new i = 0; i < MAX_PLAYERS; i++) {
    if(connected[i])
    {
       if(done == rand) return i;
       done++;
    }
  }
  return -1;
}
usage
pawn Код:
new Randid = GetRandomID();
SendClientMessage(Randid, COLOR, "You were randomly selected.");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)