SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/06/2012, 12:32 PM   #1
Michael_Cruise
Little Clucker
 
Join Date: Jun 2012
Location: India
Posts: 47
Reputation: 8
Default Tazer script help

Code:
/*
+------------------------------------------------+
                                                
                                                
				RP Taser System                  
                                                
                                                
        by Luksa[www.Balkan-SAMP.com]           
                                                
                                                
     Do not remove those credits, thanks! :)    
                                                
+------------------------------------------------+
*/

#include <a_samp>

#define USE_SKIN 0 // 0 = skins won't be used | 1 = skins will be used
#define SKIN_ID 1 // ID of skin, it won't works if USE_SKIN is 0
#define WEAPONID 23 // ID of weapon for shooting on player
#define TAZED_SECONDS 23 // On how many seconds is player tazed
#define TEXT_COLOR 0xFFFFFFAA // Color of the TEXT (SendClientMessage) - Currently white
#define GAMETEXT "Tazed!" // Text of GameTextShowForPlayer

#define SCM SendClientMessage

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" RP Taser System by Luksa loaded!");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
    print("\n--------------------------------------");
	print(" RP Taser System by Luksa unloaded!");
	print("--------------------------------------\n");
	return 1;
}

forward Float:GetDistanceBetweenPlayers(p1,p2);
public Float:GetDistanceBetweenPlayers(p1,p2)
{
	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
	if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
	{
		return -1.00;
	}
	GetPlayerPos(p1,x1,y1,z1);
	GetPlayerPos(p2,x2,y2,z2);
	return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
stock GetName(playerid)
{
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, sizeof(pName));
	return pName;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:armour, Float:health; GetPlayerArmour(playerid, armour); GetPlayerHealth(playerid, health);
        if(weaponid == WEAPONID)
        {
            if(IsPlayerInAnyVehicle(playerid))
			{
				return 1;
			}
            if(USE_SKIN != 0 && SKIN_ID == GetPlayerSkin(issuerid))
            {
	            new string[66];
				format(string, sizeof(string), "* You are tazed by %s for %d seconds.", GetName(issuerid),TAZED_SECONDS); SCM(playerid, TEXT_COLOR, string);
				format(string, sizeof(string), "* You tazed %s for %d seconds.", GetName(playerid),TAZED_SECONDS); SCM(issuerid, TEXT_COLOR, string);
				format(string, sizeof(string), "~r~%s", GAMETEXT); GameTextForPlayer(playerid, string, 2500, 3); TogglePlayerControllable(playerid, 0);
				ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); SetTimerEx("uf",TAZED_SECONDS*1000, false, "i", playerid);
	            return 1;
			}
			else
			{
				new string[66];
				format(string, sizeof(string), "* You are tazed by %s for %d seconds.", GetName(issuerid),TAZED_SECONDS); SCM(playerid, TEXT_COLOR, string);
				format(string, sizeof(string), "* You tazed %s for %d seconds.", GetName(playerid),TAZED_SECONDS); SCM(issuerid, TEXT_COLOR, string);
    			format(string, sizeof(string), "~r~%s", GAMETEXT); GameTextForPlayer(playerid, string, 2500, 3); TogglePlayerControllable(playerid, 0);
				ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); SetTimerEx("uf",TAZED_SECONDS*1000, false, "i", playerid);
	            return 1;
			}
        }
    }
    return 1;
}

forward uf(playerid);
public uf(playerid)
{
	TogglePlayerControllable(playerid, true); ClearAnimations(playerid);
}
Hi , This is downloaded script.I want player using cop skin can only taze others.If else shoots with SC pistol weapon.Then the other player own't get tazed . Please hELP
Michael_Cruise is offline   Reply With Quote
Old 20/06/2012, 12:49 PM   #2
HuSs3n
Guest
 
Posts: n/a
Default Re: Tazer script help

pawn Code:
#include <a_samp>

#define USE_SKIN 1 // 0 = skins won't be used | 1 = skins will be used
#define WEAPONID 23 // ID of weapon for shooting on player
#define TAZED_SECONDS 23 // On how many seconds is player tazed
#define TEXT_COLOR 0xFFFFFFAA // Color of the TEXT (SendClientMessage) - Currently white
#define GAMETEXT "Tazed!" // Text of GameTextShowForPlayer

#define SCM SendClientMessage

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" RP Taser System by Luksa loaded!");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n--------------------------------------");
    print(" RP Taser System by Luksa unloaded!");
    print("--------------------------------------\n");
    return 1;
}

forward Float:GetDistanceBetweenPlayers(p1,p2);
public Float:GetDistanceBetweenPlayers(p1,p2)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
    {
        return -1.00;
    }
    GetPlayerPos(p1,x1,y1,z1);
    GetPlayerPos(p2,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
stock GetName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:armour, Float:health; GetPlayerArmour(playerid, armour); GetPlayerHealth(playerid, health);
        if(weaponid == WEAPONID)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                return 1;
            }
            if(USE_SKIN != 0 && IsCopSkin(issuerid))
            {
                new string[66];
                format(string, sizeof(string), "* You are tazed by %s for %d seconds.", GetName(issuerid),TAZED_SECONDS); SCM(playerid, TEXT_COLOR, string);
                format(string, sizeof(string), "* You tazed %s for %d seconds.", GetName(playerid),TAZED_SECONDS); SCM(issuerid, TEXT_COLOR, string);
                format(string, sizeof(string), "~r~%s", GAMETEXT); GameTextForPlayer(playerid, string, 2500, 3); TogglePlayerControllable(playerid, 0);
                ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); SetTimerEx("uf",TAZED_SECONDS*1000, false, "i", playerid);
                return 1;
            }
            else
            {
                new string[66];
                format(string, sizeof(string), "* You are tazed by %s for %d seconds.", GetName(issuerid),TAZED_SECONDS); SCM(playerid, TEXT_COLOR, string);
                format(string, sizeof(string), "* You tazed %s for %d seconds.", GetName(playerid),TAZED_SECONDS); SCM(issuerid, TEXT_COLOR, string);
                format(string, sizeof(string), "~r~%s", GAMETEXT); GameTextForPlayer(playerid, string, 2500, 3); TogglePlayerControllable(playerid, 0);
                ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); SetTimerEx("uf",TAZED_SECONDS*1000, false, "i", playerid);
                return 1;
            }
        }
    }
    return 1;
}

forward uf(playerid);
public uf(playerid)
{
    TogglePlayerControllable(playerid, true); ClearAnimations(playerid);
}

stock IsCopSkin(playerid)
{
   new s=GetPlayerSkin(playerid);
   switch(s)
   {
       case 280..288: return 1;
       case 165,166: return 1;
   }
   return 0;
}
  Reply With Quote
Reply

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
Opinions needed for a tazer (etc.) script. Coffeemonster Scripting Help 3 23/02/2012 12:31 AM
Tazer Script bug Gooday Scripting Help 2 06/01/2012 01:31 PM
Tazer with a gun vection Help Archive 6 23/08/2010 11:45 PM
tazer TouR Help Archive 3 24/06/2010 07:21 PM


All times are GMT. The time now is 04:46 PM.


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