OnPlayerWeaponShoot
#1

It'is possible when you shoot to other person then this callback is called, and no damage will be doing to him?
Reply
#2

Quote:
Originally Posted by audriuxxx
Посмотреть сообщение
It'is possible when you shoot to other person then this callback is called, and no damage will be doing to him?
Just return 0 when the target player should not take damage.
Example:
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new message[128];

    if (hittype == BULLET_HIT_TYPE_PLAYER && hitid != INVALID_PLAYER_ID && weaponid == WEAPON_DEAGLE)
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(hitid, x, y, z);
        if (!IsPlayerAimingAt(playerid, x, y, z, 1.5))
        {
            format(message, sizeof(message), "[Anti-Hack] Player %s (%d) is suspected to use No-Aim.", player_info[playerid][playername], playerid);
            SendAdminMessage(COLOR_RED, message);
            return 0;
        }
    }
    return 1;
}
Reply
#3

I know that but it'is possible that he can escape from bullet ? or something?
Reply
#4

Yes, its possible, for example player A shoot player B, but player B have modded skin. There are more examples, player on afk, bug with knife.
Reply
#5

Bug with knife? onplayerweaponshoot is called when you hit player with knife?
Reply
#6

Quote:
Originally Posted by audriuxxx
Посмотреть сообщение
Bug with knife? onplayerweaponshoot is called when you hit player with knife?
No. And it's called for alt-tabbed players.
Reply
#7

I know that already. Maybe somebody know what is everyweapon (and hunter shooting) how much damage they make from one shoot.
Reply
#8

Why would you need to know that? I don't even think you can say that definitively because the damage of the shotgun for example depends on how many bullets hit the target. But i have found this list:
http://pastebin.com/Z7aBuacN

Maybe it helps you
Reply
#9

Quote:
Originally Posted by Madd92
Посмотреть сообщение
Just return 0 when the target player should not take damage.
Example:
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new message[128];

    if (hittype == BULLET_HIT_TYPE_PLAYER && hitid != INVALID_PLAYER_ID && weaponid == WEAPON_DEAGLE)
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(hitid, x, y, z);
        if (!IsPlayerAimingAt(playerid, x, y, z, 1.5))
        {
            format(message, sizeof(message), "[Anti-Hack] Player %s (%d) is suspected to use No-Aim.", player_info[playerid][playername], playerid);
            SendAdminMessage(COLOR_RED, message);
            return 0;
        }
    }
    return 1;
}
Where is IsPlayerAiming at function?
Reply
#10

It's just an example, not that important. The function just checks whether the distance between the target and the aiming vector of the shooter is greater than 1.5.
The real problem to me is that I don't know what you really need ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)