SA-MP Forums Archive
Tazer = SD Pistol Problem - 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: Tazer = SD Pistol Problem (/showthread.php?tid=397225)



Tazer = SD Pistol Problem - Patrick - 03.12.2012

hi guyz i made a command sd pistol as a tazer but my problem is everybody can use it if they have SD Pistol - ID 23
the tazer works even they are civillian

can anyone help me that it will only work for this teams
pawn Код:
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA)
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)

{

                        if(GetPlayerWeapon(Shooter) == 23)

                        {

                new string[17+48], playerid;

                TogglePlayerControllable(Target, true);

                ApplyAnimation(Target,"CRACK","crckdeth2",4.1,1,1,1,1,1);

                pTazed[Target] = 1;

                tazetimer[Target] = SetTimerEx("Tazed", 10000, 0, "d", Target);

                format(string, sizeof(string), "%s has been tazed by %s.", RemoveUnderScore(Target), RemoveUnderScore(Shooter));

                ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);

                                return 1;

                                }

                return 1;

                }
thanks to those who tried to help me + rep


Re: Tazer = SD Pistol Problem - LarzI - 03.12.2012

Try this:

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    if(GetPlayerWeapon(Shooter) == 23 && (gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA))
    {
        new string[17+48], playerid;
        TogglePlayerControllable(Target, true);
        ApplyAnimation(Target,"CRACK","crckdeth2",4.1,1,1,1,1,1);
        pTazed[Target] = 1;
        tazetimer[Target] = SetTimerEx("Tazed", 10000, 0, "d", Target);
        format(string, sizeof(string), "%s has been tazed by %s.", RemoveUnderScore(Target), RemoveUnderScore(Shooter));
        ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
        return 1;
    }
    return 1;
}



Re: Tazer = SD Pistol Problem - Patrick - 03.12.2012

nope not working.

still civilian can use it if they have silenced 9mm pistol

-sleeping ill try to contact with you tommorow with my problem


Re: Tazer = SD Pistol Problem - LarzI - 03.12.2012

Quote:
Originally Posted by pds2012
Посмотреть сообщение
nope not working.

still civilian can use it if they have silenced 9mm pistol

-sleeping ill try to contact with you tommorow with my problem
Oops I screwed up. == not != in the if statement when checking job


Like this

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    if(GetPlayerWeapon(Shooter) == 23 && (gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA))
    {
        new string[17+48], playerid;
        TogglePlayerControllable(Target, true);
        ApplyAnimation(Target,"CRACK","crckdeth2",4.1,1,1,1,1,1);
        pTazed[Target] = 1;
        tazetimer[Target] = SetTimerEx("Tazed", 10000, 0, "d", Target);
        format(string, sizeof(string), "%s has been tazed by %s.", RemoveUnderScore(Target), RemoveUnderScore(Shooter));
        ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
        return 1;
    }
    return 1;
}
Like this