PDA

View Full Version : Help on lspd system!


JasonTurkey
22/10/2013, 04:36 AM
Hi guys!

I need help on taser system mainly

I am creating a taser system, got me really confusing

So can someone give me an example of a decent taser system
I would really be happy and appriciate if you could do the following things for me!

I have defined my cop like this
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] >= 8)
{

pMember == 1 is my cop.

So I want taser system to be like this

I want it work for sd pistol gun id 24 I think
So when cop does /taser it gives them sd postol
and when they shoot it make the player who was shot frozen for 10 seconds and with the animation crack.

I would appriciate if someone helps me on this

JasonTurkey
22/10/2013, 03:14 PM
need help still@

MaxTheMapper
22/10/2013, 05:54 PM
This Can Help You (In My Opinion :) )


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

Hope I Helped u!