06.08.2016, 10:06
Hi guys. I got some bugs here. I'm not a LSPD member but I can use /tazer, /detain, /cuff and /uncuff. I've tried fixing it but I can't. Need help
Код:
CMD:tazer(playerid, params[]) { if(gTeam[playerid] != 2 || !IsACop(playerid) || (!Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] != 2) || (!Team_EDLS(playerid) && 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][pConnectTime] < 2 ||*/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][pJailed] > 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) { pTazerReplace[playerid] = PlayerInfo[playerid][pGuns][2]; if(PlayerInfo[playerid][pGuns][2] != 0) RemovePlayerWeapon(playerid, PlayerInfo[playerid][pGuns][2]); 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); GivePlayerValidWeapon(playerid, 23, 60000); pTazer[playerid] = 1; } else { RemovePlayerWeapon(playerid, 23); GivePlayerValidWeapon(playerid, pTazerReplace[playerid], 60000); 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; } PlayerHasJustTakenTazer[playerid] = 1; SetTimerEx("TazerTakenDisable",3*1000,0,"i",playerid); } else { SendClientMessageEx(playerid, COLOR_GREY, " You are not a Cop / FBI / Coastguard!"); return 1; } return 1; } CMD:cuff(playerid, params[]) { if(!IsACop(playerid) || !Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] != 2 || !Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] != 12 && PlayerInfo[playerid][pDivision] != 2)) { if(GetPVarInt(playerid, "Injured") == 1) { SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now."); return 1; } new string[128], giveplayerid; if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /cuff [playerid]"); if(IsPlayerConnected(giveplayerid)) { if (ProxDetectorS(8.0, playerid, giveplayerid)) { if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff yourself!"); return 1; } if(PlayerCuffed[giveplayerid] == 1 || GetPlayerSpecialAction(giveplayerid) == SPECIAL_ACTION_HANDSUP) { format(string, sizeof(string), "* You have been handcuffed by %s.", GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* You handcuffed %s, till uncuff.", GetPlayerNameEx(giveplayerid)); SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* %s handcuffs %s, tightening the cuffs securely.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3); TogglePlayerControllable(giveplayerid, 0); ClearAnimations(giveplayerid); ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1); PlayerCuffed[giveplayerid] = 2; SetPVarInt(giveplayerid, "PlayerCuffed", 2); SetPVarInt(giveplayerid, "IsFrozen", 1); //Frozen[giveplayerid] = 1; PlayerCuffedTime[giveplayerid] = 300; } else { SendClientMessageEx(playerid, COLOR_GREY, "That player isn't restrained!"); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you."); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified."); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer."); } return 1; } CMD:uncuff(playerid, params[]) { if(!IsACop(playerid) || !Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] != 2 || !Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] != 12 && PlayerInfo[playerid][pDivision] != 2)) { new string[128], giveplayerid; if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /uncuff [playerid]"); if(IsPlayerConnected(giveplayerid)) { if (ProxDetectorS(8.0, playerid, giveplayerid)) { if(PlayerInfo[giveplayerid][pJailed] >= 1) { SendClientMessageEx(playerid, COLOR_WHITE, "You can't uncuff a jailed player."); return 1; } if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You can't uncuff yourself."); return 1; } if(PlayerCuffed[giveplayerid]>1) { DeletePVar(giveplayerid, "IsFrozen"); format(string, sizeof(string), "* You have been uncuffed by %s.", GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* You uncuffed %s.", GetPlayerNameEx(giveplayerid)); SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* %s has uncuffed %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3); TogglePlayerControllable(giveplayerid, 1); ClearAnimations(giveplayerid); PlayerCuffed[giveplayerid] = 0; PlayerCuffedTime[playerid] = 0; DeletePVar(giveplayerid, "PlayerCuffed"); } else { SendClientMessageEx(playerid, COLOR_GREY, "That player isn't cuffed."); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you."); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified."); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer."); } return 1; } CMD:detain(playerid, params[]) { if(gTeam[playerid] != 2 || !IsACop(playerid) || !Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] != 2 || !Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] != 12 && PlayerInfo[playerid][pDivision] != 2)) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle."); return 1; } new string[128], giveplayerid, seat; if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid 1-3]"); if(IsPlayerConnected(giveplayerid)) { if(seat < 1 || seat > 3) { SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1."); return 1; } if(IsPlayerInAnyVehicle(giveplayerid)) { SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first."); return 1; } if (ProxDetectorS(8.0, playerid, giveplayerid)) { if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot detain yourself!"); return 1; } if(PlayerCuffed[giveplayerid] == 2) { new carid = gLastCar[playerid]; if(IsSeatAvailable(carid, seat)) { new Float:pos[6]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]); GetVehiclePos( carid, pos[0], pos[1], pos[2]); if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 && floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 && floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false; format(string, sizeof(string), "* You were detained by %s .", GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* You detained %s .", GetPlayerNameEx(giveplayerid)); SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3); ClearAnimations(giveplayerid); TogglePlayerControllable(giveplayerid, false); PutPlayerInVehicle(giveplayerid, carid, seat); DetainPatch(giveplayerid, carid, seat); } else { SendClientMessageEx(playerid, COLOR_GREY, "That seat isn't available!"); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "That person isn't cuffed."); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, " You're not close enough to the player or your car!"); return 1; } } else { SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified."); return 1; } } else { SendClientMessageEx(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Coastguard!"); } return 1; }