[codehelp] Pause func

Started by kielorz
30/03/2009 15:38
Page 1 of 1
kielorz30/03/2009 15:38

here's code:

public cmdPause(id)
{
if(is_user_alive(id) && started[id])
{
new temp = IsPaused[id];
if(!temp || temp == 2)
{
PauseTime[id] += (thetime() - timer[id]);
IsPaused[id] = 1;
timer[id] = 0.0;
set_hudmessage(255, 255, 0, -1.0, 0.01, 0, 0.0, 2.0, 0.0, 1.0, -1);
ShowSyncHudMsg(id, MsgSync, "Paused!");
set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN);
}
else
{
IsPaused[id] = (IsPaused[id] == 1) ? 2 : 1;
timer[id] = thetime();
set_hudmessage(255, 255, 0, -1.0, 0.01, 0, 0.0, 2.0, 0.0, 1.0, -1);
ShowSyncHudMsg(id, MsgSync, "Unpaused!");
set_pev(id, pev_flags, pev(id, pev_flags) | ~FL_FROZEN);
}
}
else
{
set_hudmessage(255, 0, 0, -1.0, 0.01, 0, 0.0, 2.0, 0.0, 1.0, -1);
ShowSyncHudMsg(id, MsgSync, "You must start timer to be able to pause!");
}
return PLUGIN_HANDLED;
}

when i want to enable the pause, it enables, but when i want to disable it server crash

HEEEEEEELP MEE!!

kielorz30/03/2009 15:43

aaagrh.... fixed:)

public cmdPause(id)
{
if(is_user_alive(id) && started[id])
{
new temp = IsPaused[id];
if(!temp || temp == 2)
{
PauseTime[id] += (thetime() - timer[id]);
IsPaused[id] = 1;
timer[id] = 0.0;
set_hudmessage(255, 255, 0, -1.0, 0.01, 0, 0.0, 2.0, 0.0, 1.0, -1);
ShowSyncHudMsg(id, MsgSync, "Paused!");
set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN);
}
else
{
IsPaused[id] = (IsPaused[id] == 1) ? 2 : 1;
timer[id] = thetime();
set_hudmessage(255, 255, 0, -1.0, 0.01, 0, 0.0, 2.0, 0.0, 1.0, -1);
ShowSyncHudMsg(id, MsgSync, "Unpaused!");
set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN);
}
}
else
{
set_hudmessage(255, 0, 0, -1.0, 0.01, 0, 0.0, 2.0, 0.0, 1.0, -1);
ShowSyncHudMsg(id, MsgSync, "You must start timer to be able to pause!");
}
return PLUGIN_HANDLED;
}

Page 1 of 1

Please log in to post replies.