Tazer with a gun
#1

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...
Reply
#2

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

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;
    }
}
Reply
#4

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.
Reply
#5

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

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.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: