Vehicle and lists?
#1

SIMPLIFIED: How Do I remove a vehicle from the server (stop from respawning or showing up)as soon as someone disconnects?

Hi, I'm new to sa-mp server scripting and just recently attempted to make vehicles belong to specific players.

Now, when I do AddStaticVehicle(...); The vehicle gets added to a LIST of vehicles correct? And in a list, they are usually given a KEY... correct? And everytime I add a static vehicle, the key increments... correct?

So what I'm trying to get here is, is there any way for me to grab a key out of some sort of list for the vehicles tgat are spawned? I'm pretty sure the server has one because if it did not, when the vehicle would move, no other player would be able to see that SPECIFIC car move unless it had a key[number slot] for that specific car in a list, and was was using that key to update that specific car's location to other players.

If I'm not making any sense let me know :S

Edit:
If no one can help me out with that, then I can try to figure it out myself if someone can tell me this:

If I AddStaticVehicle(..), How can I remove THAT specific vehicle? Or am I gonna have to write my own system of loading vehicles into something with unique numbers assigned to each individual vehicle I spawn?
Reply
#2

Define this "key" you are talking about. Because if it's a key, like in a vehicle system such as a person having a key for their vehicle to do /engine and /lock then you need to have some sort of vehicle system on your script.
Reply
#3

This will be extremely useful
https://sampforum.blast.hk/showthread.php?tid=35399
What you said above didn't make much sense, I'am going from what you said on the title. The tool above will give you the vehicle id's and names which you can use here:
https://sampwiki.blast.hk/wiki/AddStaticVehicle
I'am not sure on what you are wanting...Was it a vehicle spawner or...
For vehicle options, check:
https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Reply
#4

Quote:
Originally Posted by Infinity90
Посмотреть сообщение
This will be extremely useful
https://sampforum.blast.hk/showthread.php?tid=35399
What you said above didn't make much sense, I'am going from what you said on the title. The tool above will give you the vehicle id's and names which you can use here:
https://sampwiki.blast.hk/wiki/AddStaticVehicle
I'am not sure on what you are wanting...Was it a vehicle spawner or...
For vehicle options, check:
https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
I think he wants a vehicle ownership system.
Reply
#5

You can try:
https://sampwiki.blast.hk/wiki/DestroyVehicle
https://sampwiki.blast.hk/wiki/SetVehicleToRespawn
Reply
#6

If I AddStaticVehicle(..), How can I remove THAT specific vehicle? cause it seems like AddStaticVehicle(..) adds it to a list of spawned vehicles on the server that I just cant remove 1 by 1 if I have two of the same vehicles spawned.

Edit: thanks I will look at it. And I don't want a vehicle ownership system, i'm trying to make my own
Reply
#7

Why not use CreateVehicle and maybe DestroyVehicle?
Reply
#8

AddStaticVehicle creates vehicles under ongamemodeinit soon as the gamemode is loaded. Are you wanting it so you can /createvehicle in game then be able to destroy it ?
Reply
#9

If I have a vehicle called 499, and its spawned more than once, and one of those vehicle 499's gets destroyed, how does the server know which 499 to destroy? I'm trying to get ahold of variables along those lines.

1, 499, x, y, z
2, 499, x, y, z,

Does the server have something like that? where it has 1:Vehicle id, x, y z, 2: vehicle id, x, y, z and so on? Cause im trying to grab the 1 and 2 ect.

I shall look at the parameters in CreateVehicle

Edit: I'm wondering if the server has SLOTS for each VEHICLE SPAWNED
Reply
#10

Wow, I am a bit confused. Sorry mate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)