Question about PVars and timerex. -
PaulDinam - 19.02.2013
When player logs out, if the player has a timer on or a PVar, it will stop automatically? or i'll have to killtimer
Re: Question about PVars and timerex. -
DaRk_RaiN - 19.02.2013
You could avoid such situations simply by turning them off when player disconnect
A timer for example
pawn Код:
forward Timer(playerid);
public Timer(playerid)
{
if(!IsPlayerConnected(playerid))return KillTimer(YourTimer);
}
For PVars i think they get set to false when player disconnects but anyways you could use
pawn Код:
public OnPlayerDisconnect(playerid)
{
SetPVarInt(playerid, "MyVar", 0);
//.......
Re: Question about PVars and timerex. -
Johnson_boy - 19.02.2013
PVars are reseted on disconnect, timers are not. Even though you have passed the player id to the timer as a parameter, it considers it just as a normal integer.
Re: Question about PVars and timerex. -
Scenario - 19.02.2013
Use y_timer's ptask, it will start/stop on connection/disconnect.
In regards to PVars, they will reset on disconnect. However, the example DaRk_RaiN gave is wrong. You're wasting memory by keeping the PVar if you aren't going to use it- just use
DeletePVar().
Re: Question about PVars and timerex. -
PaulDinam - 19.02.2013
One more question:
I got this code:
Код:
public OnPlayerSpawn(playerid)
{
if(GetIntVar(playerid, "gLogged") != 1)
{
KickEx(playerid, "[SERVER]: You must be logged in to spawn!");
}
if(GetIntVar(playerid, "JustDied") == 1)
{
PutPlayer(playerid, PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
ClearAnimations(playerid);
ApplyAnimation(playerid, "CRACK", "crckdeth1", 4.0, 1, 0, 0, 0, 0); // Dieing of Crack
return 1;
}
return 1;
}
It's doesn't apply the animation on the player..
Re: Question about PVars and timerex. -
Scenario - 19.02.2013
Animations are tricky. There are a few different pieces of code around here, but you basically need to load the animation libraries before you can have synced animations. Search the function "PreloadAnimLib" or something like that- it should return some good results.
Re: Question about PVars and timerex. -
PaulDinam - 19.02.2013
Okay I've fixed it, added onPlayerDeath
PreloadPlayerAnims(playerid);
which I have found on the internet
Re: Question about PVars and timerex. -
PaulDinam - 19.02.2013
Why when I freeze the player, his animations are stopped.
i've seen server when the players dies, he got freezed and still in animation.