SA-MP Forums Archive
Anti Knifebugging without OnPlayerUpdate - 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: Anti Knifebugging without OnPlayerUpdate (/showthread.php?tid=450402)



Using this without OnPlayerUpdate - Blackazur - 13.07.2013

Hello, this is my code i have on OnPlayerUpdate, but how to make something, that it works, WITHOUT OnPlayerUpdate? it says undefined symbol Map:

Код:
        new Float:hp;
	GetPlayerHealth(playerid,hp);
    if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);

    if(IsSpecing[playerid] == 0)
	{
	if(Map[AllowWater] == 0)
	{
    	if(IsPlayerInWater(playerid))
		{
			SetPlayerHealth(playerid,0.0);
			SendClientMessage(playerid,-1,""chat""COL_WHITE" You died because you touched the water.");
		}
		}
		}



Re: Anti Knifebugging without OnPlayerUpdate - ToiletDuck - 13.07.2013

NOt tested, try this.
pawn Код:
//put this top of your script
new antiknifebug;
//put this under ongamemodeinit.
antiknifebug = SetTimer("knifebug", 700, 1);// 700milisecond 1 means true.
//put this anywhere
forward knifebug(playerid);
public knifebug(playerid)
{
if(GetPlayerAnimationIndex( playerid ) )
    {
        new
            animlib[ 32 ],
            animname[ 32 ]
        ;
        GetAnimationName( GetPlayerAnimationIndex( playerid ), animlib, 32, animname, 32 );
        if( !strcmp( animlib, "KNIFE", true ) && !strcmp( animname, "KILL_PARTIAL", true ) )
        {
            Loading(playerid);
            ClearAnimations(playerid);
          }
          }
return 1;
}



AW: Anti Knifebugging without OnPlayerUpdate - Blackazur - 13.07.2013

I maked in other thing and it works now, but how to make now this without OnPlayerUpdate because when i try it with forward it says undefined symbol Map:

Код:
        new Float:hp;
	GetPlayerHealth(playerid,hp);
    if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);

    if(IsSpecing[playerid] == 0)
	{
	if(Map[AllowWater] == 0)
	{
    	if(IsPlayerInWater(playerid))
		{
			SetPlayerHealth(playerid,0.0);
			SendClientMessage(playerid,-1,""chat""COL_WHITE" You died because you touched the water.");
		}
		}
		}



Re: Anti Knifebugging without OnPlayerUpdate - ToiletDuck - 13.07.2013

do you have a Function Map?


AW: Anti Knifebugging without OnPlayerUpdate - BigETI - 13.07.2013

Use OnPlayerGiveDamage to detect knifed players issuer sided.


AW: Anti Knifebugging without OnPlayerUpdate - Blackazur - 13.07.2013

Yes, but it wont detect it:

Код:
new Map[mapinfo];



AW: Anti Knifebugging without OnPlayerUpdate - BigETI - 13.07.2013

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Yes, but it wont detect it:
[/code]
How it may not detect the "throat cutting animation" damaging another players?

Actually OnPlayerGiveDamage returns properly the weapon being used (obviously a knife, if of course used), and a huge damage value caused by the "throat cutting animation".


AW: Anti Knifebugging without OnPlayerUpdate - Blackazur - 13.07.2013

i mean this:

Код:
e:
        new Float:hp;
	GetPlayerHealth(playerid,hp);
    if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);

    if(IsSpecing[playerid] == 0)
	{
	if(Map[AllowWater] == 0)
	{
    	if(IsPlayerInWater(playerid))
		{
			SetPlayerHealth(playerid,0.0);
			SendClientMessage(playerid,-1,""chat""COL_WHITE" You died because you touched the water.");
		}
		}
		}
that it wont detect that with Map