18.05.2013, 15:45
Hello. I've... weird issue - for several minutes trying to simplify the function to create pvars using macros. Unfortunately - standard PVars didn't want to run in OnGameModeInit and Main too.
Code, that I'm use:
I don't know why this code won't work, especially since OnGameModeInit always performed first, and Main - second (though, even if I change the order of PVars, in the sense - in the main is set and GameModeInit downloaded, they don't work).
Code, that I'm use:
pawn Код:
#include <a_samp>
#define sprintf(%0,%1,%2) format(%0, sizeof(%0), %1, %2)
public OnGameModeInit()
{
new playerid;
new date[3];
new test[128];
gettime(date[0], date[1], date[2]);
sprintf(test, "Hello. Server start at: %d:%d:%d", date[0], date[1], date[2]);
SetPVarString(playerid, "TEST", test);
return true;
}
main()
{
new playerid = 0, test[128];
GetPVarString(playerid, "TEST", test, sizeof(test));
printf(#%s, test);
return false;
}