/arrest [playerid] error? sscanf(params,"u"??
#1

Okay. Let me explain whats the problem, I made a /arrest command and i made it for ONLY COPS! and that works but this gotta be a sscanf problem or somthing because its giving me the wrong error.

For example. If i just type /arrest in-game its suppose to say Usage: /arrest [playerid]

but it says "You cant arrest another police officer

heres the code:


pawn Код:
CMD:arrest(playerid,params[])
{
    new player1;
    // IsACop = 1 - this means if the player is a cop
    // IsACop = 0 - this means the player is NOT a cop
    if(IsPlayerCuffed(player1)) return SendClientMessage(playerid, -1, "{D53C2B}Usage:{FFFFFF} You must /cuff him before arresting."); // so he must cuff before arrest
    if(IsACop[playerid] == 0) return  SendClientMessage(playerid, 0xDDDDDDC8, "This command is restricted to {113EEE}Law enforcement"); // blocked it for players
    if(IsACop[player1] == 1) return  SendClientMessage(playerid, 0xDDDDDDC8,  "You cant arrest another police officer!"); //made it so he cant arrest another cop
    if(GetDistanceBetweenPlayers(playerid, player1) < 10) return SendClientMessage(playerid,-1,"{D93826}Error:{FFFFFF} You must be near the player to arrest him");
    if(GetPlayerWantedLevel(player1) >= 2) return SendClientMessage(playerid,-1,"{D93826}Error:{FFFFFF} He must have a higher wanted level");
    if(IsPlayerJailed[player1] == 1) return SendClientMessage(playerid,-1,"{D93826}Error:{FFFFFF} This player is already in jail");
    if(IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid,-1,"{D92626}Error:{FFFFFF} You cant cuff him if hes in a vehicle");
    if(sscanf(params, "u", player1)) SendClientMessage(playerid, 0xFF0000AA,  "{D93826}Usage:{FFFFFF} /arrest [playerid]");
    new reward;
    reward = GetPlayerWantedLevel(player1);
    GivePlayerMoney(playerid,reward*000);
    TogglePlayerControllable(player1,0);
    SetPlayerSpecialAction(player1,SPECIAL_ACTION_HANDSUP);
// its more but theres no use to posting it
Reply
#2

Use the sscanf first and then check if the player is cuffed, cop, the distance, wanted level etc otherwise you check for player with ID 0 since it hasn't even assign the value to "player1" so it's by default 0.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)