SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 23/08/2010, 05:24 PM   #1
vection
Huge Clucker
 
Join Date: Oct 2007
Posts: 222
Reputation: 0
Default Tazer with a gun

code didnt work for me..
pawn Code:
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...
vection is offline  
Old 23/08/2010, 05:31 PM   #2
wups
High-roller
 
wups's Avatar
 
Join Date: Apr 2010
Location: Lithuania
Posts: 1,368
Reputation: 133
Default Re: Tazer with a gun

Very bad script.
Use this:
http://forum.sa-mp.com/showthread.ph...PlayerAimingAt
wups is offline  
Old 23/08/2010, 05:47 PM   #3
Claude
Huge Clucker
 
Claude's Avatar
 
Join Date: Aug 2010
Posts: 261
Reputation: 5
Default Re: Tazer with a gun

Switch these 2 parts

Part I
pawn Code:
if(PlayerInfo[targetid][pCar] >= health+14) {

Part II
pawn Code:
} else { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You missed the target!"); }

To

pawn Code:
switch(random(3))
{
    case 1:
    {
        // you were tazed blabla shit
    }
   
    case 2:
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE,"You missed the target!");
        return 1;
    }
}
Claude is offline  
Old 23/08/2010, 07:11 PM   #4
vection
Huge Clucker
 
Join Date: Oct 2007
Posts: 222
Reputation: 0
Default Re: Tazer with a gun

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.
vection is offline  
Old 23/08/2010, 09:05 PM   #5
RealCop228
Godfather
 
Join Date: Feb 2010
Location: Springboro, OH
Posts: 8,265
Reputation: 670
Default Re: Tazer with a gun

I couldn't find a script with a working SDTazer Pistol. I think someone should create a tutorial on this subject.
__________________
Putting [URGENT] in the thread title stops me from opening the thread. Nobody else's problem on this forum is more important that another person's. Try not to be self-centered!
RealCop228 is offline  
Old 23/08/2010, 11:32 PM   #6
Steven82
High-roller
 
Join Date: Nov 2009
Posts: 2,626
Reputation: 169
Default Re: Tazer with a gun

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.
Steven82 is offline  
Old 23/08/2010, 11:45 PM   #7
RealCop228
Godfather
 
Join Date: Feb 2010
Location: Springboro, OH
Posts: 8,265
Reputation: 670
Default Re: Tazer with a gun

Quote:
Originally Posted by Steven82 View Post
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.
__________________
Putting [URGENT] in the thread title stops me from opening the thread. Nobody else's problem on this forum is more important that another person's. Try not to be self-centered!
RealCop228 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SDPistol Tazer MasterÖ Help Archive 11 18/07/2010 01:52 AM
tazer TouR Help Archive 3 24/06/2010 07:21 PM
[HELP] Tazer Gun Karl115 Help Archive 21 20/06/2010 06:21 PM
Tazer command! Antonio [G-RP] Help Archive 2 23/05/2010 03:06 AM
Tazer by a weapon? acade Help Archive 13 04/03/2010 09:44 PM


All times are GMT. The time now is 09:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.