SII to Y_INI 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)
+--- Thread: SII to Y_INI help (
/showthread.php?tid=600428)
SII to Y_INI help -
123ran1 - 08.02.2016
how could i convert this piece of code from SII to Y_INI since the rest of my script is Y_INI and the two are not compatible?
Код:
stock BuyCar(playerid, price)
{
new car = GetFreeVehicleSlot();
new name[24];
GetPlayerName(playerid, name, 24);
new string[MAX_PATH];
format(string, MAX_PATH, PLAYER_FILE_PATH, name);
INI_Open(string);
new slotstr[24];
new bool:success = false;
for(new i = 1; i <= MAX_CAR_SLOTS; i ++)
{
format(slotstr, 24, "Slot%d", i);
if(INI_ReadInt(slotstr) == 0)
{
INI_WriteInt(File, slotstr, car);
success = true;
break;
}
}
INI_Save;
INI_Close();
if(success)
{
GivePlayerMoney(playerid,-price);
}
else
{
SendClientMessage(playerid, -1, "{FF0000}Sorry, you already have all your car slots written!");
ShowPlayerDialog(playerid, -1,0,"","","","");
}
return 1;
}
And also this one
Код:
stock FreeSlotsAvailable(playerid)
{
new name[24];
GetPlayerName(playerid, name, 24);
new string[MAX_PATH];
format(string, MAX_PATH, PLAYER_FILE_PATH, name);
INI_Open(string);
new slotstr[24];
for(new i = 1; i <= MAX_CAR_SLOTS; i ++)
{
format(slotstr, 24, "Slot%d", i);
if(INI_ReadInt(slotstr) == 0) return 1;
}
return -1;
}
If your wondering, im trying to make a store where you can buy cars, you select which car you want from a dialog list and it spawns and it saves all its info, but im having troubles.