SA-MP Forums Archive
Spawn player in a vehicle - 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: Spawn player in a vehicle (/showthread.php?tid=396000)



Spawn player in a vehicle - Lz - 28.11.2012

Hey so im kind of stuck here, I want the player on their first spawn to spawn on a bike, But i've got no idea how, Also once they choose a team id like it to remove the vehicle, Could anyone point me in the right direction? I've had a look around can't really find much. Thanks


Re: Spawn player in a vehicle - niels44 - 28.11.2012

putplayerinvehicle, srry cant really put codes etc here cuz am on mah mobile


Re: Spawn player in a vehicle - Lz - 28.11.2012

Quote:
Originally Posted by niels44
Посмотреть сообщение
putplayerinvehicle, srry cant really put codes etc here cuz am on mah mobile
Thanks, But one question.. Wouldn't i need to create the vehicle first?


Re: Spawn player in a vehicle - CrazyChoco - 28.11.2012

Yes


Re: Spawn player in a vehicle - Lz - 28.11.2012

Thanks but i got a little problem here..

In my server you spawn trapped in a sphere, To get in game you must choose a team by typing the command..
When they spawn (not in a team) i want them to spawn on a bike, But when they select a team i want the bike to be destroyed.. Would the script look a little like this?

pawn Код:
public OnGameModeInit()
{  
CreateVehicle(522,2324, 1283, 98, 1, 146, 146, 60);

public OnPlayerSpawn()
{
PutPlayerInVehcile(playerid,526,0);


// Loop to check if players team = 0 if it is <= to 1 then it will destroy the vehicle?
for (pTeam0; i<=1; i++)
{
    new currentveh;
        currentveh = GetPlayerVehicleID(playerid);
        DestroyVehicle(currentveh);
}



Re: Spawn player in a vehicle - maramizo - 28.11.2012

Your loop should be:
pawn Код:
if(GetPlayerTeam(playerid) < 2)
{
    DestroyVehicle(GetPlayerVehicleID(playerid));
}