Originally Posted by showarn
Maybe this one?
Код:
new car = VehicleOwned[vehicleid];
if(CarInfo[car][cMod][0] == 0)
{
CarInfo[car][cMod][0] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 0.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][1] == 0)
{
CarInfo[car][cMod][1] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 1.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][2] == 0)
{
CarInfo[car][cMod][2] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 2.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][3] == 0)
{
CarInfo[car][cMod][3] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 3.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][4] == 0)
{
CarInfo[car][cMod][4] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 4.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][5] == 0)
{
CarInfo[car][cMod][5] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 5.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][6] == 0)
{
CarInfo[car][cMod][6] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 6.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][7] == 0)
{
CarInfo[car][cMod][7] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 7.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else if(CarInfo[car][cMod][8] == 0)
{
CarInfo[car][cMod][8] = componentid;
SendClientMessage(playerid,COLOR_WHITE,"Vehicle component bought for 100$, Slot 8.");
GivePlayerPCash(playerid,-100);
//SaveCars();
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"You vehicle components has hit its limited, Please /v unmod or exit.");
}
return 1;
}
Код:
forward Restarting();
public Restarting()
{
new string[128];
new Restart = 20;
SaveCars();
OnPropUpdate();
foreach (Player, i)
{
if(Restart >= 1)
{
Restart --;
PlayerPlaySound(i, 1138, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~n~~r~%d",Restart);
GameTextForAll(string, 5000, 3);
}
else if(Restart == 0)
{
OnPlayerDataSave(i);
SendRconCommand("gmx");
}
}
return 1;
}
Код:
/*forward SaveCars();
public SaveCars()
{
new idx;
new File: file2;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%i,%i,%i,%i,%i,%i,%i,%i,%f,%i,%d,%i,%i,%i,%i\n",
CarInfo[idx][cModel],
CarInfo[idx][cLocationx],
CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],
CarInfo[idx][cColorOne],
CarInfo[idx][cColorTwo],
CarInfo[idx][cOwner],
CarInfo[idx][cDescription],
CarInfo[idx][cValue],
CarInfo[idx][cLicense],
CarInfo[idx][cOwned],
CarInfo[idx][cLock],
CarInfo[idx][cMod][0],
CarInfo[idx][cMod][1],
CarInfo[idx][cMod][2],
CarInfo[idx][cMod][3],
CarInfo[idx][cMod][4],
CarInfo[idx][cMod][5],
CarInfo[idx][cMod][6],
CarInfo[idx][cMod][7],
CarInfo[idx][cMod][8],
CarInfo[idx][cMod][9],
CarInfo[idx][cDonate],
CarInfo[idx][cFuel],
CarInfo[idx][cTrunkWep][1],
CarInfo[idx][cTrunkAmmo][1],
CarInfo[idx][cTrunkWep][2],
CarInfo[idx][cTrunkAmmo][2],
CarInfo[idx][cTrunkWep][3],
CarInfo[idx][cTrunkAmmo][3],
CarInfo[idx][cTrunkWep][4],
CarInfo[idx][cTrunkAmmo][4],
CarInfo[idx][cTrunkArmour],
CarInfo[idx][cTrunkCounter],
CarInfo[idx][cAlarm],
CarInfo[idx][cTrunkDrugs],
CarInfo[idx][cTrunkMats],
CarInfo[idx][cImpounded],
CarInfo[idx][cImpoundedPrice]);
if(idx == 0)
{
file2 = fopen("cars.cfg", io_write);
}
else
{
file2 = fopen("cars.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
}*/
forward SaveCars();
public SaveCars()
{
new idx;
new string[1024];
while (idx < sizeof(CarInfo))
{
format(string, sizeof(string), "UPDATE `cars` SET `Model`=%d,`LocationX`=%f,`LocationY`=%f,`LocationZ`=%f,`Angle`=%f,`Color1`=%d,`Color2`=%d,`Owner`='%s',`Description`='%s',`Value`=%d,`License`='%s',`Owned`=%d,`Lock`=%d,`Mod0`=%d,`Mod1`=%d,`Mod2`=%d,`Mod3`=%d,`Mod4`=%d,`Mod5`=%d,`Mod6`=%d,`Mod7`=%d,`Mod8`=%d,`Mod9`=%d,`Donate`=%d,`Fuel`=%d,`TrunkWeapon1`=%i,`TrunkAmmo1`=%i,`TrunkWeapon2`=%i,`TrunkAmmo2`=%i,`TrunkWeapon3`=%i,`TrunkAmmo3`=%i WHERE `ID`=%d",
CarInfo[idx][cModel],
CarInfo[idx][cLocationx],
CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],
CarInfo[idx][cColorOne],
CarInfo[idx][cColorTwo],
CarInfo[idx][cOwner],
CarInfo[idx][cDescription],
CarInfo[idx][cValue],
CarInfo[idx][cLicense],
CarInfo[idx][cOwned],
CarInfo[idx][cLock],
CarInfo[idx][cMod][0],
CarInfo[idx][cMod][1],
CarInfo[idx][cMod][2],
CarInfo[idx][cMod][3],
CarInfo[idx][cMod][4],
CarInfo[idx][cMod][5],
CarInfo[idx][cMod][6],
CarInfo[idx][cMod][7],
CarInfo[idx][cMod][8],
CarInfo[idx][cMod][9],
CarInfo[idx][cDonate],
CarInfo[idx][cFuel],
CarInfo[idx][cTrunkWep][1],
CarInfo[idx][cTrunkAmmo][1],
CarInfo[idx][cTrunkWep][2],
CarInfo[idx][cTrunkAmmo][2],
CarInfo[idx][cTrunkWep][3],
CarInfo[idx][cTrunkAmmo][3],
idx);
mysql_query_ex(string);
format(string, sizeof(string), "UPDATE `cars` SET `TrunkWeapon4`=%i,`TrunkAmmo4`=%i,`TrunkArmour`=%f,`TrunkCounter`=%i,`Alarm`=%d,`TrunkDrugs`=%i,`TrunkMats`=%i,`Impounded`=%i,`ImpoundedPrice`=%i, `Insurance`=%d WHERE `ID`=%d",
CarInfo[idx][cTrunkWep][4],
CarInfo[idx][cTrunkAmmo][4],
CarInfo[idx][cTrunkArmour],
CarInfo[idx][cTrunkCounter],
CarInfo[idx][cAlarm],
CarInfo[idx][cTrunkDrugs],
CarInfo[idx][cTrunkMats],
CarInfo[idx][cImpounded],
CarInfo[idx][cImpoundedPrice],
CarInfo[idx][cInsurance],
idx);
mysql_query_ex(string);
idx++;
}
}
|