wierd foreach problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: wierd foreach problem (
/showthread.php?tid=183613)
wierd foreach problem -
armyoftwo - 16.10.2010
when i shutdown the server, i want it to save all properties
Код:
public OnGameModeExit()
{
foreach(Business, f) { SavePlayerFactory(f); }
foreach(Business, b) { SavePlayerBusiness(b); }
foreach(House, h) { SavePlayerHouse(h); }
return 1;
}
The functions work allright, tested. But this doesnt work!
Re: wierd foreach problem -
Rachael - 16.10.2010
I am pretty new to foreach, but try creating a public function
pawn Код:
forward GameModeSetupExitFunc();
...
public GameModeSetupExitFunc()
{
foreach(Business, f) { SavePlayerFactory(f); }
foreach(Business, b) { SavePlayerBusiness(b); }
foreach(House, h) { SavePlayerHouse(h); }
SetTimer("GameModeExit",4000,false);
return 1;
}
Re: wierd foreach problem -
Mauzen - 16.10.2010
Have you defined Business and House correctly? You need to tell foreach what it should loop. If you have, please show that code, too.
Re: wierd foreach problem -
armyoftwo - 16.10.2010
Quote:
Originally Posted by Mauzen
Have you defined Business and House correctly? You need to tell foreach what it should loop. If you have, please show that code, too.
|
Oh thanks i had an typo there.. I had Factory, Business, Houses