SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/07/2013, 03:52 PM   #1
Muhamed.pwn
Big Clucker
 
Join Date: Mar 2012
Posts: 67
Reputation: 0
Default Assign specific ID to a vehicle

Me again..

I made a COS based on the servers vehicleids, so I can't destroy a created car. If I do so the vehicle ids will mess up so I need delete all COS vehicles and start buying them again.

My question is: is there a way to assign a specific vehicleid to a vehicle ex. start COS car IDs from ID 1000 and so on so I can create cars for events, factions and so on. Currently, when a player disconnects I just set it's vehicle position to a random float somewhere in the water. Nowhere in my script I have "DestroyVehicle", I can't risk to mess up vehicleids because the COS file names are based on the vehicleids.

I've read this thread http://forum.sa-mp.com/showthread.php?t=406551 and ****** said assign a variable to record the vehicle ID and work with it but would such an metod mess the IDs too !?
Muhamed.pwn is offline   Reply With Quote
Old 03/07/2013, 03:56 PM   #2
iPoisonxL
Little Clucker
 
Join Date: Apr 2013
Posts: 21
Reputation: -1
Default Re: Assign specific ID to a vehicle

Try something like
pawn Code:
new yourCarID = CreateVehicle(vehicle parameters);
iPoisonxL is offline   Reply With Quote
Old 03/07/2013, 04:03 PM   #3
Muhamed.pwn
Big Clucker
 
Join Date: Mar 2012
Posts: 67
Reputation: 0
Default Re: Assign specific ID to a vehicle

Quote:
Originally Posted by iPoisonxL View Post
Try something like
PHP Code:
yourCarID CreateVehicle(vehicle parameters); 
You are right.
I tought to do it so, but what to store in the players variable to acces the vehicle then ex. for saving!?
Muhamed.pwn is offline   Reply With Quote
Old 03/07/2013, 04:08 PM   #4
introzen
Gangsta
 
introzen's Avatar
 
Join Date: Aug 2008
Posts: 788
Reputation: 34
Default Re: Assign specific ID to a vehicle

PlayerCar[MAX_PLAYERS]
introzen is offline   Reply With Quote
Old 03/07/2013, 04:08 PM   #5
TheStreetsRP
Little Clucker
 
Join Date: May 2013
Location: Wichita, KS
Posts: 30
Reputation: 1
Default Re: Assign specific ID to a vehicle

Don't store anything in the player's variables. What I do.

Code:
enum vehEnum { vehEntity, vehID, vehOwnerID };
new Vehicle[MAX_VEHICLES][vehEnum];
Then load up the array with your vehicle data in OnGameModeInit();

Then whenever you need to find which vehicle you're dealing with, in regards to the array, you loop as such.. This is assuming you have the "vehicleid".

Code:
for(new i;i<MAX_VEHICLES;i++)
    if(Vehicle[i][vehEntity] == vehicleid)
        return i;
__________________
Development Team Lead
The Streets: Roleplay
TheStreetsRP is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Destroy specific vehicle when player exit vehicle se7evolution Scripting Help 10 25/01/2013 08:08 PM
Assign Specific ID to a vehicle CrossOv3r Scripting Help 2 10/01/2013 06:52 PM
If you want to enter a specific vehicle ID, you need a specific skin davelord Scripting Help 9 07/08/2012 01:09 AM
Assign a vehicle to a player / account ? Gomma Help Archive 1 28/07/2011 12:06 AM
How can i spawn a specific player in a specific vehicle ? AlbanianGuy Help Archive 8 16/01/2010 07:31 AM


All times are GMT. The time now is 09:20 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.