Give back my components!
#1

Код:
 	components[0] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_SPOILER);
	components[1] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_HOOD);
	components[2] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_ROOF);
	components[3] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_SIDESKIRT);
    components[4] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_LAMPS);
    components[5] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_NITRO);
    components[6] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_EXHAUST);
    components[7] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_WHEELS);
    components[8] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_STEREO);
    components[9] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_STEREO);
    components[10] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_HYDRAULICS);
    components[11] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_REAR_BUMPER);
    components[12] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_VENT_RIGHT);
    components[13] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_VENT_LEFT);
    
    RemoveVehicleComponent(vehicleid, components[0]);
    RemoveVehicleComponent(vehicleid, components[1]);
    RemoveVehicleComponent(vehicleid, components[2]);
    RemoveVehicleComponent(vehicleid, components[3]);
    RemoveVehicleComponent(vehicleid, components[4]);
    RemoveVehicleComponent(vehicleid, components[5]);
    RemoveVehicleComponent(vehicleid, components[6]);
    RemoveVehicleComponent(vehicleid, components[7]);
    RemoveVehicleComponent(vehicleid, components[8]);
    RemoveVehicleComponent(vehicleid, components[9]);
    RemoveVehicleComponent(vehicleid, components[10]);
    RemoveVehicleComponent(vehicleid, components[11]);
    RemoveVehicleComponent(vehicleid, components[12]);
    RemoveVehicleComponent(vehicleid, components[13]);
    
    AddVehicleComponent(vehicleid, components[0]);
    AddVehicleComponent(vehicleid, components[1]);
    AddVehicleComponent(vehicleid, components[2]);
    AddVehicleComponent(vehicleid, components[3]);
    AddVehicleComponent(vehicleid, components[4]);
    AddVehicleComponent(vehicleid, components[5]);
    AddVehicleComponent(vehicleid, components[6]);
    AddVehicleComponent(vehicleid, components[7]);
    AddVehicleComponent(vehicleid, components[8]);
    AddVehicleComponent(vehicleid, components[9]);
    AddVehicleComponent(vehicleid, components[10]);
    AddVehicleComponent(vehicleid, components[11]);
    AddVehicleComponent(vehicleid, components[12]);
    AddVehicleComponent(vehicleid, components[13]);
Why not giving back my components? : /
Reply
#2

Post full code.
Reply
#3

That's full.. ? you need new components[14]; ? lol. I need to give back components after vehicle respawn, that's all.

edit://
I tried with:
Код:
 	components[0] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_SPOILER));
	components[1] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_HOOD));
	components[2] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_ROOF));
	components[3] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_SIDESKIRT));
    components[4] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_LAMPS));
    components[5] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_NITRO));
    components[6] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_EXHAUST));
    components[7] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_WHEELS));
    components[8] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_STEREO));
    components[9] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_STEREO));
    components[10] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_HYDRAULICS));
    components[11] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_REAR_BUMPER));
    components[12] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_VENT_RIGHT));
    components[13] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), GetVehicleComponentType(CARMODTYPE_VENT_LEFT));
But nothing..
Reply
#4

No man, i could not understand until you post full fs on www.pastebin.com, That would be easier to correct.
Reply
#5

Just.. save my components and put them back. You don't need to see my full code. It's only save and load.
Reply
#6

Hmm which vehicle are you trying to add those components?
Reply
#7

https://sampwiki.blast.hk/wiki/Function:AddVehicleComponent
https://sampwiki.blast.hk/wiki/GetVehicleComponentInSlot
https://sampwiki.blast.hk/wiki/RemoveVehicleComponent

This could help you.
Reply
#8

