SA-MP Forums Archive
[Help]PutPlayerInVehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help]PutPlayerInVehicle (/showthread.php?tid=314041)



[Help]PutPlayerInVehicle - Zhoom - 28.01.2012

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.


Re: [Help]PutPlayerInVehicle - sabretur - 28.01.2012

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



Re: [Help]PutPlayerInVehicle - [MG]Dimi - 28.01.2012

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.


Re: [Help]PutPlayerInVehicle - Zhoom - 28.01.2012

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.


Re: [Help]PutPlayerInVehicle - Zhoom - 28.01.2012

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


Re: [Help]PutPlayerInVehicle - KingHual - 28.01.2012

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


Re: [Help]PutPlayerInVehicle - Zhoom - 28.01.2012

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 :/


Re: [Help]PutPlayerInVehicle - KingHual - 28.01.2012

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


Re: [Help]PutPlayerInVehicle - Zhoom - 28.01.2012

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.



Re: [Help]PutPlayerInVehicle - KingHual - 28.01.2012

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...