01.09.2013, 09:02
https://sampforum.blast.hk/showthread.php?tid=456280
Follow the instructions what is explained in the tutorial.Once you catch up the basics, try these:
To add a vehicle there are two functions namely AddStaticVehicle and CreateVehicle.AddStaticVehicle will not do well here because it cannot be use outside OnGameModeInit.So you'll have be using CreateVehicle.Specify the parameters into the function.You can get the location where to spawn using GetPlayerPos(Type in the wiki search box and it will show the details).
CreateVehicle - https://sampwiki.blast.hk/wiki/CreateVehicle
An idea:
Follow the instructions what is explained in the tutorial.Once you catch up the basics, try these:
To add a vehicle there are two functions namely AddStaticVehicle and CreateVehicle.AddStaticVehicle will not do well here because it cannot be use outside OnGameModeInit.So you'll have be using CreateVehicle.Specify the parameters into the function.You can get the location where to spawn using GetPlayerPos(Type in the wiki search box and it will show the details).
CreateVehicle - https://sampwiki.blast.hk/wiki/CreateVehicle
An idea:
Quote:
COMMAND:vspawn(playerid,params[]) { new mid,c1,c2,Float,Float:y,Float:z,Float:ror,string[256]; if(sscanf(params,"iii",mid,c1,c2)) { return SendClientMessage(playerid,0xEEEEEE,"Usage:/vspawn [mid] [color1] [color2]"); } GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid,ror); new vid = CreateVehicle(mid,x,y,z,ror,c1,c2,60000); if(vid == INVALID_VEHICLE_ID) { return SendClientMessage(playerid,COLOR_RED,"Invalid Parameters"); } format(string,sizeof(string),"Vehicle ID:%d ModelID:%s(%d) Color1:%d Color2:%d",vid,VehicleNames[mid-400],mid,c1,c2); SendClientMessage(playerid,COLOR_GREEN,string); PutPlayerInVehicle(playerid,vid,0); return 1; } |