wether and time set to 0 when server restarts
#1

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;

Reply
#2

Under ongamemodeinit

Код:
SetWeather(WeatherInfo[Weather]);
SetWorldTime(WeatherInfo[Time]);
?
Reply
#3

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
Reply
#4

nvm guys i fixed it my INI_ParseFile part was the problem
Reply
#5

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
Reply
#6

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); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)