Can't change weather in my server
#1

Hello, I just ran into an issue where I can't seem to be able to change the weather of my server, nor the time. I tried isolating the problem, which resulted in it occuring with only my gamemode running. However, I can't find in the gamemode script any sign of a weather reverting script, as the search for "weather" gave no results. If anyone happens to know what might be causing this problem, and wants to share, I'd be very thankfull. Thank you for reading!
Reply
#2

Quote:
Originally Posted by WingedFrostWolf
Посмотреть сообщение
Hello, I just ran into an issue where I can't seem to be able to change the weather of my server, nor the time. I tried isolating the problem, which resulted in it occuring with only my gamemode running. However, I can't find in the gamemode script any sign of a weather reverting script, as the search for "weather" gave no results. If anyone happens to know what might be causing this problem, and wants to share, I'd be very thankfull. Thank you for reading!
If you mean the function GetWeather(weather);

It is not, but it can be created from an array

PHP код:
enum E_SRV_INFO {
     
WEATHERID,
     
HOURS
}
new 
srv_info[E_SRV_INFO];
// Declaration new functions
#define SetWeatherAll(%1)   srv_info[WEATHERID] = %1; SetWeather(%1)
#define GetWeatherAll()       srv_info[WEATHERID]
#define SetTimeAll(%1)        srv_info[HOURS] = %1; SetWorldTime(%1)
#define GetTimeAll()            srv_info[HOURS]
public OnGameModeInit() {
     
SetTimeAll(5);
     
SetWeatherAll(3);
     return 
true;
}
public 
OnPlayerSpawn(playerid) {
     
prinf("SERVER: hours %d weather %d"GetTimeAll(), GetWeatherAll());
     return 
true;

* Since sa-mp 0.3.7 R2-1:

PHP код:
// Server wide persistent variable system (SVars)
// Declaration new functions
#define SetWeatherAll(%1)   SetSVarInt("WEATHERID", %1); SetWeather(%1)
#define GetWeatherAll()       GetSVarInt("WEATHERID")
#define SetTimeAll(%1)        SetSVarInt("HOURS", %1); SetWorldTime(%1)
#define GetTimeAll()            GetSVarInt("HOURS")
public OnGameModeInit() {
     
SetTimeAll(5);
     
SetWeatherAll(3);
     return 
true;
}
public 
OnPlayerSpawn(playerid) {
     
prinf("SERVER: hours %d weather %d"GetTimeAll(), GetWeatherAll());
     return 
true;

Reply
#3

Thank you very much, I managed to fix the problem. However, it was infact a clientside issue, which I didn't think of as a possibility, I managed to debug the problem with your help, so thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)