AddVehicleComponent not showing after respawn [HELP]
#1

Alright so the problem is when i mod a car, it doesn't matter if transfender or another modshop, it saves when i park the car, but when i use /respawn or if the car broke and respawns the mods are not showing.

Here is the OnVehicleSpawn
Код:
public OnVehicleSpawn(vehicleid)
{

	if(vehicleid != 509 && vehicleid != 481 && vehicleid != 510)
	{
	    SetVehicleParamsEx(vehicleid, 0, 0, 0, 0, 0, 0, 0);
		foreach(Player, i)
		{
		    if(vehicleid == PlayerInfo[i][pVeh])
		    {
		        if(PlayerInfo[i][vLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0);
	                ChangeVehicleColor(PlayerInfo[i][pVeh], PlayerInfo[i][vC1], PlayerInfo[i][vC2]);
				for(new x=0; x<14; i++)
				{
					AddVehicleComponent(PlayerInfo[i][pVeh], PlayerInfo[i][pVehMod][x]);
				}
		    }
		    if(vehicleid == PlayerInfo[i][pVVeh])
		    {
		        if(PlayerInfo[i][vVLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0);
	                ChangeVehicleColor(PlayerInfo[i][pVVeh], PlayerInfo[i][vVC1], PlayerInfo[i][vVC2]);
				for(new x=0; x<14; i++)
				{
                    AddVehicleComponent(PlayerInfo[i][pVVeh], PlayerInfo[i][pVVehMod][x]);
				}
		    }
		    if(vehicleid == PlayerInfo[i][pBVeh])
		    {
		        if(PlayerInfo[i][vBLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0);
                       ChangeVehicleColor(PlayerInfo[i][pBVeh], PlayerInfo[i][vBC1], PlayerInfo[i][vBC2]);
				for(new x=0; x<14; i++)
				{
				    AddVehicleComponent(PlayerInfo[i][pBVeh], PlayerInfo[i][pBVehMod][x]);
				}
		    }
		}
		if(IsTruckerVehicle(vehicleid))
		{
		    TruckPackages[vehicleid] = -1;
		}
		if(Siren[vehicleid])
		{
			Siren[vehicleid] = 0;
	        DestroyDynamicObject(SirenObject[vehicleid]);
	        DestroyDynamicObject(LightObject1[vehicleid]);
        }
    }
	return 1;
}
Reply
#2

Add this code in your script.
Код:
public OnVehicleMod(playerid, vehicleid, componentid)
{
    if(vehicleid == PlayerInfo[playerid][pVeh])
        PlayerInfo[playerid][pVehMod][GetVehicleComponentType(componentid)] = componentid;
    if(vehicleid == PlayerInfo[playerid][pVVeh])
        PlayerInfo[playerid][pVVehMod][GetVehicleComponentType(componentid)] = componentid;
    if(vehicleid == PlayerInfo[playerid][pBVeh])
    	PlayerInfo[playerid][pBVehMod][GetVehicleComponentType(componentid)] = componentid;
    
	return 1;
}
That code will assign the componentid of the mods into vehicle mods variable
Reply
#3

I tryied but is still not working.
Reply
#4

I think the problem is still from OnVehicleSpawn i am not pretty sure.
Reply
#5

Anyone got an idea?
Reply
#6

Read the forum rules please... 24 hour bumps only.
Reply
#7

Bump.
Reply
#8

Try using printf statements to show what is being "saved" as it may not be saving.

Or have you checked the file/db that it's saving to?
Reply
#9

The problem is that the mod are saving i've tryied to save the car and restart the server. Car mods are saving but if i use /respawn to respawn all cars or just the car only the mods disspears.. also even if the car blows or if i throw it in the water.
Reply
#10

Quote:
Originally Posted by catal4n
Посмотреть сообщение
The problem is that the mod are saving i've tryied to save the car and restart the server. Car mods are saving but if i use /respawn to respawn all cars or just the car only the mods disspears.. also even if the car blows or if i throw it in the water.
How exactly do you know it's saving? You haven't exactly answered what I asked...


Have you actually checked that the information is being saved to the players account?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)