SA-MP Forums Archive
[HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classid)"? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classid)"? (/showthread.php?tid=143262)



[HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classid)"? - eDz0r - 22.04.2010

So i want to add a Train just on class selection do you know how to make that?
pawn Код:
AddStaticVehicle(515,1744.1575,-1953.9352,14.5945,270.0048,1,1);
Advise thanks

P.S Sorry For my bad english i am ROMANIAN


Re: [HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classid)"? - Whitetiger - 22.04.2010

you can only use AddStaticVehicle in OnGameModeInit(), if you want to create a vehicle you should use, CreateVehicle.

Код:
new tmp = CreateVehicle(...);
// tmp = Vehicle ID
//for out of function vehicle ID, you should use GetPlayerVehicleID(playerid);
//later in the script, you should destroy your car
new mycar = GetPlayerVehicleID(playerid);
DestroyVehicle(mycar);



Re: [HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classi - aircombat - 22.04.2010

Top of script :
Код:
new spawncar;
under OnGameModeInit :
Код:
spawncar = AddStaticVehicle(etc.....)
under OnPlayerRequestClass :
Код:
PutPlayerInVehicle(playerid,spawncar,0);



Re: [HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classid)"? - eDz0r - 22.04.2010

Quote:
Originally Posted by [___
Whitetiger [www.sampcommunity.com] ]
you can only use AddStaticVehicle in OnGameModeInit(), if you want to create a vehicle you should use, CreateVehicle.

Код:
new tmp = CreateVehicle(...);
// tmp = Vehicle ID
//for out of function vehicle ID, you should use GetPlayerVehicleID(playerid);
//later in the script, you should destroy your car
new mycar = GetPlayerVehicleID(playerid);
DestroyVehicle(mycar);
yeah but i want a train and it works only witd addstaticvehicle



Re: [HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classi - eDz0r - 22.04.2010

Quote:
Originally Posted by Etch ❽ H
Top of script :
Код:
new spawncar;
under OnGameModeInit :
Код:
spawncar = AddStaticVehicle(etc.....)
under OnPlayerRequestClass :
Код:
PutPlayerInVehicle(playerid,spawncar,0);
Thanks That works


Re: [HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classi - aircombat - 22.04.2010

Np anytime


Re: [HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classid)"? - eDz0r - 22.04.2010

Quote:
Originally Posted by [___
Whitetiger [www.sampcommunity.com] ]
you can only use AddStaticVehicle in OnGameModeInit(), if you want to create a vehicle you should use, CreateVehicle.

Код:
new tmp = CreateVehicle(...);
// tmp = Vehicle ID
//for out of function vehicle ID, you should use GetPlayerVehicleID(playerid);
//later in the script, you should destroy your car
new mycar = GetPlayerVehicleID(playerid);
DestroyVehicle(mycar);
and you because Destroy vehicle