[Help]PutPlayerInVehicle
#1

pawn Код:
if(playerid == 0)
    {
    PutPlayerInVehicle(playerid, B[0], 0);
    }
    else if(playerid == 1)
    {
    PutPlayerInVehicle(playerid, B[1], 0);
    }
    else if(playerid == 2)
    {
    PutPlayerInVehicle(playerid, B[2], 0);
    }
    else if(playerid == 3)
    {
    PutPlayerInVehicle(playerid, B[3], 0);
    }
i need some help here, this script is to make if a player spawn, it will automaticly put the players in vehicle according to their ID. so this is my question. how to make if a player spawn earlier, then he/she will be put in the first vehicle?
help me guys, thanks.
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
    PutPlayerInVehicle(playerid,B[playerid],0);
    return 1;
}
Reply
#3

Quote:
Originally Posted by sabretur
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    PutPlayerInVehicle(playerid,B[playerid],0);
    return 1;
}
That's actually same what he posted but on faster way.

@Zhoom Maybe something like this:
pawn Код:
new PlayerIn[MAX_VEHICLES]; //I would replace MAX_VEHICLES with Number of vehicles you have

public OnPlayerSpawn(playerid)
{
    new pveh;
    for(new i=0;i<MAX_VEHICLES;i++)
    {
        if(!PlayerIn[i])
        {
            pveh = i;
            break;
        }
    }
    PutPlayerInVehicle(playerid,pveh,0);
    PlayerIn[pveh] = 1;
    return 1;
}
This may work.
Reply
#4

Quote:
Originally Posted by sabretur
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    PutPlayerInVehicle(playerid,B[playerid],0);
    return 1;
}
here is what happened of your script:
-player 1 has spawned and will be put in vehicle no.1, and player 2 has spawned 3 seconds later, then player 1 will be out of the vehicle because it will put player 2 in the vehicle no.1.

any possible script than this one? thanks.
Reply
#5

@Dimi: i tested your script and it spawned me in the water. help please
Reply
#6

Explain a little better what you want to do. Also sabrateur's script should work fine. Did you even try it?
Reply
#7

ok. i want to make something like this(example):

there're 2 player in my server right now, Player 1 and Player 2.
Player 1 spawned and he will be put in vehicle no.1.
3 seconds later, Player 2 spawned, and he will be put in vehicle no.2.

and yes, i've tried Dimi's script and it spawned me in the water :/
Reply
#8

Quote:
Originally Posted by Zhoom
Посмотреть сообщение
ok. i want to make something like this(example):

there're 2 player in my server right now, Player 1 and Player 2.
Player 1 spawned and he will be put in vehicle no.1.
3 seconds later, Player 2 spawned, and he will be put in vehicle no.2.

and yes, i've tried Dimi's script and it spawned me in the water :/
No I asked if you tried Sabrateur's script, not Dimi's script
Reply
#9

oh sorry, about sabrateur's script:


Quote:
Originally Posted by Zhoom
Посмотреть сообщение
here is what happened of your script:
-player 1 has spawned and will be put in vehicle no.1, and player 2 has spawned 3 seconds later, then player 1 will be out of the vehicle because it will put player 2 in the vehicle no.1.
Reply
#10

Quote:
Originally Posted by Zhoom
Посмотреть сообщение
oh sorry, about sabrateur's script:
It won't put the player in vehicle number 1... It will put playerid 0 in vehicle id 0, playerid 1 in vehicle 1, etc...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)