wether and time set to 0 when server restarts - 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: wether and time set to 0 when server restarts (
/showthread.php?tid=603523)
wether and time set to 0 when server restarts -
SalmaN97 - 24.03.2016
This is my code i am trying to save server weather and time in a file called "WeatherInfo.INI" it works and save but when i restart the server both time and weather will be set to 0
My code:
PHP код:
enum wInfo
{
Weather,
Time
};
new WeatherInfo[wInfo];
// gamemodeint
INI_ParseFile("WeatherInfo.INI" , "LoadWeather_%s", .bExtra = true );
printf("Weather: %i.", WeatherInfo[Weather]);
printf("Time: %i.", WeatherInfo[Time]);
//gamemodeexit
new INI:File = INI_Open("WeatherInfo.INI");
INI_SetTag(File,"WeatherInfo");
INI_WriteInt(File,"Weather", WeatherInfo[Weather]);
INI_WriteInt(File,"Time", WeatherInfo[Time]);
INI_Close(File);
//loadfunction
forward LoadWeather_WeatherInfo(name[], value[]);
public LoadWeather_WeatherInfo(name[], value[])
{
INI_Int("Weather", WeatherInfo[Weather]);
INI_Int("Time", WeatherInfo[Time]);
return 1;
}
Re: wether and time set to 0 when server restarts -
David (Sabljak) - 24.03.2016
Under ongamemodeinit
Код:
SetWeather(WeatherInfo[Weather]);
SetWorldTime(WeatherInfo[Time]);
?
Re: wether and time set to 0 when server restarts -
SalmaN97 - 25.03.2016
Quote:
Originally Posted by David (Sabljak)
Under ongamemodeinit
Код:
SetWeather(WeatherInfo[Weather]);
SetWorldTime(WeatherInfo[Time]);
?
|
it doesn't work it sets the weather and time to 0 even if i did that because both will set to 0 once i restart the server data saved correctly because when i close the server and check data ini file it saved but there maybe a problem with loading and i cant find out
Re: wether and time set to 0 when server restarts -
SalmaN97 - 25.03.2016
nvm guys i fixed it my INI_ParseFile part was the problem
Re: wether and time set to 0 when server restarts -
Joron - 25.03.2016
Quote:
Originally Posted by SalmaN97
nvm guys i fixed it my INI_ParseFile part was the problem
|
Ah Yes,Incase anyone runs into this problem in the future what was the fix
Re: wether and time set to 0 when server restarts -
SalmaN97 - 25.03.2016
Quote:
Originally Posted by Joron
Ah Yes,Incase anyone runs into this problem in the future what was the fix
|
i replaced this:
PHP код:
INI_ParseFile("WeatherInfo.INI" , "LoadWeather_%s", .bExtra = true );
with this:
PHP код:
INI_ParseFile("WeatherInfo.INI", "LoadWeather_WeatherInfo", .bExtra = false, .extra = 0);