Try this

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    RemoveVehicleComponent(vehicleid, components[0]);
    RemoveVehicleComponent(vehicleid, components[1]);
    RemoveVehicleComponent(vehicleid, components[2]);
    RemoveVehicleComponent(vehicleid, components[3]);
    RemoveVehicleComponent(vehicleid, components[4]);
    RemoveVehicleComponent(vehicleid, components[5]);
    RemoveVehicleComponent(vehicleid, components[6]);
    RemoveVehicleComponent(vehicleid, components[7]);
    RemoveVehicleComponent(vehicleid, components[8]);
    RemoveVehicleComponent(vehicleid, components[9]);
    RemoveVehicleComponent(vehicleid, components[10]);
    RemoveVehicleComponent(vehicleid, components[11]);
    RemoveVehicleComponent(vehicleid, components[12]);
    RemoveVehicleComponent(vehicleid, components[13]);
    return 1;
}
Then this?

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    AddVehicleComponent(vehicleid, components[0]);
    AddVehicleComponent(vehicleid, components[1]);
    AddVehicleComponent(vehicleid, components[2]);
    AddVehicleComponent(vehicleid, components[3]);
    AddVehicleComponent(vehicleid, components[4]);
    AddVehicleComponent(vehicleid, components[5]);
    AddVehicleComponent(vehicleid, components[6]);
    AddVehicleComponent(vehicleid, components[7]);
    AddVehicleComponent(vehicleid, components[8]);
    AddVehicleComponent(vehicleid, components[9]);
    AddVehicleComponent(vehicleid, components[10]);
    AddVehicleComponent(vehicleid, components[11]);
    AddVehicleComponent(vehicleid, components[12]);
    AddVehicleComponent(vehicleid, components[13]);
    return 1;
}
Reply
#9

Quote:
Originally Posted by Davz*|*Criss
Посмотреть сообщение
Try this

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    RemoveVehicleComponent(vehicleid, components[0]);
    RemoveVehicleComponent(vehicleid, components[1]);
    RemoveVehicleComponent(vehicleid, components[2]);
    RemoveVehicleComponent(vehicleid, components[3]);
    RemoveVehicleComponent(vehicleid, components[4]);
    RemoveVehicleComponent(vehicleid, components[5]);
    RemoveVehicleComponent(vehicleid, components[6]);
    RemoveVehicleComponent(vehicleid, components[7]);
    RemoveVehicleComponent(vehicleid, components[8]);
    RemoveVehicleComponent(vehicleid, components[9]);
    RemoveVehicleComponent(vehicleid, components[10]);
    RemoveVehicleComponent(vehicleid, components[11]);
    RemoveVehicleComponent(vehicleid, components[12]);
    RemoveVehicleComponent(vehicleid, components[13]);
    return 1;
}
He wants to put back the components, not remove them.
Reply
#10

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
Код:
 	components[0] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_SPOILER);
	components[1] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_HOOD);
	components[2] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_ROOF);
	components[3] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_SIDESKIRT);
    components[4] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_LAMPS);
    components[5] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_NITRO);
    components[6] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_EXHAUST);
    components[7] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_WHEELS);
    components[8] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_STEREO);
    components[9] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_STEREO);
    components[10] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_HYDRAULICS);
    components[11] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_REAR_BUMPER);
    components[12] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_VENT_RIGHT);
    components[13] = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_VENT_LEFT);
    
    RemoveVehicleComponent(vehicleid, components[0]);
    RemoveVehicleComponent(vehicleid, components[1]);
    RemoveVehicleComponent(vehicleid, components[2]);
    RemoveVehicleComponent(vehicleid, components[3]);
    RemoveVehicleComponent(vehicleid, components[4]);
    RemoveVehicleComponent(vehicleid, components[5]);
    RemoveVehicleComponent(vehicleid, components[6]);
    RemoveVehicleComponent(vehicleid, components[7]);
    RemoveVehicleComponent(vehicleid, components[8]);
    RemoveVehicleComponent(vehicleid, components[9]);
    RemoveVehicleComponent(vehicleid, components[10]);
    RemoveVehicleComponent(vehicleid, components[11]);
    RemoveVehicleComponent(vehicleid, components[12]);
    RemoveVehicleComponent(vehicleid, components[13]);
    
    AddVehicleComponent(vehicleid, components[0]);
    AddVehicleComponent(vehicleid, components[1]);
    AddVehicleComponent(vehicleid, components[2]);
    AddVehicleComponent(vehicleid, components[3]);
    AddVehicleComponent(vehicleid, components[4]);
    AddVehicleComponent(vehicleid, components[5]);
    AddVehicleComponent(vehicleid, components[6]);
    AddVehicleComponent(vehicleid, components[7]);
    AddVehicleComponent(vehicleid, components[8]);
    AddVehicleComponent(vehicleid, components[9]);
    AddVehicleComponent(vehicleid, components[10]);
    AddVehicleComponent(vehicleid, components[11]);
    AddVehicleComponent(vehicleid, components[12]);
    AddVehicleComponent(vehicleid, components[13]);
Why not giving back my components? : /
Are you saving the components to file ?
That how i do my modded vehicles.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)