need help with a command
#1

HI Guys Again,
how do i make a command for cops when they do /parole [id] they release the players from jail and how to make a command for like when the robber do /bribe [id] [amount] then he put like 15k cash to the cop then his wanted stars are gone please help ,thanks
Reply
#2

As far as the /parole, it depends on how you jail them. I assume you have a Player Info enum and one of the items is "jailed" or "pJailed" or something like that. This might not work for yours exactly copy and paste, but this is a general guideline:

pawn Код:
OnPlayerCommandText(playerid, cmdtext[])
{
     dcmd(parole, 6, cmdtext);
}

dcmd_parole(playerid, params[])
{
     new id;
     if (sscanf(params, "d", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /parole [id]");
     else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player is not connected or is yourself");
     else if(PlayerInfo[id][pJailed] == 0) SendClientMessage(playerid, 0xFF0000AA, "Player is not in jail!"
     else
     {
          PlayerInfo[id][pJailed] = 0;
          SetPlayerPos(id, x, y, z); //These are the coordinates of where you want them to go when released from jail
          SendClientMessage(id, 0x00FF00AA, "You have been released from jail on parole");
     }
     return 1;
}
And for the bribe:

pawn Код:
OnPlayerCommandText(playerid, cmdtext[])
{
     dcmd(bribe, 5, cmdtext);
}

dcmd_bribe(playerid, params[])
{
     new id, amt, cash;
     if(sscanf(params, "dd", id, amt)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /bribe [id] [amount]");
     else if(GetPlayerMoney(playerid) < amt) SendClientMessage(playerid, 0xFF0000AA, "You do not have enough money to bribe this amount!");
     else
     {
          GivePlayerMoney(id, amt);
          GivePlayerMoney(playerid, -amt);
          SendClientMessage(id, 0x00ff00aa, "You have been bribed!");
      }
      return 1;
}
And these are semi-basic versions, you should be able to easily modify them if you know what you're doing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)