14.01.2011, 02:10
Dear users,
I'm trying to make a taser cmd for my server. And it complies fine but I've got a problem. When I pull the trigger of the SD Pistol and I ain't aiming properly on a person it tazes myself.
This is under KeyStateChange
And this is the cmd taking it out.
Does anyone knows how to stop tazing yourself?
I'm trying to make a taser cmd for my server. And it complies fine but I've got a problem. When I pull the trigger of the SD Pistol and I ain't aiming properly on a person it tazes myself.
This is under KeyStateChange
Код:
if(((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) || ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) || (newkeys & KEY_FIRE))
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerAiming(playerid, i))
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1)
{
if(GetPlayerWeapon(playerid) == 23)
{
//SetPlayerHealth(i, 0);
TogglePlayerControllable(i, 0);
ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
GameTextForPlayer(i, "You got Tazed", 3000, 3);
GameTextForPlayer(playerid, "Inmate got tazed", 3000, 3);
SetTimerEx("UntazePlayer", 12000, false, "d", i);
return 1;
}
}
}
}
}
Код:
command(taser, playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1)
{
GivePlayerWeaponEx(playerid, 23);
new string[128];
format(string, sizeof(string), "* %s unholsters his tazer.", UnderscoreToSpaceName( playerid ));
NearByMessage(playerid, PURPLE, string);
return 1;
}
}
return 0;
}

