Colocar Comando /AdminDuty
#3

Es facil amigo solo haz lo siguiente:

Defines:
pawn Код:
new AdminDuty;
Luego vas a la Callback OnPlayerConnect y pones esto:
pawn Код:
AdminDuty[playerid] = 0; // Valor 0 significa que cuando un admin se conecta estara off duty...
Luego ha la Callback OnPlayerDisconnect y pones lo siguiente:
pawn Код:
AdminDuty[playerid] = 0; // Valor 0 significa que cuando un admin se desconecta estara off duty...
Bueno ahora creamos el comando que iria asi:

pawn Код:
CMD:adminduty(playerid, params[])
{
    if( PlayerInfo[playerid][pAdmin] > 1 )
    {
      if(AdminDuty[playerid] == 0) // Verifica si el usuario esta off duty.
      {
            AdminDuty[playerid] = 1; // Pone al usuario On duty si este esta Off Duty
            SetPlayerHealth(playerid, 99999); // Vida infinita
            SetPlayerArmour(playerid, 99999); // Chaleco infinito
            SetPlayerSkin(playerid, 100);  // Skin administrativo
            return 1;
      }
      else if(AdminDuty[playerid] == 1)  // Verifica si el usuario esta on duty.
      {
             AdminDuty[playerid] = 0; // Pone al usuario Off Duty si este esta On Duty.
             SetPlayerHealth(playerid, 100); // Setea la vida a 100
             SetPlayerArmour(playerid, 0);  // Quita el chaleco
             return 1;
      }
    }
return 1;
}
Ahora si queres que un comando admin funcione solo cuando estes On Duty agrega esto al comando debajo de la variable if(PlayerInfo[playerid][pAdmin]):
pawn Код:
if(AdminDuty[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error]: No estas en servicio.");
Un saludo cualquier duda MP..
Reply


Messages In This Thread
Colocar Comando /AdminDuty - by Juan_Morales - 17.07.2012, 13:57
Respuesta: Colocar Comando /AdminDuty - by Zume - 17.07.2012, 14:14
Respuesta: Colocar Comando /AdminDuty - by oOFotherOo - 20.07.2012, 14:44

Forum Jump:


Users browsing this thread: 1 Guest(s)