/Tazer help. -
HarryPotter - 03.11.2012
Hello, I got a tazer system and its bugged... When I /tazer it says unholsters your tazer, but when I do it again, it just says the same thing again, not removing the object or holsters the tazer. And it doesn't apply the animation as-well.
The command:
Код:
CMD:tazer(playerid, params[])
{
if(IsACop(playerid) || (PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5) || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pDivision] == 1))
{
new string[128];
if(PlayerInfo[playerid][pConnectHours] < 0 || PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are currently restricted from possessing weapons!");
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
return 1;
}
if(GetPVarInt(playerid, "IsInArena") >= 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!");
return 1;
}
if(GetPVarInt( playerid, "EventToken") != 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't use the tazer while you're in an event.");
return 1;
}
if(PlayerCuffedTime[playerid] > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
return 1;
}
if(GetPVarInt(playerid, "Injured") == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
return 1;
}
if(PlayerInfo[playerid][pJailTime] > 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
return 1;
}
if(PlayerCuffed[playerid] >= 1) {
SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this while tazed/cuffed.");
return 1;
}
if(TazerAcceso{playerid} == 0)
{
SetPlayerAttachedObject(playerid, 50000, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0);
format(string, sizeof(string), "* %s unholsters their tazer.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
pTazer{playerid} = 1;
TazerAcceso[playerid] = 1;
}
else
{
RemovePlayerAttachedObject(playerid, 50000);
format(string, sizeof(string), "* %s holsters their tazer.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
pTazer{playerid} = 0;
TazerAcceso[playerid] = 0;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You are not a Cop / FBI / Coastguard!");
return 1;
}
return 1;
}
The newkeys:
Код:
if((newkeys & KEY_AIM) && TazerAcceso[playerid] == 1 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(TazerTimeout[playerid] > 0)
{
return 1;
}
new Float:X, Float:Y, Float:Z;
foreach(Player, i)
{
if(IsPlayerStreamedIn(i, playerid))
{
GetPlayerPos(i, X, Y, Z);
if(IsPlayerAimingAt(playerid,X,Y,Z,1) && PlayerCuffed[i] == 0 && GetPlayerState(i) == PLAYER_STATE_ONFOOT && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
if(PlayerInfo[i][pAdminDuty] >= 2 && PlayerInfo[i][pTogReports] != 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Admins can not be tazed!");
return 1;
}
new string[44 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s fires their tazer at %s, stunning them.", GetPlayerNameEx(playerid), GetPlayerNameEx(i));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(i, "~r~Tazed", 3500, 3);
SendAudioToRange(10300, 100, 0, X, Y, Z, 20.0);
TogglePlayerControllable(i, 0);
ApplyAnimation(i,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
PlayerPlaySound(i, 1085, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
PlayerCuffed[i] = 1;
SetPVarInt(i, "PlayerCuffed", 1);
PlayerCuffedTime[i] = 16;
SetPVarInt(i, "IsFrozen", 1);
//Frozen[i] = 1;
ApplyAnimation(playerid,"KNIFE", "knife_3", 4.0, 0, 1, 1, 1, 1000);
TazerTimeout[playerid] = 8;
SetTimerEx("TazerTimer",1000,false,"d",playerid);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~r~Tazer reloading... ~w~8", 1500,3);
return 1;
}
}
}
}
No errors/warnings are there. +++Rep for helping
Re: /Tazer help. -
HarryPotter - 03.11.2012
l found the problem of why it didn't changed to "holsters the tazer". But now I got a new problem. When I use /tazer, it doesn't show the tazer at all. Here's the new script:
Код:
CMD:tazer(playerid, params[])
{
if(IsACop(playerid) || (PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5) || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pDivision] == 1))
{
new string[128];
if(PlayerInfo[playerid][pConnectHours] < 0 || PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are currently restricted from possessing weapons!");
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
return 1;
}
if(GetPVarInt(playerid, "IsInArena") >= 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!");
return 1;
}
if(GetPVarInt( playerid, "EventToken") != 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't use the tazer while you're in an event.");
return 1;
}
if(PlayerCuffedTime[playerid] > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
return 1;
}
if(GetPVarInt(playerid, "Injured") == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
return 1;
}
if(PlayerInfo[playerid][pJailTime] > 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
return 1;
}
if(PlayerCuffed[playerid] >= 1) {
SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this while tazed/cuffed.");
return 1;
}
if(pTazer{playerid} == 0)
{
SetPlayerAttachedObject(playerid, 40, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0);
format(string, sizeof(string), "* %s unholsters their tazer.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
pTazer{playerid} = 1;
}
else
{
RemovePlayerAttachedObject(playerid, 40);
format(string, sizeof(string), "* %s holsters their tazer.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
pTazer{playerid} = 0;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You are not a Cop / FBI / Coastguard!");
return 1;
}
return 1;
}
Код:
if((newkeys & KEY_AIM) && pTazer[playerid] == 1 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(TazerTimeout[playerid] > 0)
{
return 1;
}
if(GetPlayerWeapon(playerid) != 0)
{
return 1;
}
new Float:X, Float:Y, Float:Z;
foreach(Player, i)
{
if(IsPlayerStreamedIn(i, playerid))
{
GetPlayerPos(i, X, Y, Z);
if(IsPlayerAimingAt(playerid,X,Y,Z,1) && PlayerCuffed[i] == 0 && GetPlayerState(i) == PLAYER_STATE_ONFOOT && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
if(PlayerInfo[i][pAdminDuty] == 1 && PlayerInfo[i][pTogReports] != 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Admins can not be tazed!");
return 1;
}
new string[44 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s fires their tazer at %s, stunning them.", GetPlayerNameEx(playerid), GetPlayerNameEx(i));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(i, "~r~Tazed", 3500, 3);
SendAudioToRange(10300, 100, 0, X, Y, Z, 20.0);
TogglePlayerControllable(i, 0);
ApplyAnimation(i,"CRACK","crckdeth2",4.1,0,1,1,0,1,1);
PlayerPlaySound(i, 1085, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
PlayerCuffed[i] = 1;
SetPVarInt(i, "PlayerCuffed", 1);
PlayerCuffedTime[i] = 16;
SetPVarInt(i, "IsFrozen", 1);
//Frozen[i] = 1
ApplyAnimation(playerid, "KNIFE", "knife_3", 4.0, 0, 1, 1, 1, 1000);
TazerTimeout[playerid] = 8;
SetTimerEx("TazerTimer",1000,false,"d",playerid);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~r~Tazer reloading... ~w~8", 1500,3);
return 1;
}
}
}
}
Re: /Tazer help. -
Anthony © - 03.11.2012
pTazer{playerid} = 1; to pTazer[playerid] = 1; ?
Re: /Tazer help. -
Glad2BeHere - 03.11.2012
is onplayershootplayer