01.04.2019, 13:07
Oi, eu estou tendo alguns problemas com um script e como ainda estou aprendendo, -vou precisar de uma ajuda.
Eu estou usando esse comando para arrastar (/drag)(/stopdrag) um jogador depois de ser preso pela polнcia
mais tem um probleminha, quando o jogador й preso (/arrest), ele vai para a cela e depois й automaticamente teleportado de volta para mim porque estб /drag a mim, entгo, eu preciso que me ajudem como eu faзo para nгo deixar usar o comando /arrest, se o jogador tiver dando /drag no suspeito.
PS: Creditos aos criadores do gamemode Classified Roleplay, porque estou usando como base.
Eu estou usando esse comando para arrastar (/drag)(/stopdrag) um jogador depois de ser preso pela polнcia
Код:
dcmd_drag(playerid, params[]) { new id, string[ 128 ]; if( sscanf( params, "u", id) ) { SendClientMessage( playerid, COLOR_WHITE, "USAGE: /drag [PlayerID/PartOfName]" ); } else { if( PlayerTied[id] >= 1 || PlayerCuffed[id] >= 1) { if(GetDistanceBetweenPlayers( playerid, id) < 7) { ApplyAnimation(id,"SWEET","Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0,1); ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0,1); PlayerInfo[id][BeingDraggedBy] = playerid; format( string, sizeof( string ), "You have started to drag %s.", PlayerName(id) ); SendClientMessage( playerid, COLOR_LIGHTBLUE, string); format( string, sizeof( string ), "* %s grabs ahold of %s and starts dragging them.", PlayerName(playerid), PlayerName(id) ); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } else { SendClientMessage( playerid, COLOR_GRAD1, "You're too far away!" ); } } else { SendClientMessage( playerid, COLOR_GRAD1, "Your target has to be either tied or cuffed." ); } } return 1; } dcmd_stopdrag(playerid, params[]) { #pragma unused params new string[73]; for( new i = 0; i < MAX_PLAYERS; i++ ) { if(IsPlayerConnected( i ) && PlayerInfo[i][BeingDraggedBy] == playerid) { format( string, sizeof( string ), "You have stopped dragging %s.", PlayerName(playerid) ); SendClientMessage( playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* %s has stopped dragging %s.", PlayerName(playerid), PlayerName(i) ); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); PlayerInfo[i][BeingDraggedBy] = -1; ClearAnimations(playerid); } } return 1; }
Код:
if(strcmp(cmd, "/arrest", true) == 0) { if(IsPlayerConnected(playerid)) { if(IsACop(playerid) || IsAnAgent(playerid)) { if(IsACop(playerid) && PlayerInfo[playerid][pOnDuty] == 0) { SendClientMessage(playerid, COLOR_WHITE, "You are not on Duty (10-8)."); return 1; } new interior = GetPlayerInterior(playerid); if(!IsPlayerInRangeOfPoint(playerid,8.0,1528.3715,-1677.9541,5.8906) && !IsPlayerInRangeOfPoint(playerid,8.0,1651.0934,-1694.3004,15.6094) && !IsPlayerInRangeOfPoint(playerid,8.0,398.9164,-1161.7887,1223.6608) && !IsPlayerInRangeOfPoint(playerid,8.0,246.5069,66.6402,1003.6406) && !IsPlayerInRangeOfPoint(playerid,8.0,1564.6757,-1657.3682,28.3956) && !IsPlayerInRangeOfPoint(playerid,8.0,615.19,-584.78,17.22) && interior != 10 && interior != 3) { SendClientMessage(playerid, COLOR_GREY, " You are not at an Arrest Point!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [price] [minutes] [bail (0 - 1)] [bailprice]"); return 1; } moneys = strvalEx(tmp); if(moneys < 100 || moneys > 750) { SendClientMessage(playerid, COLOR_GREY, " Price can't be below $100 or above $750!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [price] [minutes] [bail (0 - 1)] [bailprice]"); return 1; } new time = strvalEx(tmp); if(time < 2 || time > 7) { SendClientMessage(playerid, COLOR_GREY, " Minutes can't be below 1 or above 7!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [price] [minutes] [bail (0 - 1)] [bailprice]"); return 1; } new bail = strvalEx(tmp); if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, " Bail can't be below 0 or above 1!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [price] [minutes] [bail (0 - 1)] [bailprice]"); return 1; } new bailprice = strvalEx(tmp); if(bailprice < 2000 || bailprice > 20000) { SendClientMessage(playerid, COLOR_GREY, " Bail Price can't be below $2,000 or above $20,000!"); return 1; } new suspect = GetClosestPlayer(playerid); if(IsPlayerConnected(suspect)) { if(GetDistanceBetweenPlayers(playerid,suspect) < 5) { if(PlayerInfo[suspect][pWantedLevel] < 1) { SendClientMessage(playerid, COLOR_GREY, " Player must be at least Wanted Level 1!"); return 1; } GetPlayerName(suspect, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* You arrested %s.", giveplayer); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "You were arrested by %s, $%d", sendername, moneys); SendClientMessage(suspect,COLOR_LIGHTRED,string); PlayerInfo[suspect][pCash] = PlayerInfo[suspect][pCash]-moneys; GivePlayerMoney(suspect, -moneys); ClearGuns(suspect); ResetPlayerWeapons(suspect); if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1) { format(string, sizeof(string), "[LSPD] |%s %s Has arrested The Suspect %s|", GetPlayerRank(playerid),GetName(playerid), giveplayer); OOCNews(COLOR_LIGHTRED, string); SetPlayerInterior(suspect,10); PlayerInfo[playerid][pInt] = 6; new rand = random(sizeof(SFSpawns)); PlayerCell = rand; SetPlayerPos(suspect, SFSpawns[rand][0], SFSpawns[rand][1], SFSpawns[rand][2]); SetPlayerFacingAngle(suspect, SFSpawns[rand][3]); PlayerCuffed[suspect] = 0; TogglePlayerControllable(suspect, 1); SetCameraBehindPlayer(suspect); PlayerInfo[suspect][pJailTime] = time*60; } else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2) { format(string, sizeof(string), "[FBI] |%s %s Has arrested The Suspect %s|", GetPlayerRank(playerid),GetName(playerid), giveplayer); OOCNews(COLOR_LIGHTRED, string); SetPlayerInterior(suspect,10); PlayerInfo[playerid][pInt] = 6; new rand = random(sizeof(FBISpawns)); PlayerCell = rand; SetPlayerPos(suspect, FBISpawns[rand][0], FBISpawns[rand][1], FBISpawns[rand][2]); SetPlayerFacingAngle(suspect, FBISpawns[rand][3]); PlayerCuffed[suspect] = 0; TogglePlayerControllable(suspect, 1); SetCameraBehindPlayer(suspect); PlayerInfo[suspect][pJailTime] = time * 60; } else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3) { format(string, sizeof(string), "[DSD] |%s %s Has arrested The Suspect %s|", GetPlayerRank(playerid),GetName(playerid), giveplayer); OOCNews(COLOR_LIGHTRED, string); SetPlayerInterior(suspect,10); PlayerInfo[playerid][pInt] = 6; new rand = random(sizeof(SFSpawns)); PlayerCell = rand; SetPlayerPos(suspect, SFSpawns[rand][0], SFSpawns[rand][1], SFSpawns[rand][2]); SetPlayerFacingAngle(suspect, SFSpawns[rand][3]); PlayerCuffed[suspect] = 0; TogglePlayerControllable(suspect, 1); SetCameraBehindPlayer(suspect); PlayerInfo[suspect][pJailTime] = time * 60; } else if(PlayerInfo[playerid][pMember]==7||PlayerInfo[playerid][pLeader]==7) { format(string, sizeof(string), "[SS] |%s %s Has arrested The Suspect %s|", GetPlayerRank(playerid),GetName(playerid), giveplayer); OOCNews(COLOR_LIGHTRED, string); SetPlayerInterior(suspect,10); PlayerInfo[playerid][pInt] = 6; new rand = random(sizeof(SFSpawns)); PlayerCell = rand; SetPlayerPos(suspect, SFSpawns[rand][0], SFSpawns[rand][1], SFSpawns[rand][2]); SetPlayerFacingAngle(suspect, SFSpawns[rand][3]); PlayerCuffed[suspect] = 0; TogglePlayerControllable(suspect, 1); SetCameraBehindPlayer(suspect); PlayerInfo[suspect][pJailTime] = time * 60; } if(bail == 1) { JailPrice[suspect] = bailprice; format(string, sizeof(string), "* You are jailed for %d seconds, Bail: $%d.", PlayerInfo[suspect][pJailTime], JailPrice[suspect]); SendClientMessage(suspect, COLOR_LIGHTBLUE, string); } else { JailPrice[suspect] = 0; format(string, sizeof(string), "* You are jailed for %d seconds, Bail: Unavailable.", PlayerInfo[suspect][pJailTime]); SendClientMessage(suspect, COLOR_LIGHTBLUE, string); } if(PlayerInfo[suspect][Robbing] == 1) { if(RobStatus[RobberID1] == suspect) { RobStatus[RobberID1] = 200; if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199) { RobStatus[BeingRobbed] = 0; RobStatus[BankReload] = 2; // Can't be robbed for 2 hours RobStatus[Setup] = 0; SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished **"); FinishRobbery(); } } if(RobStatus[RobberID2] == suspect) { RobStatus[RobberID2] = 200; if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199) { RobStatus[BeingRobbed] = 0; RobStatus[BankReload] = 2; // Can't be robbed for 2 hours RobStatus[Setup] = 0; SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished **"); FinishRobbery(); } } if(RobStatus[RobberID3] == suspect) { RobStatus[RobberID3] = 200; if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199) { RobStatus[BeingRobbed] = 0; RobStatus[BankReload] = 2; // Can't be robbed for 2 hours RobStatus[Setup] = 0; SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished **"); FinishRobbery(); } } if(RobStatus[RobberID4] == suspect) { RobStatus[RobberID4] = 200; if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199) { RobStatus[BeingRobbed] = 0; RobStatus[BankReload] = 2; // Can't be robbed for 2 hours RobStatus[Setup] = 0; SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished **"); FinishRobbery(); } } if(RobStatus[RobberID5] == suspect) { RobStatus[RobberID5] = 200; if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199) { RobStatus[BeingRobbed] = 0; RobStatus[BankReload] = 2; // Can't be robbed for 2 hours RobStatus[Setup] = 0; SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished **"); FinishRobbery(); } } format(string,sizeof(string),"** You've been arrested and didn't get your $%d",PlayerInfo[playerid][CashLoaded]); SendClientMessage(suspect, COLOR_YELLOW, string); PlayerInfo[suspect][CashLoaded] = 0; PlayerInfo[suspect][Robbing] = 0; DisablePlayerCheckpoint(suspect); } PlayerInfo[suspect][pJailed] = 1; PlayerInfo[suspect][pArrested] += 1; SetPlayerFree(suspect,playerid, "Got Arrested"); PlayerInfo[suspect][pWantedLevel] = 0; SetPlayerWantedLevel(suspect, 0); SetPlayerToTeamColor(suspect); WantLawyer[suspect] = 1; OnPlayerSave(suspect); } } else { SendClientMessage(playerid, COLOR_GREY, " Nobody close enough to arrest!"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You are not part of a Team!"); return 1; } } return 1; }