Problem with saving vehicle system.
#1

Hello, When in my script there's /vehiclesave cmd, when i use it it's works fine before the gmx.
but when i do the gmx it dosen't save the vehicle.
please help me.
PHP код:
dcmd_vehicle(playeridparams[])
{
    new 
caridstring128 ], FloatCarToXFloatCarToYFloatCarToZphysical_car_id;
    if( 
sscanfparams"d"carid) )
    {
        if( 
PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pGangMod] == 1)
        {
            
SendClientMessageplayeridCOLOR_WHITE"USAGE: /vehicle [vehicleid]" );
        }
    }
    else
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            if(
CarCount MAX_VEHICLES)
            {
                if(
carid 400 || carid 611)
                {
                    
SendClientMessageplayeridCOLOR_WHITE"Valid car IDs start from 400, ending at 611." );
                    return 
1;
                }
                
GetPlayerPos(playeridCarToXCarToYCarToZ);
                
physical_car_id CreateVehicle(caridCarToXCarToYCarToZ90, -1, -1, -1);
                
formatstringsizeof( string ), "You have spawned vehicle model %d. If you wish to save this, type ."carid);
                
VehicleSpawned[SpawnedVehicles] = physical_car_id;
                
SpawnedVehicles++;
                
SendClientMessageplayeridCOLOR_WHITEstring);
                
PutPlayerInVehicleplayeridphysical_car_id);
                
LinkVehicleToInterior(physical_car_idGetPlayerInteriorplayerid ) );
                
SetVehicleVirtualWorld(physical_car_idGetPlayerVirtualWorldplayerid ) );
            }
            else
            {
                
SendClientMessageplayeridCOLOR_GREY"Despawn the current spawned vehicles before spawning any more." );
            }
        }
    }
    return 
1;
}
dcmd_vehiclesave(playeridparams[])
{
    
#pragma unused params
     
if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        if(
UnconfirmedSave[playerid] == 0)
        {
            
SendClientMessageplayeridCOLOR_LIGHTRED"Are you sure you want to save this vehicle? Please re-type this command to confirm this action." );
            
UnconfirmedSave[playerid] = 1;
        }
        else
        {
            
UnconfirmedSave[playerid] = 0;
            if(
IsPlayerInAnyVehicle(playerid))
            {
                new 
idVehicle[16], vehicleid GetPlayerVehicleIDplayerid ), string[128];
                
id CarCount+1;
                
format(Vehiclesizeof(Vehicle), "V_%d"id);
                if(
djIsSet(VEHICLES_FILEVehicle))
                {
                    
CarCount++;
                    
formatstringsizeof( string ), "Vehicle (ID: %d) already exist!"id);
                       
SendClientMessageplayeridCOLOR_GREYstring);
                     
SendClientMessageplayeridCOLOR_YELLOW"Please try again by typing /vehiclesave complete");
                }
                else
                {
                       
GetVehiclePos(vehicleidVehicles[id][CarPosX], Vehicles[id][CarPosY], Vehicles[id][CarPosZ]);
                    
GetVehicleZAngle(vehicleidVehicles[id][CarZAngle]);
                     new 
plate[255];
                    new 
randl1 random(sizeof(Letters1));
                    new 
randl2 random(sizeof(Letters2));
                    new 
randl3 random(sizeof(Letters3));
                    new 
randl4 random(sizeof(Letters4));
                    new 
randn1 random(sizeof(Numbers1));
                    new 
randn2 random(sizeof(Numbers2));
                    new 
randn3 random(sizeof(Numbers3));
                    
format(platesizeof(plate),"%s%s%s%s %s%s%s"Letters1[randl1], Letters2[randl2], Letters3[randl3], Letters4[randl4], Numbers1[randn1], Numbers2[randn2], Numbers3[randn3]);
                    
Vehicles[id][Plate] = plate;
                    
Vehicles[id][CarModel] = GetVehicleModel(vehicleid);
                    
Vehicles[id][CarColour1] = -1;
                    
Vehicles[id][CarColour2] = -1;
                    
Vehicles[id][Faction] = 0;
                    
djAutocommit(false);
                    
format(Vehiclesizeof(Vehicle), "V_%d/PosX"id);
                    
djSetFloat(VEHICLES_FILEVehicleVehicles[id][CarPosX], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/PosY"id);
                    
djSetFloat(VEHICLES_FILEVehicleVehicles[id][CarPosY], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/PosZ"id);
                    
djSetFloat(VEHICLES_FILEVehicleVehicles[id][CarPosZ], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/ZAngle"id);
                    
djSetFloat(VEHICLES_FILEVehicleVehicles[id][CarZAngle], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/Model"id);
                    
djSetInt(VEHICLES_FILEVehicleVehicles[id][CarModel], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/Faction"id);
                    
djSetInt(VEHICLES_FILEVehicleVehicles[id][Faction], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/Col1"id);
                    
djSetInt(VEHICLES_FILEVehicleVehicles[id][CarColour1], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/Col2"id);
                    
djSetInt(VEHICLES_FILEVehicleVehicles[id][CarColour2], true);
                    
format(Vehiclesizeof(Vehicle), "V_%d/Plate"id);
                    
djSet(VEHICLES_FILEVehicleVehicles[id][Plate], true);
                    
djCommit(VEHICLES_FILE);
                    
djAutocommit(true);
                    
CarCount++;
                    
printf"[system] Vehicle %d has been saved to %s."idVEHICLES_FILE);
                    
SendClientMessageplayeridCOLOR_LIGHTBLUE"Vehicle saved!" );
                    
DestroyVehiclevehicleid );
                    
Vehicles[id][GameID] = CreateVehicleVehicles[id][CarModel], Vehicles[id][CarPosX], Vehicles[id][CarPosY], Vehicles[id][CarPosZ], Vehicles[id][CarZAngle], Vehicles[id][CarColour1], Vehicles[id][CarColour2], 3600 );
                    
SetVehicleNumberPlate(Vehicles[id][GameID], Vehicles[id][Plate]);
                    
PutPlayerInVehicleplayeridVehicles[id][GameID], );
                    
SendClientMessageplayeridCOLOR_YELLOW"You can despawn this vehicle by using /vehicledelete.");
                       for(new 
0SpawnedVehiclesi++)
                    {
                        if(
VehicleSpawned[i] == GetPlayerVehicleID(playerid))
                        {
                            
VehicleSpawned[i] = 0;
                        }
                    }
                }
            }
        }
    }
    return 
