Player Count-Pos for each player-countdown in textdraw-last man standing.. :p
#8

I would do it like this:
pawn Код:
new PlayerCount;
new bool:PlayerAtEvent[MAX_PLAYERS];

// in the command for creating an event, PlayerCount is set to 0

CMD:joinevent(playerid)
{
    if(PlayerCount >= 20) return 1;
    // ....
    PlayerCount ++;
    // Let's say you have set a default position, i.e. 1200, -450, 1900
    SetPlayerPos(playerid, 1200 + random(10), -450 + random(10), 1900); // you'll get a random value for x and y coordinates
    PlayerAtEvent[playerid] = true;
    return 1;
}

new CountdownTimer;
new Count; // set it to i.e. 20
SetTimer("Countdown", 1000, true);
forward public Countdown();
public Countdown()
{
    Count --;
    // update textdraw string
    if(!Count)
    {
        KillTimer(CountdownTimer);
        // unfreeze the players, etc..
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new n;
    foreach(Player, i)
    {
        if(PlayerAtEvent[i] == true)
            n ++;
    }
    if(n == 1) // if the amount of players on the event is 1, killer is the only alive player
    {
        // end the event etc.
    }
    return 1;
}
You could also create an array with spawning locations and then get a random index for the array
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)