SA-MP Forums Archive
vehicle tune saving help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: vehicle tune saving help (/showthread.php?tid=187682)



vehicle tune saving help - The_Gangstas - 04.11.2010

pawn Code:
public OnVehicleMod(playerid,vehicleid,componentid)
{
    if(IsBuyableCar[vehicleid])
    {
        if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],Playername(playerid)))
        {
            if(componentid == 0)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune0`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[0]]=componentid;
            }
            else if(componentid == 1)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune1`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[1]]=componentid;
            }
            else if(componentid == 2)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune2`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[2]]=componentid;
            }
            else if(componentid == 3)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune3`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[3]]=componentid;
            }
            else if(componentid == 4)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune4`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[4]]=componentid;
            }
            else if(componentid == 5)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune5`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[5]]=componentid;
            }
            else if(componentid == 6)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune6`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[6]]=componentid;
            }
            else if(componentid == 7)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune7`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[7]]=componentid;
            }
            else if(componentid == 8)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune8`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[8]]=componentid;
            }
            else if(componentid == 9)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune9`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[9]]=componentid;
            }
            else if(componentid == 10)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune10`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[10]]=componentid;
            }
            else if(componentid == 11)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune11`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[11]]=componentid;
            }
            else if(componentid == 12)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune12`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[12]]=componentid;
            }
            else if(componentid == 13)
            {
            format(GlobalQuery,sizeof(GlobalQuery),"UPDATE `Vehicles` SET `Tune13`=%d WHERE CarID = %d LIMIT 1",componentid,VehicleSystem[IsBuyableCar[vehicleid]][CarID]);
            print(GlobalQuery);
            mysql_query(GlobalQuery);
            VehicleSystem[IsBuyableCar[vehicleid]][cMod[13]]=componentid;
            }
        }
    }
    return 1;
}
doesnt work S: