09.06.2012, 02:33
Everything works perfectly, but... Why this tick doesn't work anymore?
Everything else works perfectly, but I can spam /getup as much as I want... Why's that? Why the tick won't limit it?
pawn Код:
new g_bCrackState[MAX_PLAYERS];
new g_tCrackTick[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
SetTimer("AutoCrack", 3500, true);
SetPlayerSkin(playerid, 28);
GivePlayerWeapon(playerid, 24, 50);
GivePlayerWeapon(playerid, 25, 50);
GivePlayerWeapon(playerid, 29, 300);
GivePlayerWeapon(playerid, 30, 300);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new
Float:health;
GetPlayerHealth(playerid, health);
if (strcmp("/getup", cmdtext, true, 6) == 0)
{
GetPlayerHealth(playerid,health);
if(health < 20.0)
if ((GetTickCount() - g_tCrackTick[playerid]) > 15000)
{
SetPlayerHealth(playerid, 21);
TogglePlayerControllable(playerid, true);
ApplyAnimation(playerid,"PED","getup_front",5.0,0,1,1,1,1,1);
SendClientMessage(playerid, 0x4AF8FF, " You've successfully got up! Remember to roleplay your injuries. ");
g_bCrackState[playerid] = 0;
}
}
public AutoCrack(playerid)
{
new Float:health;
GetPlayerHealth(playerid,health);
if(health < 20.0 && !g_bCrackState[playerid])
{
TogglePlayerControllable(playerid, false);
ApplyAnimation(playerid,"PED","KO_spin_L",3.0,0,1,1,1,1,1);
g_bCrackState[playerid] = 1;
}
return 1;
}
Everything else works perfectly, but I can spam /getup as much as I want... Why's that? Why the tick won't limit it?