Load vehicles
#5

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Is this the code from PerfectDM.pwn?
yes...
the full code:
pawn Код:
public OnGameModeExit()
{
    new string[452];
    for(new i, size = sizeof Teleports; i < size; i++)
    {
        mysql_format(SQL, string, sizeof string, "INSERT INTO `teleports` (`PID`, `Closed`) VALUES(%d, %d) ON DUPLICATE KEY UPDATE `Closed` = %d", i, Teleports[i][tClosed], Teleports[i][tClosed]);
        mysql_query(SQL, string);
    }
    for(new i, size = sizeof Weapons; i < size; i++)
    {
        mysql_format(SQL, string, sizeof string, "INSERT INTO `weapons` (`WID`, `PID`, `Ammo`, `Price`, `Level`, `Special`, `ForSale`, `OuterList`, `MaxAmmo`) VALUES(%d, %d, %d, %d, %d, %d, %d, %d, %d) ON DUPLICATE KEY", Weapons[i][WeaponID], i, Weapons[i][WeaponAmmo], Weapons[i][WeaponPrice], Weapons[i][WeaponLevel], Weapons[i][SpecialWeapon], Weapons[i][WeaponForSale], Weapons[i][OuterList], Weapons[i][WeaponMaxAmmo]);
        mysql_format(SQL, string, sizeof string, "%e UPDATE `WID` = %d, `Ammo` = %d, `Price` = %d, `Level` = %d, `Special` = %d, `ForSale` = %d, `OuterList` = %d, `MaxAmmo` = %d", string, Weapons[i][WeaponID], Weapons[i][WeaponAmmo], Weapons[i][WeaponPrice], Weapons[i][WeaponLevel], Weapons[i][SpecialWeapon], Weapons[i][WeaponForSale], Weapons[i][OuterList], Weapons[i][WeaponMaxAmmo]);
        mysql_query(SQL, string);
    }
    new file[14];
    for(new i; i < MAX_VEHICLES; i++) if(IsValidVehicle(i) && Vehicles[i][vCreated])
    {
        format(file, sizeof file, "Cars/%d.ini", i);
        new INI:ini = INI_Open(file);
        INI_SetTag(ini, "VehicleData");
        INI_WriteInt(ini, "Model", Vehicles[i][vModel]);
        INI_WriteFloat(ini, "X", Vehicles[i][vPos][0]);
        INI_WriteFloat(ini, "Y", Vehicles[i][vPos][1]);
        INI_WriteFloat(ini, "Z", Vehicles[i][vPos][2]);
        INI_WriteFloat(ini, "A", Vehicles[i][vPos][3]);
        INI_WriteInt(ini, "Color1", Vehicles[i][vColor][0]);
        INI_WriteInt(ini, "Color2", Vehicles[i][vColor][1]);
        INI_WriteInt(ini, "Price", Vehicles[i][vPrice]);
        INI_WriteInt(ini, "Type", Vehicles[i][vType]);
        INI_WriteBool(ini, "HaveOwners", Vehicles[i][vHaveOwners]);
        INI_WriteString(ini, "Owners", Vehicles[i][vOwners]);
        INI_WriteString(ini, "Name", Vehicles[i][vName]);
        INI_WriteInt(ini, "PayTax", Vehicles[i][vPayTax]);
        INI_WriteInt(ini, "Sale", Vehicles[i][vSale]);
        INI_WriteInt(ini, "3DColor", Vehicles[i][v3DColor]);
        INI_WriteString(ini, "3DText", Vehicles[i][v3DText]);
        INI_WriteBool(ini, "HaveNitro", Vehicles[i][vHaveNitro]);
        INI_WriteBool(ini, "HaveAutoNitro", Vehicles[i][vHaveAutoNitro]);
        INI_WriteBool(ini, "HaveHyd", Vehicles[i][vHaveHyd]);
        INI_WriteBool(ini, "HaveDisco", Vehicles[i][vHaveDisco]);
        INI_WriteBool(ini, "DiscoActive", Vehicles[i][vDiscoActive]);
        INI_WriteInt(ini, "Wheels", Vehicles[i][vWheels]);
        INI_Close(ini);
    }
    mysql_close();
    return 1;
}
Reply


Messages In This Thread
Load vehicles - by benel1 - 16.03.2015, 17:00
Re: Load vehicles - by ATGOggy - 16.03.2015, 17:11
Re: Load vehicles - by benel1 - 16.03.2015, 17:27
Re: Load vehicles - by ATGOggy - 16.03.2015, 17:34
Re: Load vehicles - by benel1 - 16.03.2015, 17:41
Re: Load vehicles - by ATGOggy - 16.03.2015, 18:04
Re: Load vehicles - by benel1 - 17.03.2015, 13:43
Re: Load vehicles - by benel1 - 17.03.2015, 21:20
Re: Load vehicles - by SickAttack - 17.03.2015, 21:32

Forum Jump:


Users browsing this thread: 1 Guest(s)