|
for(new d = 0; d < 17; ++d) { new str[10]; format(str, sizeof(str),"mod%d", d); cache_get_field_content(i, str, contenido); AutoInfo[i][mod][d] = strval(contenido); AddVehicleComponent(i, AutoInfo[i][mod][d]); if(GetVehicleComponentInSlot(i,GetVehicleComponent Type(AutoInfo[i][mod][d])) == 0) { RemoveVehicleComponent(i,0); } } |
|
forward savecomponent(vehicleid, componentid); public savecomponent(vehicleid, componentid) { new playerid = GetDriverID(vehicleid); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { for(new s=0; s<20; s++) { if(componentid == spoiler[s][0]) { AutoInfo[vehicleid][mod][0] = componentid; UpdateInteger(vehicleid, "mod1", componentid); } } for(new s=0; s<4; s++) { if(componentid == bscoop[s][0]) { AutoInfo[vehicleid][mod][1] = componentid; UpdateInteger(vehicleid, "mod2", componentid); } } for(new s=0; s<17; s++) { if(componentid == rscoop[s][0]) { AutoInfo[vehicleid][mod][2] = componentid; UpdateInteger(vehicleid, "mod3", componentid); } } for(new s=0; s<21; s++) { if(componentid == rskirt[s][0]) { AutoInfo[vehicleid][mod][3] = componentid; UpdateInteger(vehicleid, "mod4", componentid); } } for(new s=0; s<21; s++) { if(componentid == lskirt[s][0]) { AutoInfo[vehicleid][mod][16] = componentid; UpdateInteger(vehicleid, "mod17", componentid); } } for(new s=0; s<2; s++) { if(componentid == lights[s][0]) { AutoInfo[vehicleid][mod][4] = componentid; UpdateInteger(vehicleid, "mod5", componentid); } } for(new s=0; s<3; s++) { if(componentid == nitro[s][0]) { AutoInfo[vehicleid][mod][5] = componentid; UpdateInteger(vehicleid, "mod6", componentid); } } for(new s=0; s<28; s++) { if(componentid == exhaust[s][0]) { AutoInfo[vehicleid][mod][6] = componentid; UpdateInteger(vehicleid, "mod7", componentid); } } for(new s=0; s<17; s++) { if(componentid == wheels[s][0]) { AutoInfo[vehicleid][mod][7] = componentid; UpdateInteger(vehicleid, "mod8", componentid); } } for(new s=0; s<1; s++) { if(componentid == vbase[s][0]) { AutoInfo[vehicleid][mod][8] = componentid; UpdateInteger(vehicleid, "mod9", componentid); } } for(new s=0; s<1; s++) { if(componentid == hydraulics[s][0]) { AutoInfo[vehicleid][mod][9] = componentid; UpdateInteger(vehicleid, "mod10", componentid); } } for(new s=0; s<23; s++) { if(componentid == fbumper[s][0]) { AutoInfo[vehicleid][mod][10] = componentid; UpdateInteger(vehicleid, "mod11", componentid); } } for(new s=0; s<22; s++) { if(componentid == rbumper[s][0]) { AutoInfo[vehicleid][mod][11] = componentid; UpdateInteger(vehicleid, "mod12", componentid); } } for(new s=0; s<2; s++) { if(componentid == bventr[s][0]) { AutoInfo[vehicleid][mod][12] = componentid; UpdateInteger(vehicleid, "mod13", componentid); } } for(new s=0; s<2; s++) { if(componentid == bventl[s][0]) { AutoInfo[vehicleid][mod][13] = componentid; UpdateInteger(vehicleid, "mod14", componentid); } } for(new s=0; s<2; s++) { if(componentid == fbbars[s][0]) { AutoInfo[vehicleid][mod][15] = componentid; UpdateInteger(vehicleid, "mod16", componentid); } } for(new s=0; s<4; s++) { if(componentid == rbbars[s][0]) { AutoInfo[vehicleid][mod][14] = componentid; UpdateInteger(vehicleid, "mod15", componentid); } } return 1; } return 0; } |
/* CODE BY MATI18
Recieved help from xLucy
PLEASE DONT REMOVE THESE CREDITS
*/
forward savecomponent(vehicleid, componentid); //This goes above the OnFilterscript/GamemodeInit
public savecomponent(vehicleid, componentid)
{
new playerid = GetDriverID(vehicleid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
for(new s=0; s<20; s++) {
if(componentid == spoiler[s][0]) {
AutoInfo[vehicleid][mod][0] = componentid;
UpdateInteger(vehicleid, "mod1", componentid);
}
}//Is this meant to be correct? Looks like bad syntax to me. Should be an opening
for(new s=0; s<4; s++) {
if(componentid == bscoop[s][0]) {
AutoInfo[vehicleid][mod][1] = componentid;
UpdateInteger(vehicleid, "mod2", componentid);
}
}
for(new s=0; s<17; s++) {
if(componentid == rscoop[s][0]) {
AutoInfo[vehicleid][mod][2] = componentid;
UpdateInteger(vehicleid, "mod3", componentid);
}
}
for(new s=0; s<21; s++) {
if(componentid == rskirt[s][0]) {
AutoInfo[vehicleid][mod][3] = componentid;
UpdateInteger(vehicleid, "mod4", componentid);
}
}
for(new s=0; s<21; s++) {
if(componentid == lskirt[s][0]) {
AutoInfo[vehicleid][mod][16] = componentid;
UpdateInteger(vehicleid, "mod17", componentid);
}
}
for(new s=0; s<2; s++) {
if(componentid == lights[s][0]) {
AutoInfo[vehicleid][mod][4] = componentid;
UpdateInteger(vehicleid, "mod5", componentid);
}
}
for(new s=0; s<3; s++) {
if(componentid == nitro[s][0]) {
AutoInfo[vehicleid][mod][5] = componentid;
UpdateInteger(vehicleid, "mod6", componentid);
}
}
for(new s=0; s<28; s++) {
if(componentid == exhaust[s][0]) {
AutoInfo[vehicleid][mod][6] = componentid;
UpdateInteger(vehicleid, "mod7", componentid);
}
}
for(new s=0; s<17; s++) { //Finish tabsizing them, either using the TAB key or
if(componentid == wheels[s][0]) { //Pressing space 4 times, i did this to the best of my ability, but its only
AutoInfo[vehicleid][mod][7] = componentid; //An example in the first place anyway
UpdateInteger(vehicleid, "mod8", componentid);
}
}
for(new s=0; s<1; s++) {
if(componentid == vbase[s][0]) {
AutoInfo[vehicleid][mod][8] = componentid;
UpdateInteger(vehicleid, "mod9", componentid);
}
}
for(new s=0; s<1; s++) {
if(componentid == hydraulics[s][0]) {
AutoInfo[vehicleid][mod][9] = componentid;
UpdateInteger(vehicleid, "mod10", componentid);
}
}
for(new s=0; s<23; s++) {
if(componentid == fbumper[s][0]) {
AutoInfo[vehicleid][mod][10] = componentid;
UpdateInteger(vehicleid, "mod11", componentid);
}
}
for(new s=0; s<22; s++) {
if(componentid == rbumper[s][0]) {
AutoInfo[vehicleid][mod][11] = componentid;
UpdateInteger(vehicleid, "mod12", componentid);
}
}
for(new s=0; s<2; s++) {
if(componentid == bventr[s][0]) {
AutoInfo[vehicleid][mod][12] = componentid;
UpdateInteger(vehicleid, "mod13", componentid);
}
}
for(new s=0; s<2; s++) {
if(componentid == bventl[s][0]) {
AutoInfo[vehicleid][mod][13] = componentid;
UpdateInteger(vehicleid, "mod14", componentid);
}
}
for(new s=0; s<2; s++) {
if(componentid == fbbars[s][0]) {
AutoInfo[vehicleid][mod][15] = componentid;
UpdateInteger(vehicleid, "mod16", componentid);
}
}
for(new s=0; s<4; s++) {
if(componentid == rbbars[s][0]) {
AutoInfo[vehicleid][mod][14] = componentid;
UpdateInteger(vehicleid, "mod15", componentid);
}
}
return 1;
}
return 0;
}
for(new d = 0; d < 17; ++d)
{
new str[10];
format(str, sizeof(str),"mod%d", d);
cache_get_field_content(i, str, contenido);
AutoInfo[i][mod][d] = strval(contenido); //Again, your tabsizes mate
AddVehicleComponent(i, AutoInfo[i][mod][d]);
if(GetVehicleComponentInSlot(i,GetVehicleComponent Type(AutoInfo[i][mod][d])) == 0) //Needs to be a bit back.
{
RemoveVehicleComponent(i,0);
} // Read Underneath
} //Looks like bad Syntax