Timer doesn't work !!! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer doesn't work !!! (
/showthread.php?tid=562942)
Timer doesn't work !!! -
nezo2001 - 12.02.2015
Again -_- the first timer work but the other not
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_FIRE))
{
if(checked[playerid] == false && GetPlayerWeaponState(playerid) != WEAPONSTATE_RELOADING)
{
bAmmo[playerid] = GetPlayerAmmo(playerid);
bWeapon[playerid] = GetPlayerWeapon(playerid);
if(GetPlayerWeapon(playerid) < 16 || GetPlayerWeapon(playerid) == 19 || GetPlayerWeapon(playerid) == 20 || GetPlayerWeapon(playerid) == 21 || GetPlayerWeapon(playerid) > 38) return 0;
SetTimerEx("Acheck",500,false,"i",playerid);
new string[128];
format(string,sizeof(string),"Ammo %i",bAmmo);
printf(string);
checked[playerid] = true;
}
}
return 1;
}
forward Acheck(playerid);
public Acheck(playerid)
{
print("Checked!");
nAmmo[playerid] = GetPlayerAmmo(playerid);
nWeapon[playerid] = GetPlayerWeapon(playerid);
SetTimerEx("check",500,false,"i",playerid);
return 1;
}
forward check(playerid);
public check(playerid)
{
print("Hack Checked!");
if(bAmmo[playerid] == nAmmo[playerid] && bWeapon[playerid] == nWeapon[playerid] && GetPlayerWeaponState(playerid) != WEAPONSTATE_RELOADING)
{
new string[128];
new name[MAX_PLAYER_NAME], string1[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(pm[playerid] == false && sm[playerid] == false)
{
format(string,sizeof(string),"%s has banned for ammo hack",name);
SendClientMessageToAll(0xAA3333AA,string);
SendClientMessage(playerid, 0xAA3333AA,"You have banned from the server ");
}
printf("Cheat Detect");
SetTimerEx("ban",500,false,"i",playerid);
pm[playerid] = true;
sm[playerid] = true;
checked[playerid] = false;
#pragma unused string1
}
checked[playerid] = false;
return 1;
}
The problem I in check timer it didn't print anything or didn't ban the player.
Please Help.
REP+++
Re: Timer doesn't work !!! -
1fret - 13.02.2015
Did you try changing the timer interval
1 second = 1000millisec
Re: Timer doesn't work !!! -
nezo2001 - 13.02.2015
-_- i know i made it half a second
Re: Timer doesn't work !!! -
nezo2001 - 13.02.2015
Ok it worked by magic xD
But i doesn't set the bool to false