Loop 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: Loop help (
/showthread.php?tid=526496)
Loop help -
mrkiller90 - 17.07.2014
How can I make a loop that loops through all house's name's files like called (0, 1, 2, 3...) and when it reaches the last number saved it adds one more so I can use that one to create a new house.
I know this is a little bit confusing to understand what I want, basically I want to create a command /createhouse to create an house but I need to store the id of that in Yini and I dont want to make a command like /createhouse [id] beacause that way I need to check everytime in the folder to see whats the last number I wrote
Hope you guys understand what I need please help me? ):
Re: Loop help -
ryansheilds - 17.07.2014
Sir you mean like this?
Код:
new
fileLocation[10],
returnID;
for(new i; i < YOURMAXHOUSES; i++) format(fileLocation, sizeof fileLocation, "%i.txt", i) {
if(!fexists(fileLocation)) {
returnID = i;
break;
}
}
// REST OF YOUR CODE, THE HOUSE ID WOULD BE "returnID"
(:
Re: Loop help -
mrkiller90 - 17.07.2014
exactaly that thank you!