Код:
#include <a_samp>
// Filterscript Settings
#define TAZE_WEAPON 23 // The weapon the tazer needs to be attached to.
#define TAZE_TIMER 5000 // The time needed to be spent until the criminal automatically gets up.
#define TAZE_SPARK 18717 // The objectid of the spark (It's recommended you don't change this...)
#define TAZE_DESTROY 1250 // The time needed to be spent until the spark dissappears.
#define TAZE_LOSEHP 1 // Set to 1 if you want the victim to lose health when shot. Set 0 or any
// other value if you want the victim not to lose health.
//
new Tazer[MAX_PLAYERS];
new Spark[MAX_PLAYERS];
new Tazed[MAX_PLAYERS];
forward DestroySpark(playerid);
forward TazedRemove(playerid);
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Reachless' Tazer System v0.3");
print("--------------------------------------\n");
return 1;
}
public OnPlayerConnect(playerid)
{
Tazed[playerid] = 0;
Tazer[playerid] = 0;
return 1;
}
public DestroySpark(playerid)
{
DestroyObject(Spark[playerid]);
return 1;
}
public TazedRemove(playerid)
{
TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
Tazed[playerid] = 0;
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
if(Tazer[playerid] == 1 && GetPlayerWeapon(playerid) == TAZE_WEAPON)
{
new Float:health,losehp;
GetPlayerHealth(damagedid,health);
losehp = TAZE_LOSEHP;
if(Tazed[damagedid] == 1) return 1;
new Float:x, Float:y, Float:z;
GetPlayerPos(damagedid, x, y, z);
ClearAnimations(damagedid);
ApplyAnimation(damagedid,"PED","KO_skid_front",4.1,0,1,1,1,0);
Spark[damagedid] = CreateObject(TAZE_SPARK, x, y, z-3, 0, 0, 0);
SetTimerEx("DestroySpark", TAZE_DESTROY, 0, "i", damagedid);
SetTimerEx("TazedRemove", TAZE_TIMER, 0, "i", damagedid);
//TogglePlayerControllable(damagedid, 0);
Tazed[damagedid] = 1;
if(losehp) {} else SetPlayerHealth(damagedid, health+amount);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sdpistol", cmdtext, true, 6) == 0)
{
GivePlayerWeapon(playerid, TAZE_WEAPON, 100);
return 1;
}
if (strcmp("/tazer", cmdtext, true, 6) == 0)
{
//You Cop Variables Here! and add else return 0 at the end of this line!
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
if(Tazer[playerid] == 0)
{
if(GetPlayerWeapon(playerid) == TAZE_WEAPON) {} else return SendClientMessage(playerid, 0xFFFFFFFF, "{DC0C0C}Tazer: {FFFFFF}You need to attach the tazer to a Silenced Pistol.");
Tazer[playerid] = 1;
format(string, sizeof(string), "{DC0C0C}Tazer: {FFFFFF}You attached the tazer to your Silenced Pistol, %s.", sendername);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
else if(Tazer[playerid] == 1)
{
Tazer[playerid] = 0;
format(string, sizeof(string), "{DC0C0C}Tazer: {FFFFFF}You deattached the tazer from your Silenced Pistol, %s.", sendername);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
else Tazer[playerid] = 0;
return 1;
}
return 0;
}