Re: How to create your own vehicle system -
Mauzen - 06.07.2011
Oops, I totally forgot about this tutorial, just got reminded by someone who PMed me about it
@Dirkon: The error is caused by a stupid mistake i made.
stock CreateVehicleEx(modelid, Float: x, Float:y, Float:z, Float:angle, color1, color2, respawntime, ownername[20])
has to be
stock CreateVehicleEx(modelid, Float: x, Float:y, Float:z, Float:angle, color1, color2, respawntime, ownername[MAX_PLAYER_NAME])
of course, and the array size of owner in carDataEnum has to be MAX_PLAYER_NAME too. (I also updated the first post now)
@bijoyekuza: The owner is what you set in CreateVehicleEx, and you can simply get it with carData[vehicleid][owner]. The code you made should do it.
For a /park command just change the x/y/zspawn coordinates for carData[vehicleid], as well as the rotation of it (anglespawn) and add this to the top of your OnVehicleSpawn callback:
pawn Code:
SetVehiclePos(vehicleid, carData[vehicleid][xspawn], carData[vehicleid][yspawn], carData[vehicleid][zspawn]);
// This will teleport the vehicle to its updated spawn position on spawn
SetVehicleZAngle(vehicleid, carData[vehicleid][anglespawn]);
// and sets it rotation to the stored spawn angle.
Re: How to create your own vehicle system -
Dirkon - 06.07.2011
Could you make car respawning cmd example?
Re: How to create your own vehicle system -
Mauzen - 06.07.2011
Quote:
Originally Posted by Dirkon
Could you make car respawning cmd example?
|
Respawning the car itself isnt hard. It is just
SetVehicleToRespawn(vehicleid);
But in order to make it fully compatible with this system you have to add the lines I posted before in your OnVehicleRespawn, so it spawns at the right coordinates, if you change them in the script.
Re: How to create your own vehicle system -
Dirkon - 07.07.2011
SetVehicleToRespawn(vehicleid); Just Respawns vehicle where it was when I started the server. What I want to do is lets say
/parkvehicle (already done this) and the when I type
/respawnvehicles vehicles would respawn at the parked places. I tried to make /respawn like this:
pawn Code:
if (strcmp("/respawn", cmdtext, true, 10) == 0)
{
SaveAllVehicles();
DestroyAllVehicles();
LoadAllVehicles();
return 1;
}
But it doesn't really work. When I respawn vehicles for a first time everything seems to be fine, but when I try to respawn them for the second time all cars gets doubled.
P.S. sorry for possible grammar mistakes.
Re: How to create your own vehicle system -
kadaradam - 13.07.2011
pawn Code:
C:\Users\Atar\Desktop\car.pwn(178) : error 017: undefined symbol "ini_CreateIniFile"
C:\Users\Atar\Desktop\car.pwn(179) : error 017: undefined symbol "ini_SetInt"
C:\Users\Atar\Desktop\car.pwn(180) : error 017: undefined symbol "ini_SetFloat"
C:\Users\Atar\Desktop\car.pwn(182) : error 017: undefined symbol "ini_CloseIni"
C:\Users\Atar\Desktop\car.pwn(178) : warning 204: symbol is assigned a value that is never used: "iniid"
C:\Users\Atar\Desktop\car.pwn(201) : warning 217: loose indentation
C:\Users\Atar\Desktop\car.pwn(201) : error 029: invalid expression, assumed zero
C:\Users\Atar\Desktop\car.pwn(201) : error 017: undefined symbol "LoadVehicle"
C:\Users\Atar\Desktop\car.pwn(201) : warning 215: expression has no effect
C:\Users\Atar\Desktop\car.pwn(201) : error 001: expected token: ";", but found "]"
C:\Users\Atar\Desktop\car.pwn(201) : fatal error 107: too many error messages on one line
Re : How to create your own vehicle system -
Varkoll_ - 17.07.2011
Is useful for the newbie good job !
Re: How to create your own vehicle system -
Buzzbomb - 11.10.2011
Yeah this Car System Is useless.. No Replies... heh
Re: How to create your own vehicle system -
Shooter3 - 11.10.2011
Nice job.
Re: How to create your own vehicle system -
robintjeh - 14.10.2011
Bringing this back to the top.
There seems to be a bug in the GetFreeVehicleSlot, when I create a user's vehicle, I get put in an other car at LSPD :O
Re: How to create your own vehicle system -
Henkie - 17.10.2011
This is not work for me either. The stocks don't work for 100% and in this is not a tutorial, because it does not learn you how to make it work.
Re: How to create your own vehicle system -
Buzzbomb - 25.10.2011
Quote:
Originally Posted by [PC]henkie[NL]
This is not work for me either. The stocks don't work for 100% and in this is not a tutorial, because it does not learn you how to make it work.
|
My Point Exactly.....
Re: How to create your own vehicle system -
Mauzen - 06.01.2012
Bumping answers
Quote:
Originally Posted by [PC]henkie[NL]
This is not work for me either. The stocks don't work for 100% and in this is not a tutorial, because it does not learn you how to make it work.
|
Then explain what the problem is with them. As I said at the very beginning this was a topic answer, and not a planned tutorial, so it is written for the guy who asked for it, and might not be perfect understandable for everyone.
So it depends on feedback and problem reports if I can update it.
Also the vehicleid of created vehicles isnt stored in this tutorial, and this is a quite big disadvantage for most uses: The "carid" used in these stocks is NOT the vehicleid used in samp.
Re: How to create your own vehicle system -
Marshall32 - 12.02.2012
Really good.
Re: How to create your own vehicle system -
Ajvanho - 22.08.2014
Scripting a new vehicle is not hard ( you can in a fact put one object and some handling, colliders and thats it ) but I love how this topic is more then that. ( Yes I made a ,,cowcar,, witch was not bad in one way, but in another way, all players that loved farming hated how much it's handling is retarded (copied the one from Tractor). I mean I didn't want to place Infernus handling. It would be weird. A cow faster then a car :P
Anyways, this is a really solid 10/10. I don't know how much it took you for the other stuff but it's genius. I would never think to make it more then just object with handling. Great work! +REP
Re: How to create your own vehicle system -
TeddyYeah - 04.09.2014
No errors but car doesnt appear on server , where I put , when I compiled no errors , I made exactly like you ! Help ? +rep
Re: How to create your own vehicle system -
FlipperK119 - 04.09.2014
Veery veery nice, good job dude!