Ummm sadly I don't using libcod yet. But I trying to figure out.
It seems to work fine but I'm not sure that's the right way and if I'm die while sprinting then I have infinite sprint so the g_speed cvar isn't change back.
PHP Code:
init()
{
self endon("disconnect");
while(1)
{
if(self useButtonPressed())
{
self endon("death");
self setclientcvar("g_speed","300");
self iprintlnBold("Sprint activated!!");
wait 10;
self setclientcvar("g_speed","190");
wait 20;
}
}
}