10.10.2013, 06:39
This is my tazer function
and my command now work properly
pawn Код:
if(newkeys & KEY_LOOK_BEHIND && IsPlayerENF(playerid) && !IsPlayerInAnyVehicle(playerid) && PlayerTemp[playerid][isevent] == 0)
{
if(GetPVarInt(playerid, "Tazer") == 1)
{
//GivePlayerWeapon(playerid, 24, GetPVarInt(playerid, "Tazer"));
SetPVarInt(playerid, "Tazer", 0);
RemovePlayerAttachedObject(playerid, 0);
Action(playerid, "puts his taser back into his belt.");
return 1;
}
SetPVarInt(playerid, "Tazer", 1);
//SetPlayerAttachedObject(playerid, 0, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0);
GivePlayerWeapon(playerid, 23, 10);
Action(playerid, "takes his taser out of his belt.");
return 1;
}
pawn Код:
if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE)
{
if(!IsPlayerInAnyVehicle(playerid) && GetPlayerWeapon(playerid) == 41)
{
new Float:fp[4];
PlayerLoop(q)
{
if(q == playerid) continue;
GetPlayerPos(q, fp[0], fp[1], fp[2]);
if(IsPlayerAimingAt(playerid, fp[0], fp[1], fp[2], 0.9) && GetDistanceBetweenPlayers(playerid, q) < 4 && tazed[q] == 0)
{
RedScreen(q, minrand(5,15));
return 1;
}
}
}
pawn Код:
if(!IsPlayerInAnyVehicle(playerid) && GetPVarInt(playerid, "Tazer") == 1 && IsPlayerENF(playerid) && !RecentlyShot[playerid] || !IsPlayerInAnyVehicle(playerid) && GetPlayerWeapon(playerid) == 23 && PlayerInfo[playerid][power] >= 11)
{
RecentlyShot[playerid] = 1;
SetTimerEx("AntiSpam", 1000, false, "d", playerid);
new Float:fp[4];
PlayerLoop(q)
{
if(q == playerid) continue;
GetPlayerPos(q, fp[0], fp[1], fp[2]);
if(IsPlayerAimingAt(playerid, fp[0], fp[1], fp[2], 0.9) && GetDistanceBetweenPlayers(playerid, q) < 5 && tazed[q] == 0 && !IsPlayerInAnyVehicle(q))
{
ApplyAnimation(playerid,"KNIFE","knife_3",4.1,0,1,1,0,0,1);
new tazemsg[ 128 ], wat[MAX_PLAYER_NAME];
if(PlayerTemp[q][hname]==1) myStrcpy(wat,"Stranger"); else myStrcpy(wat,RPName(q));
if(PlayerInfo[playerid][playerteam]==COPS) format(tazemsg,sizeof(tazemsg),"[LSPD] %s has been tazed by %s",wat,RPName(playerid));
else if(PlayerInfo[playerid][playerteam]==SASF) format(tazemsg,sizeof(tazemsg),"[SASF] %s has been tazed by %s",wat,RPName(playerid));
else format(tazemsg,sizeof(tazemsg),"[FBI] %s has been tazed by %s",wat,RPName(playerid));
NearMessage(playerid,tazemsg,COLOR_ME);
tazed[ q ] = 1;
TogglePlayerControllable(q,false);
SetTimerEx("UnTaze",20000,0,"i",q);
SetPlayerDrunkLevel(q, GetPlayerDrunkLevel(playerid)+4300);
ApplyAnimation(q,"CRACK", "crckdeth2", 4.1, 0, 0, 0, 1, 1); // irl crack!
new string[ 128 ];
format(string, sizeof(string), "6{TAZE} %s[%d] has been tazed by %s[%d]",PlayerName(q),q, PlayerName(playerid), playerid);
iEcho(string);
return 1;
}
}
}
return 1;
}
pawn Код:
tazed[playerid] = 0;
pawn Код:
if(IsPlayerConnected(playerid))
{
if(GetPVarInt(playerid, "Tazer") && GetPlayerWeapon(playerid))
{
SendClientInfo(playerid, "You cannot hold a weapon while having the taser in your hand.");
SetPlayerArmedWeapon(playerid, 0);
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
for(new i; i < sizeof(Spikes); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, Spikes[i][sX], Spikes[i][sY], Spikes[i][sZ]) && Spikes[i][sX] != 0)
{
new tires, panels, doors, lights;
GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
tires = encode_tires(1,1,1,1); // damage all tires
UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
}
}
}
}
return 1;
}
pawn Код:
COMMAND:tazer(playerid, params[])
{
if(GetPVarInt(playerid, "Tazer", false))
{
SetPVarInt(playerid, "Tazer", 0);
Action(playerid, "puts his taser back into his belt.");
// return GivePlayerWeapon(playerid, 23, 0);
}
SetPVarInt(playerid, "Tazer", 1);
Action(playerid, "takes his taser out of his belt.");
//return GivePlayerWeapon(playerid, 23, 10);
}