On Player Shoot Player?
#1

Here is what I have:
pawn Код:
forward DeagleShot(Shooter, Target);
forward TazerCharge(Shooter);
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    if(GetPlayerWeapon(Shooter) == 24 && PlayerInfo[Shooter][pGun02] == 24)
    {
        SetTimerEx("DeagleShot", 5000, 0, "ii", Shooter, Target);
        ApplyAnimation(Target, "ped", "WALK_fatold", 4.0, 1, 0, 0, 0, 0);
    }
    else if(PlayerInfo[Shooter][pFaction] == 1 && CopDuty[Shooter] == 1 && TazerCharged[Shooter] == 0)
    {
        if(GetPlayerWeapon(Shooter) == 23 && PlayerInfo[Shooter][pGun02] == 23 && Tazer[Shooter] == 1)
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(Target, X,Y,Z);
            if(IsPlayerInRangeOfPoint(Shooter, 15.0, X,Y,Z))
            {
                ApplyAnimation(Target, "ped", "FALL_collapse", 4.0, 1, 0, 0, 0, 0);
                SetPlayerHealth(Target, 50);
                TazerCharged[Shooter] = 1;
                SetTimerEx("TazerCharge", 10000, 0, "i", Shooter);
                SendClientMessage(Shooter, COLOR_GREEN, "You shoot the criminal with your tazer and it begins to recharge!");
            }
        }
    }
    return 1;
}

public TazerCharge(Shooter)
{
    TazerCharged[Shooter] = 0;
    SendClientMessage(Shooter, COLOR_GREEN, "You tazer has fully recharged!");
    return 1;
}
   
public DeagleShot(Shooter, Target)
{
    ApplyAnimation(Target, "ped", "FALL_collapse", 4.0, 1, 0, 0, 0, 0);
    SendClientMessage(Target, COLOR_RED, "You fall unconsious because of blood lose");
    SendClientMessage(Shooter, COLOR_RED, "You notice the target fell unconsious because of blood lose");
    return 1;
}
I get 0 errors... But in game when a player shoots another player with a deagle, nothing happens...Why is that?
Reply
#2

OnPlayerShootPlayer is not a callback, if you did make it i would like to know how
Reply
#3

Quote:
Originally Posted by dowster
Посмотреть сообщение
OnPlayerShootPlayer is not a callback, if you did make it i would like to know how
https://sampforum.blast.hk/showthread.php?tid=195439
Reply
#4

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
My apologies, i hadn't seen that thread
Reply
#5

Anyone know what the problem is?
Reply
#6

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    print("1");
    if(GetPlayerWeapon(Shooter) == 24 && PlayerInfo[Shooter][pGun02] == 24)
    {
        print("2");
        SetTimerEx("DeagleShot", 5000, 0, "ii", Shooter, Target);
        ApplyAnimation(Target, "ped", "WALK_fatold", 4.0, 1, 0, 0, 0, 0);
    }
    else if(PlayerInfo[Shooter][pFaction] == 1 && CopDuty[Shooter] == 1 && TazerCharged[Shooter] == 0)
    {
        print("3");
        if(GetPlayerWeapon(Shooter) == 23 && PlayerInfo[Shooter][pGun02] == 23 && Tazer[Shooter] == 1)
        {
            print("4"); // etc.
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(Target, X,Y,Z);
            if(IsPlayerInRangeOfPoint(Shooter, 15.0, X,Y,Z))
            {
                ApplyAnimation(Target, "ped", "FALL_collapse", 4.0, 1, 0, 0, 0, 0);
                SetPlayerHealth(Target, 50);
                TazerCharged[Shooter] = 1;
                SetTimerEx("TazerCharge", 10000, 0, "i", Shooter);
                SendClientMessage(Shooter, COLOR_GREEN, "You shoot the criminal with your tazer and it begins to recharge!");
            }
        }
    }
    return 1;
}
Check the console log, and you can find where is your problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)