SA-MP Forums Archive
Can't hit players - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: General (https://sampforum.blast.hk/forumdisplay.php?fid=13)
+--- Thread: Can't hit players (/showthread.php?tid=536796)



Can't hit players - Affan - 12.09.2014

So when I am on top of a island which I used to create by using ID 17143, I can't hit another player. But I am able to hit on normal San Andreas land. Any fix?


Re: Can't hit players - FlawPaw - 12.09.2014

Common bug when you are on an island mapped far away from SA, you cant deal melee damage.


Re: Can't hit players - Abagail - 12.09.2014

You can script the melee damaging in script-wise how-ever(I'm assuming...),

Maybe this will work?
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(!IsPlayerInAnyVehicle(playerid) && newkeys & KEY_FIRE)
    {
        if(IsPlayerConnected(playerid) && GetPlayerTargetPlayer(playerid) != INVALID_PLAYER_ID)
        {
            if(IsPlayerInRangeOfPoint(playerid, 100.0, x, y, z))
            {
                new i = GetPlayerTargetPlayer(playerid);
                new Float: dmgamount;
                GetPlayerHealth(i, dmgamount);
                SetPlayerHealth(i, dmgamount - 5);
                return true;
            }
        }
    }
    return true;
}
Of-course replacing X, Y, Z with the coordinates of your island, not sure if this would work or not.


Re: Can't hit players - admantis - 13.09.2014

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You can script the melee damaging in script-wise how-ever(I'm assuming...),

Maybe this will work?
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(!IsPlayerInAnyVehicle(playerid) && newkeys & KEY_FIRE)
    {
        if(IsPlayerConnected(playerid) && GetPlayerTargetPlayer(playerid) != INVALID_PLAYER_ID)
        {
            if(IsPlayerInRangeOfPoint(playerid, 100.0, x, y, z))
            {
                new i = GetPlayerTargetPlayer(playerid);
                new Float: dmgamount;
                GetPlayerHealth(i, dmgamount);
                SetPlayerHealth(i, dmgamount - 5);
                return true;
            }
        }
    }
    return true;
}
Of-course replacing X, Y, Z with the coordinates of your island, not sure if this would work or not.
This is OK, but you need to add a limit or an animation check because if you click very fast it will kill you in seconds.

The bug happens when you give damage outside of the San Andreas Map boundries (-3000 x 3000).


Re: Can't hit players - Affan - 13.09.2014

It's really not that far, just near some mountains. Anyways, I'll give a try.


Re: Can't hit players - ATV - 13.09.2014

Had the same problem and it never really got fixed


Re: Can't hit players - Affan - 14.09.2014

Quote:
Originally Posted by ATV
Посмотреть сообщение
Had the same problem and it never really got fixed
The code above helped me fixed it, I put some extra measures like if player is looking at target, and if the weaponid is 0. If you want to hit, you have to right click and hit, then it works.