PDA

View Full Version : Tazer script help


Michael_Cruise
20/06/2012, 12:32 PM
/*
+------------------------------------------------+


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)+floatpow er(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

HuSs3n
20/06/2012, 12:49 PM
#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)+floatpow er(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;
}