SA-MP Forums Archive
Tazer with a gun - 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: Tazer with a gun (/showthread.php?tid=170623)



Tazer with a gun - vection - 23.08.2010

code didnt work for me..
pawn Код:
stock tazer(playerid, targetid)
{
 new giveplayer[MAX_PLAYER_NAME];
 new sendername[MAX_PLAYER_NAME];
 new string[256];
 GetPlayerName(targetid, giveplayer, sizeof(giveplayer));
 GetPlayerName(playerid, sendername, sizeof(sendername));
 new Float:health;
 GetPlayerHealth(targetid,health);
 if(PlayerInfo[targetid][pCar] >= health+14)
 {
            format(string, sizeof(string), "* You were Tazed by %s", sendername);
            SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* You Tazed %s for 20 seconds.", giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", sendername ,giveplayer);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GameTextForPlayer(targetid, "~r~Tazed", 2500, 3);
            TogglePlayerControllable(targetid, 0);
            PlayerCuffed[targetid] = 1;
            PlayerCuffedTime[targetid] = 20;
            Tazer[playerid] = 0;
 }
 else { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You missed the target!"); }
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
  {
   if(GetPlayerWeapon(playerid) == 23)
      {
       if(IsACop(playerid))
       {
          if(Tazer[playerid] == 1)
          {
                new i = GetClosestPlayer(playerid);
                if(IsPlayerConnected(i))
                {
                    if(PlayerCuffed[i] > 0)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   Player already Cuffed !");
                        return 1;
                    }
                    if(GetDistanceBetweenPlayers(playerid,i) < 30)
                    {
                        if(IsACop(i))
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   Cannot Tazer Cops / FBI / National Guard !");
                            return 1;
                        }
                        if(IsPlayerInAnyVehicle(i))
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   Suspect is in a Car, get him out first !");
                            return 1;
                        }
                        new Float:health;
                        GetPlayerHealth(i,health);
                        PlayerInfo[i][pCar] = health;
                        tazer(playerid, i);
                    }
                    else { SendClientMessage(i, COLOR_LIGHTBLUE, "Target too far from you!"); }
                }
               }
        }
     }
If i just shoot to air and dont damage its tazed him.
how to fix it please...


Re: Tazer with a gun - wups - 23.08.2010

Very bad script.
Use this:
http://forum.sa-mp.com/showthread.ph...PlayerAimingAt


Re: Tazer with a gun - Claude - 23.08.2010

Switch these 2 parts

Part I
pawn Код:
if(PlayerInfo[targetid][pCar] >= health+14) {
Part II
pawn Код:
} else { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You missed the target!"); }
To

pawn Код:
switch(random(3))
{
    case 1:
    {
        // you were tazed blabla shit
    }
   
    case 2:
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE,"You missed the target!");
        return 1;
    }
}



Re: Tazer with a gun - vection - 23.08.2010

IsPlayerAimingAtPlayer
i dont think its really help because its Aim i need shoot.
Claude, what you gave me its random tazer..
i need to get his health befor shot and after shot, if health change - taze.


Re: Tazer with a gun - Scenario - 23.08.2010

I couldn't find a script with a working SDTazer Pistol. I think someone should create a tutorial on this subject.


Re: Tazer with a gun - Steven82 - 23.08.2010

Yes i mean you can get it out of Godfather or PenLs or a script that uses the SD pistal as long as you credit the scripters.


Re: Tazer with a gun - Scenario - 23.08.2010

Quote:
Originally Posted by Steven82
Посмотреть сообщение
Yes i mean you can get it out of Godfather or PenLs or a script that uses the SD pistal as long as you credit the scripters.
Correct, but it doesn't seem like any of them actually work. At least none I've come across.