If playerid = 0, setplayerpos? READ!
#1

Ok, so say a race started. Player id 0 would get teleported to 1 place and id 1 the next and id 2 another place ect. My friend made one but it gave errors so i deleted it. Example thx?
Reply
#2

This will choose as many players as the array size starting from ID 0 upwards.

pawn Код:
new StartingPositions[10]; //10 positions (change to match your needs...)
new PlayerStartingPosID[MAX_PLAYERS];
for(new i; i <= MAX_PLAYERS; i++)
{
    PlayerStartingPosID[i] = -1;
    if(IsPlayerConnected(i)) {
        if(PlayerStartingPosID[i] == -1) {
            for(new startingpos; startingpos <= sizeof(StartingPositions)) {
                if(!StartingPositions[startingpos] && PlayerStartingPosID[i] == -1) StartingPositions[startingpos]++, PlayerStartingPosID[i] = startingpos;
            }
        }
    }
}

//Then simply... (in another function, otherwise change i to something else)
for(new i; i <= MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i)) {
        if(PlayerStartingPosID[i] != -1) {
//SetPlayerPos(...) Use PlayerStartingPosID[i] to get the starting ID then assign the player to the coordinates.
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)