[HELP]How can add a vehicle on "public OnPlayerRequestClass(playerid, classid)"?
#1

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
Reply
#2

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);
Reply
#3

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

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
Reply
#5

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
Reply
#6

Np anytime
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)