Modify it to your needs, its almost a straight copy from my script but it should give you a good start to work on
pawn Код:
CMD:tazer(playerid, params[])
{
if(GetPlayerVehicleID(playerid) != 0) return SCM(playerid, COLOR_GREY, "ERROR: you can't do this in a vehicle.");
if(PlayerInfo[playerid][Fmember] == 1 || PlayerInfo[playerid][Fmember] == 2 || PlayerInfo[playerid][Fmember] == 4)
{
new wep2[MAX_PLAYERS];
new wep22[MAX_PLAYERS];
if(tazer[playerid] == 0)
{
new name[24], string[128];
GetPlayerWeaponData(playerid, 2, wep2[playerid], wep22[playerid]);
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "%s Un-hostlers his/her tazer.", name);
LocalChat(25.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
GivePlayerWeapon(playerid, 23, 24);
tazer[playerid] = 1;
}
else if(tazer[playerid] == 1)
{
tazer[playerid] = 0;
}
return 1;
}
else return nal(playerid);
}
forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
PlayerPlaySound(issuerid, 1137, 0,0,0);
if(issuerid != INVALID_PLAYER_ID)
{
if(weaponid == 23)
{
if(tazer[issuerid] == 1)
{
new Float:ps, Float:ps2, Float:ps3;
GetPlayerPos(playerid, ps, ps2, ps3);
if(!IsPlayerInRangeOfPoint(issuerid, 10.0, ps, ps2, ps3))
{
SCM(issuerid, COLOR_GREY, "You are too far away to use your tazer!");
GivePlayerHealth(playerid, amount);
}
else
{
GivePlayerHealth(playerid, amount);
TogglePlayerControllable(playerid, 0);
SetTimerEx("Tazed", 20000, false, "i", playerid);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0, 1);
}
}
}
}
return 1;
}