Each vehicle, own ID.
#1

Hello,

I never attached a ID to a vehicle for its own, but now i want to
do it. It will be more easy to make a vehicle system, but i don't
exactly know how can i can a vehicle their own ID. Is it just this:
Код:
new car1, car2;
car1 = CreateVehicle(...);
car2 = CreateVehicel(...);
Is it possible to make a vehicle buy system with this manner?
If not, what should i do and how?

K. Regards,
I. C.
Reply
#2

* Bump *
Reply
#3

Yes it is possible but i would recommend you to either use Mysql or any other flat file saving, as you would have to recompile every time someone buys an veh.
Reply
#4

Myself I don''t like Mysql, you could do it with player variabels.
For a roleplay server or however, you could make with the playervariables (by using the dini include) a car system.
That every owner has his own car.
Reply
#5

To get an id, make a variable that is only for one player (like: car1[playerid] = CreateVehic...). Make it read co-ordinates from the user file (of the player) and make the car spawn when a player spawns on login. I hope I helped.
Reply
#6

Quote:
Originally Posted by Outcast
Посмотреть сообщение
To get an id, make a variable that is only for one player (like: car1[playerid] = CreateVehic...). Make it read co-ordinates from the user file (of the player) and make the car spawn when a player spawns on login. I hope I helped.
Hmm.. Thanks for all your answers. It's a bit confusing for
what I should use. Does someone has a simple tutorial for
vehicle ownership or something?
Reply
#7

I did write an mysql-vehicle ownership tutorial back in the days, let me find the link.

https://sampforum.blast.hk/showthread.php?tid=186495
Reply
#8

PHP код:
new car1car2;
car1 CreateVehicle(...);
car2 CreateVehicle(...); 
CreateVehicle returns the car ID that the server has given it. So in the above code car1 = 0 and car2 = 1 if they are the first vehicles streamed onto your server.

It wold be wise for you to link your database IDs to the server IDs if you want different types of cars.

Take a look at how the VorteX gamemode does it if you are interested.
Reply
#9

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
I did write an mysql-vehicle ownership tutorial back in the days, let me find the link.

https://sampforum.blast.hk/showthread.php?tid=186495
Thanks for the reply, but do i need a MYSQL database for this to use
of can i just use it without connecting to a database?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)