SA-MP Forums Archive
Don't save the car's (mysql) - 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: Don't save the car's (mysql) (/showthread.php?tid=215975)



Don't save the car's (mysql) - Game94 - 24.01.2011

pawn Код:
public OnGameModeInit()
{
    for(new i = 0; i < MAX_VEH; i++)
    {
        VEHICLE_SPAWN[i] = CreateVehicle(VehicleInfo[i][vType], VehicleInfo[i][vPosX], VehicleInfo[i][vPosY], VehicleInfo[i][vPosZ], VehicleInfo[i][vPosA], VehicleInfo[i][vColor1], VehicleInfo[i][vColor2], -1);
    }
    return 1;
}
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    new string[128];
    for(new i; i < MAX_VEH; i++)
    {
        if(VEHICLE_SPAWN[i] == vehicleid)
        {
            outthecar[playerid] = vehicleid;
            format(string, sizeof(string), "%d vehID", outthecar[playerid]);
            SendClientMessage(playerid, COLOR_WHITE, string);
            savecar= outthecar[playerid];
            GetVehiclePos(savecar, VehicleInfo[savecar][vPosX], VehicleInfo[savecar][vPosY], VehicleInfo[savecar][vPosZ]);
            GetVehicleZAngle(savecar, VehicleInfo[savecar][vPosA]);
            SaveVehicle(savecar);
            outthecar[playerid] = 0;
            return 1;
        }
    }
    return 1;
}
pawn Код:
public SaveVehicle(vehID)
{
    new string[5][200];
    new parancs[1000];
    new s[128];
    format(string[0],200,"UPDATE cars SET vPosX = %f,vPosY = %f,vPosZ = %f,",VehicleInfo[vehID][vPosX],VehicleInfo[vehID][vPosY],VehicleInfo[vehID][vPosZ]);
    format(string[1],200,"vPosA = %f,vType = %d,vColor1 = %d,",VehicleInfo[vehID][vPosA],VehicleInfo[vehID][vType],VehicleInfo[vehID][vColor1]);
    format(string[2],200,"vColor2 = %d,vLocked = %d,vTulaj = %s",VehicleInfo[vehID][vColor2],VehicleInfo[vehID][vLocked],VehicleInfo[vehID][vTulaj]);
    format(string[3],200,"vMegvasarolt = %d,vAr = %d,ElkeszultKocsi = %d ",VehicleInfo[vehID][vMegvasarolt],VehicleInfo[vehID][vAr],VehicleInfo[vehID][vElkeszultKocsi]);
    format(string[4],200,"WHERE vID = '%d'",VehicleInfo[vehID][vID]);
    format(parancs,1000,"%s%s%s%s%s",string[0],string[1],string[2],string[3],string[4]);
    mysql_query(parancs);
    mysql_free_result();
    format(s, sizeof(string), "%d ID saved", savecar);
    SendClientMessageToAll(COLOR_WHITE, s);
    savecar= 0;
    return 1;
}
Why don't save the car ?


Re: Don't save the car's (mysql) - Max_Coldheart - 24.01.2011

Just use addStaticVehicle


Re: Don't save the car's (mysql) - Game94 - 24.01.2011

Don't work :S