SA-MP Forums Archive
don't return the value "Saving Tuning Car" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: don't return the value "Saving Tuning Car" (/showthread.php?tid=647192)



don't return the value "Saving Tuning Car" - Darkay - 31.12.2017

Hello guys, i am doing a save for the tuning parts of the cars, but it don't return the component's id, this is my code, i have done it since 0.

Код:
//trying to get the component's id
public OnVehicleMod(playerid, vehicleid, componentid)
{
	if(cvp[playerid][0] == true && vehicleid == vplayer[playerid][0])
	{
	    gpi[playerid][spoiler] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_SPOILER);
	    new string[200]; format(string, sizeof(string), "espoiler %d", gpi[playerid][spoiler]);
	    SendClientMessage(playerid, -1, string);
	    gpi[playerid][hood] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_HOOD);
	    gpi[playerid][roof] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_ROOF);
        gpi[playerid][sideskirt] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_SIDESKIRT);
        gpi[playerid][lamps] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_LAMPS);
        gpi[playerid][nitro] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_NITRO);
        gpi[playerid][ex] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_EXHAUST);
        gpi[playerid][wheels] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_WHEELS);
        gpi[playerid][hy] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_HYDRAULICS);
        gpi[playerid][fb] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_FRONT_BUMPER);
        gpi[playerid][rb] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_REAR_BUMPER);
        gpi[playerid][vr] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_VENT_RIGHT);
        gpi[playerid][vl] = GetVehicleComponentInSlot(vplayer[playerid][0], CARMODTYPE_VENT_LEFT);
	}
	else if(cvp[playerid][1] == true && vehicleid == vplayer[playerid][1])
	{
	    gpi[playerid][spoiler2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_SPOILER);
	    gpi[playerid][hood2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_HOOD);
	    gpi[playerid][roof2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_ROOF);
        gpi[playerid][sideskirt2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_SIDESKIRT);
        gpi[playerid][lamps2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_LAMPS);
        gpi[playerid][nitro2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_NITRO);
        gpi[playerid][ex2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_EXHAUST);
        gpi[playerid][wheels2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_WHEELS);
        gpi[playerid][hy2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_HYDRAULICS);
        gpi[playerid][fb2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_FRONT_BUMPER);
        gpi[playerid][rb2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_REAR_BUMPER);
        gpi[playerid][vr2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_VENT_RIGHT);
        gpi[playerid][vl2] = GetVehicleComponentInSlot(vplayer[playerid][1], CARMODTYPE_VENT_LEFT);
		new string[200], string2[200]; format(string, sizeof(string), "%d %d %d %d %d", gpi[playerid][spoiler2],gpi[playerid][roof2], gpi[playerid][hood2],gpi[playerid][sideskirt2],gpi[playerid][lamps2]);
        format(string2, sizeof(string2), "%d %d %d %d %d %d %d", gpi[playerid][nitro2],gpi[playerid][ex2], gpi[playerid][hy2],gpi[playerid][fb2],gpi[playerid][rb2],gpi[playerid][vr2],gpi[playerid][vl2]);
        SendClientMessage(playerid, -1, string); SendClientMessage(playerid, -1, string2);
	 }
	return 1;
}

//load component's id
forward CarMod(playerid);
public CarMod(playerid)
{
    if(gpi[playerid][vehicles]  == 1 || gpi[playerid][vehicles]  == 2 || gpi[playerid][vehicles]  == 3 || gpi[playerid][vehicles]  == 4)
	{
	    AddVehicleComponent(vplayer[playerid][0], gpi[playerid][spoiler]); AddVehicleComponent(vplayer[playerid][0], gpi[playerid][ex]);
	    AddVehicleComponent(vplayer[playerid][0], gpi[playerid][hood]); AddVehicleComponent(vplayer[playerid][0], gpi[playerid][hy]);
	    AddVehicleComponent(vplayer[playerid][0], gpi[playerid][roof]); AddVehicleComponent(vplayer[playerid][0], gpi[playerid][fb]);
	    AddVehicleComponent(vplayer[playerid][0], gpi[playerid][sideskirt]); AddVehicleComponent(vplayer[playerid][0], gpi[playerid][rb]);
	    AddVehicleComponent(vplayer[playerid][0], gpi[playerid][lamps]); AddVehicleComponent(vplayer[playerid][0], gpi[playerid][vr]);
	    AddVehicleComponent(vplayer[playerid][0], gpi[playerid][nitro]); AddVehicleComponent(vplayer[playerid][0], gpi[playerid][vl]);
	    AddVehicleComponent(vplayer[playerid][0], gpi[playerid][wheels]);
	}
	if(gpi[playerid][vehicles]  == 1 || gpi[playerid][vehicles]  == 2 || gpi[playerid][vehicles]  == 3 || gpi[playerid][vehicles]  == 4)
	{
	    AddVehicleComponent(vplayer[playerid][1], gpi[playerid][spoiler2]); AddVehicleComponent(vplayer[playerid][1], gpi[playerid][ex2]);
	    AddVehicleComponent(vplayer[playerid][1], gpi[playerid][hood2]); AddVehicleComponent(vplayer[playerid][1], gpi[playerid][hy2]);
	    AddVehicleComponent(vplayer[playerid][1], gpi[playerid][roof2]); AddVehicleComponent(vplayer[playerid][1], gpi[playerid][fb2]);
	    AddVehicleComponent(vplayer[playerid][1], gpi[playerid][sideskirt2]); AddVehicleComponent(vplayer[playerid][1], gpi[playerid][rb2]);
	    AddVehicleComponent(vplayer[playerid][1], gpi[playerid][lamps2]); AddVehicleComponent(vplayer[playerid][1], gpi[playerid][vr2]);
	    AddVehicleComponent(vplayer[playerid][1], gpi[playerid][nitro2]); AddVehicleComponent(vplayer[playerid][1], gpi[playerid][vl2]);
	    AddVehicleComponent(vplayer[playerid][1], gpi[playerid][wheels2]);
 	}
 	
	return 1;
}


//the save by mysql
format(gquery, 2600, "UPDATE `cars` SET `spoiler`='%d', `hood`='%d', `roof`='%d', `sideskirt`='%d', `lamps`='%d', `nitro`='%d' WHERE `account_id`='%d'",gpi[playerid][spoiler],gpi[playerid][hood],gpi[playerid][roof],gpi[playerid][sideskirt],gpi[playerid][lamps],gpi[playerid][nitro],gpi[playerid][id]);
    mysql_function_query(gconection, gquery, true, "", "", 0, playerid);
    
    format(gquery, 2600, "UPDATE `cars` SET `exhaust`='%d', `wheels`='%d', `hydraulics`='%d', `frontbumper`='%d', `rearbumper`='%d', `ventr`='%d', `ventl`='%d' WHERE `account_id`='%d'",gpi[playerid][ex],gpi[playerid][wheels],gpi[playerid][hy],gpi[playerid][fb],gpi[playerid][rb],gpi[playerid][vr],gpi[playerid][vl],gpi[playerid][id]);
    mysql_function_query(gconection, gquery, true, "", "", 0, playerid);