Loading 1 all time when creating new. - 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: Loading 1 all time when creating new. (
/showthread.php?tid=482973)
Loading 1 all time when creating new. -
jueix - 23.12.2013
Ok. I have a problem, When I create a new ATM it loads 1, So the ATM's ID is always 1 and doesn't change, I want it so that when a player types /addatm it will create an ATM with an ID that hasn't be used for example if he creates 2 ATM's and he deletes ATM 1 it recreates ATM 1 then if he creates an other it creates ATM 3.
Here's my code.
pawn Код:
stock GetATMs()
{
new file[60];
for(new i = 0; i < MAX_ATM;i++)
{
format(file,sizeof(file),"ATMs/%i.ini",i);
if(!dini_Exists(file)) continue;
}
return 1;
}
*Don't script much in sa-mp any more*.
Re: Loading 1 all time when creating new. -
Jefff - 23.12.2013
pawn Код:
stock GetATMs()
{
new file[15];
for(new i = 0; i < MAX_ATM;i++)
{
format(file,sizeof(file),"/ATMs/%i.ini",i);
if(!dini_Exists(file)) return i;
}
return -1;
}
pawn Код:
new FreeSlot = GetATMs();
if(FreeSlot == -1) return Is now MAX_ATM files
// code here
Re: Loading 1 all time when creating new. -
jueix - 23.12.2013
Quote:
Originally Posted by Jefff
pawn Код:
stock GetATMs() { new file[15]; for(new i = 0; i < MAX_ATM;i++) { format(file,sizeof(file),"/ATMs/%i.ini",i); if(!dini_Exists(file)) return i; } return -1; }
pawn Код:
new FreeSlot = GetATMs(); if(FreeSlot == -1) return Is now MAX_ATM files // code here
|
Thanks.