Anti Knifebugging without OnPlayerUpdate
#1

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.");
		}
		}
		}
Reply
#2

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;
}
Reply
#3

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.");
		}
		}
		}
Reply
#4

do you have a Function Map?
Reply
#5

Use OnPlayerGiveDamage to detect knifed players issuer sided.
Reply
#6

Yes, but it wont detect it:

Код:
new Map[mapinfo];
Reply
#7

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".
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)