08.02.2016, 04:29
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?
And also this one
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.
Код:
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; }
Код:
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; }