Set Car ID
#1

Hello eveyone,

I'm scripting my own server. when I spawn a car and save it, after the restart the car ID changes and the car become a faction car. So I need some command to set car ID.
Reply
#2

For faction vehicles, use variables as in new car; OnGameModeInit() car = CreateVehicle(bleh, blah, blah)
Reply
#3

You don't understand. The problem is that the cars become faction cars, and I don't want it to be like that.
Reply
#4

Please ask your question more specifically. With pieces of code so we can see what you mean.
What I know, is that the CarID is returned by CreateVehicle or AddStaticVehicle(Ex), when you save a car and restart the server, the car would be spawned according to you. Dependent on the order your cars are createn it could become another CarID! What you should do, in my opinion, is to put all the CarIDs of the faction vehicles in an array and when a player enters a car, check if that car is a faction vehicle. Something like this
pawn Код:
#define MAX_FAC_VEH     100 // change 100 to the amount of faction vehicles createn

new FactionVehicles[MAX_FAC_VEH];

public OnGameModeInit(){
    FactionVehicles[0] = CreateVehicle(modelid, x, y, ... params ...);
    FactionVehicles[1] = CreateVehicle(modelid, x, y, ... params ...);
    FactionVehicles[2] = CreateVehicle(modelid, x, y, ... params ...);
    FactionVehicles[3] = CreateVehicle(modelid, x, y, ... params ...);
    // .. etcetera
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){
    new i;
    for(i = 0; i < MAX_FAC_VEH; i++){
        if(vehicleid == FactionVehicles[i]) return SendClientMessage(playerid, 0xFFFFFFFF, "(( [SERVER]: You entered a faction vehicle ))");
    }
    #pragma unused ispassenger
}
If that is what you mean?
Reply
#5

I was far from script for some 4 months, but i guess you have a database, and you are saving the cars there right?
Well, if no, you need to create one.
If you eed help, i can do it, but i will need to check my gamemode, to see what i did because to be honest, i needed to check my own tutorials to remember how to create a command.
Reply
#6

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
I was far from script for some 4 months, but i guess you have a database, and you are saving the cars there right?
Well, if no, you need to create one.
Or he could use files

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
to be honest, i needed to check my own tutorials to remember how to create a command.
LAWL xD
Reply
#7

Still, maybe someone can create command to set the ID of a car?
Reply
#8

Quote:
Originally Posted by zxc1
Посмотреть сообщение
I'm scripting my own server.
I don't think so, because this is a very common problem that occurs when people try to add vehicles to the GodFather or any of its edits.
Reply
#9

Quote:
Originally Posted by StilThere
Посмотреть сообщение
Or he could use files



LAWL xD
Lol................. To save them into files you need a database system such as Dini.......
I think i am not saying shit.
And yes, i think he is editing because in a clean GM, made by you, you don't have this kind of problems.

The 2, 1:
Or he is editing some script else,
Or he is leacking something.

Try to post your script, so we can better help you.
Reply
#10

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Lol................. To save them into files you need a database system such as Dini.......
I think i am not saying shit.
And yes, i think he is editing because in a clean GM, made by you, you don't have this kind of problems.

The 2, 1:
Or he is editing some script else,
Or he is leacking something.

Try to post your script, so we can better help you.
When you say database I think of MySQL and running apache on your home pc to create a database system. Files are a whole level below that and easier to start with
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)