public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(Holding(KEY_FIRE) || newkeys == KEY_FIRE)
if(Tazer[playerid] = 1;
if(!IsPlayerTazed(Target) && !IsPlayerCuffed(Target) && !IsPlayerTied(Target))
{
ApplyAnimation(playerid,"KNIFE","knife_3",4.1,0,1,1,0,0,1);
new Float:HP, Float:Armor;
GetPlayerHealth(Target, HP);
GetPlayerArmour(Target, Armor);
SetPlayerHealth(Target, HealthLost+HP);
SetPlayerArmour(Target, ArmourLost+Armor);
if(!IsPlayerNearPlayer(Shooter, Target, 8.3)) return SendClientMessage(Shooter, COLOR_GREY, "You are too far away from that player.");
//if(IsHoldingFirearm(Target)) return SendClientMessage(Shooter, COLOR_GREY, "You can't taze someone with a gun in hand.");
// Got Tazed
format(string, sizeof(string), "* %s aims their tazer on %s and tazes them.", RPN(Shooter), RPN(Target));
SendNearbyMessage(Shooter, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(Target, "~r~Tazed", 3500, 3);
// Custom Freeze
ApplyAnimation(Target,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
TogglePlayerControllable(Target, 0);
// Tazed Detecting
TogglePlayerTazed(Target, 1);
// Tazer Timeout
TazeTimeout[Target] = 11;
TazeCountDown[Target] = SetTimerEx("TazeTimer", 1000, true, "d", Target);
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(Holding(KEY_FIRE) || newkeys == KEY_FIRE)
{
if(Tazer[playerid] == 1)
{
if(!IsPlayerTazed(Target) && !IsPlayerCuffed(Target) && !IsPlayerTied(Target))
{
ApplyAnimation(playerid,"KNIFE","knife_3",4.1,0,1,1,0,0,1);
new Float:HP, Float:Armor;
GetPlayerHealth(Target, HP);
GetPlayerArmour(Target, Armor);
SetPlayerHealth(Target, HealthLost+HP);
SetPlayerArmour(Target, ArmourLost+Armor);
if(!IsPlayerNearPlayer(Shooter, Target, 8.3)) return SendClientMessage(Shooter, COLOR_GREY, "You are too far away from that player.");
//if(IsHoldingFirearm(Target)) return SendClientMessage(Shooter, COLOR_GREY, "You can't taze someone with a gun in hand.");
// Got Tazed
format(string, sizeof(string), "* %s aims their tazer on %s and tazes them.", RPN(Shooter), RPN(Target));
SendNearbyMessage(Shooter, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(Target, "~r~Tazed", 3500, 3);
// Custom Freeze
ApplyAnimation(Target,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
TogglePlayerControllable(Target, 0);
// Tazed Detecting
TogglePlayerTazed(Target, 1);
// Tazer Timeout
TazeTimeout[Target] = 11;
TazeCountDown[Target] = SetTimerEx("TazeTimer", 1000, true, "d", Target);
}
}
}
return 1;
}
Count the number of '{'. Then count the number of '}'.
http://www.damnlol.com/pics/31/ec1a4...9f3040f087.jpg |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Target;
if(Holding(KEY_FIRE) || newkeys == KEY_FIRE)
{
if(Tazer[playerid] == 1)
{
if(!IsPlayerTazed(Target) && !IsPlayerCuffed(Target) && !IsPlayerTied(Target))
{
ApplyAnimation(playerid,"KNIFE","knife_3",4.1,0,1,1,0,0,1);
if(!IsPlayerNearPlayer(playerid, Target, 5)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
//if(IsHoldingFirearm(Target)) return SendClientMessage(Shooter, COLOR_GREY, "You can't taze someone with a gun in hand.");
// Got Tazed
/*format(string, sizeof(string), "* %s aims their tazer on %s and tazes them.", RPN(Shooter), RPN(Target));
SendNearbyMessage(Shooter, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);*/
GameTextForPlayer(Target, "~r~Tazed", 3500, 3);
// Custom Freeze
ApplyAnimation(Target,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
TogglePlayerControllable(Target, 0);
// Tazed Detecting
TogglePlayerTazed(Target, 1);
// Tazer Timeout
TazeTimeout[Target] = 11;
TazeCountDown[Target] = SetTimerEx("TazeTimer", 1000, true, "d", Target);
}
}
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)+floatpower(floatabs(floatsub(z2,z1)),2));
}
stock GetClosestPlayer(p1)
{
new x,Float:dis,Float:dis2,player;
player = -1;
dis = 99999.99;
for (x=0;x<MAX_PLAYERS;x++)
{
if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_SPECTATING)
{
if(x != p1)
{
dis2 = GetDistanceBetweenPlayers(x,p1);
if(dis2 < dis && dis2 != -1.00)
{
dis = dis2;
player = x;
}
}
}
}
return player;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Target = GetClosestPlayer(playerid);
if(Holding(KEY_FIRE) || newkeys == KEY_FIRE)
{
if(Tazer[playerid] == 1)
{
if(!IsPlayerTazed(Target) && !IsPlayerCuffed(Target) && !IsPlayerTied(Target))
{
ApplyAnimation(playerid,"KNIFE","knife_3",4.1,0,1,1,0,0,1);
if(!IsPlayerNearPlayer(playerid, Target, 5)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
//if(IsHoldingFirearm(Target)) return SendClientMessage(Shooter, COLOR_GREY, "You can't taze someone with a gun in hand.");
// Got Tazed
/*format(string, sizeof(string), "* %s aims their tazer on %s and tazes them.", RPN(Shooter), RPN(Target));
SendNearbyMessage(Shooter, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);*/
GameTextForPlayer(Target, "~r~Tazed", 3500, 3);
// Custom Freeze
ApplyAnimation(Target,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
TogglePlayerControllable(Target, 0);
// Tazed Detecting
TogglePlayerTazed(Target, 1);
// Tazer Timeout
TazeTimeout[Target] = 11;
TazeCountDown[Target] = SetTimerEx("TazeTimer", 1000, true, "d", Target);
}
}
return 1;
}