SA-MP Forums Archive
[HELP] Tazer - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Tazer (/showthread.php?tid=210847)



[HELP] Tazer - joeri55 - 14.01.2011

Dear users,

I'm trying to make a taser cmd for my server. And it complies fine but I've got a problem. When I pull the trigger of the SD Pistol and I ain't aiming properly on a person it tazes myself.

This is under KeyStateChange
Код:
    if(((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) || ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) ||  (newkeys & KEY_FIRE))
    {
         for(new i = 0; i < GetMaxPlayers(); i++)
        {
            if(IsPlayerAiming(playerid, i))
            {
                if(Groups[Player[playerid][Group]][CommandTypes] == 1)
                {
                    if(GetPlayerWeapon(playerid) == 23)
                    {
                        //SetPlayerHealth(i, 0);
                        TogglePlayerControllable(i, 0);
                         ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
                        GameTextForPlayer(i, "You got Tazed", 3000, 3);
                        GameTextForPlayer(playerid, "Inmate got tazed", 3000, 3);
                        SetTimerEx("UntazePlayer", 12000, false, "d", i);
                        return 1;
                    }
                }
            }
        }
    }
And this is the cmd taking it out.

Код:
command(taser, playerid, params[])
{
    if(IsPlayerConnected(playerid))
     {
        if(Groups[Player[playerid][Group]][CommandTypes] == 1)
        {
            GivePlayerWeaponEx(playerid, 23);
             new string[128];
             format(string, sizeof(string), "* %s unholsters his tazer.", UnderscoreToSpaceName( playerid ));
            NearByMessage(playerid, PURPLE, string);
            return 1;
        }
    }
    return 0;
}
Does anyone knows how to stop tazing yourself?


Re: [HELP] Tazer - Kapil - 14.01.2011

try adding a if statement to makesure playerid != i
like
http://notesbin.com/1137955257


Re: [HELP] Tazer - joeri55 - 16.01.2011

That file ain't working.


Re: [HELP] Tazer - joeri55 - 17.01.2011

Anyone knows a solution for this?