1;
}
dcmd_vehicledelete(playeridparams[])
{
    
#pragma unused params
    
if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        if(
UnconfirmedSave[playerid] == 0)
        {
            
SendClientMessageplayeridCOLOR_LIGHTRED"Are you sure you want to delete this vehicle? Please re-type this command to confirm this action." );
            
UnconfirmedSave[playerid] = 1;
        }
        else
        {
            
UnconfirmedSave[playerid] = 0;
            if(
IsPlayerInAnyVehicle(playerid))
            {
                new 
idVehicle[16], vehicleid GetPlayerVehicleID(playerid);
                
id GetVehicleFileID(vehicleid);
                
format(Vehiclesizeof(Vehicle), "V_%d"id);
                if(
djIsSet(VEHICLES_FILEVehicle))
                {
                    
format(Vehiclesizeof(Vehicle), "V_%d"id);
                    
djUnset(VEHICLES_FILEVehicle);
                    
CarCount--;
                    
printf"[system] Vehicle %d has been deleted to %s."idVEHICLES_FILE);
                    
SendClientMessageplayeridCOLOR_LIGHTBLUE"Vehicle deleted!" );
                    
DestroyVehicle(vehicleid);
                }
                else
                {
                    
SendClientMessageplayeridCOLOR_GREY"Unable to delete the vehicle!" );
                }
            }
        }
    }
    return 
1;
}
dcmd_vehiclefid(playeridparams[])
{
    new 
idstring128 ], ftext[128];
    if( 
sscanfparams"d"id))
    {
        if( 
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            
SendClientMessageplayeridCOLOR_WHITE"USAGE: /vehiclefid [Faction ID]" );
            
SendClientMessageplayeridCOLOR_YELLOW"HINT: Type /vehiclefid 0 to unlock the vehicle." );
        }
    }
    else
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            if(
IsPlayerInAnyVehicle(playerid))
            {
                new 
vehicleid GetPlayerVehicleID(playerid);
                if(
id || id 10)
                {
                    if(
GetVehicleFileID(vehicleid)  == 0)
                    {
                        
SendClientMessageplayeridCOLOR_GREY"That doesn't seem to be a saved vehicle!" );
                    }
                    else
                    {
                        if(
id == 0)
                        {
                            
SendClientMessageplayeridCOLOR_LIGHTBLUE"You have unlocked this vehicle!" );
                            
Vehicles[GetVehicleFileID(vehicleid)][Faction] = 0;
                        }
                        else
                        {
                            if(
id == 1) { ftext "LSPD"; }
                            else if(
id == 2) { ftext "FBI"; }
                            else if(
id == 3) { ftext "RCSD"; }
                            else if(
id == 4) { ftext "LSFMD"; }
                            else if(
id == 5) { ftext "National Guards"; }
                            else if(
id == 6) { ftext "Senate"; }
                            else if(
id == 7) { ftext "Secret Service"; }
                            else if(
id == 8) { ftext "Hitman Agency"; }
                            else if(
id == 9) { ftext "News Agency"; }
                            else if(
id == 10) { ftext "Taxi Cab Company"; }
                            
Vehicles[GetVehicleFileID(vehicleid)][Faction] = id;
                            
formatstringsizeof( string ), "You have Locked this vehicle for Faction %s !"ftext);
                            
SendClientMessageplayeridCOLOR_LIGHTBLUEstring);
                            
SaveExistingVehicle(vehicleid);
                        }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"   Faction can't be below 1 or above 10!");
                     return 
1;
                }
            }
            else
            {
                
SendClientMessageplayeridCOLOR_GREY"You are not in a valid vehicle!" );
            }
        }
    }
    return 
1;

Reply
#2

Of course it's will not be saved because when you gmx server it's will be unLoaded.

____________________
MY SERVER:

Server forum
-------
Be$t Host for your server : HostingTime Easy control panel with 1Euro for 20 slots.
Reply
#3

Quote:
Originally Posted by [M.A]Angel[M.A]
Посмотреть сообщение
Of course it's will not be saved because when you gmx server it's will be unLoaded.

____________________
MY SERVER:

Server forum
-------
Be$t Host for your server : HostingTime Easy control panel with 1Euro for 20 slots.
And? there's a way to fix it?
Reply
#4

Any answer?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)