A problem with Command (ADUTY) =>
#1

This is my aduty how to create if i do again /aduty remove aduty

pawn Код:
dcmd_aduty(playerid, params[])
{
    if (IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 1){

    new idx,tmp[256];

    tmp = strtok(params, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_ERROR, "You are Aduty.");
    return 1;
    }
    SetPlayerHealth(playerid, 99999);
        SetPlayerArmour(playerid,99999);
       GivePlayerWeapon(playerid, 38, 99999);
    }else{
    SendClientMessage(playerid, COLOR_ERROR, "Unknown Command! Type /cmds For Available Commands.");
    }
    return 1;
}
Reply
#2

Can Fix ?
Reply
#3

That code looks very unappealing but you could make a variable for being on duty, e.g. adminOnDuty and that is set to true when you're on duty, and false when you're going off. You could make the script check the current variable, if the variable is false, do the on duty code and set the variable to true, and vice versa.
Reply
#4

Why use dcmd? use zcmd its more faster!
Reply
#5

pawn Код:
dcmd_aduty(playerid, params[])
{
      if (IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 1) return SendClientMessage(playerid, COLOR_WHITE,"Unknown command: type /cmds to see list of commands.");
      {
             SetPlayerHealth(playerid, 99999);
             SetPlayerArmour(playerid,99999);
             GivePlayerWeapon(playerid, 38, 99999);
      }
return 1;
}
But this could be spammed by the admin...and it has no variables
Reply
#6

Quote:
Originally Posted by Equuuuin0X
Посмотреть сообщение
dcmd_aduty(playerid, params[])
{
if (IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 1) return SendClientMessage(playerid, COLOR_WHITE,"Unknown command: type /cmds to see list of commands.");
{
SetPlayerHealth(playerid, 99999);
SetPlayerArmour(playerid,99999);
GivePlayerWeapon(playerid, 38, 99999);
}
return 1;
}
Cant you use pawn code tag?
Reply
#7

Alright, I'll make you with fullfilled code

pawn Код:
enum dinfo
{
  adminduty,
}
new PlayerInfo[playerid][dinfo]

dcmd_aduty(playerid, params[])
{
      if (PlayerInfo[playerid][adminduty] == 1) return SendClientMessage(playerid, COLOR_WHITE,"You are already on duty!");
      if (IsPlayerAdmin(playerid) return SendClientMessage(playerid, COLOR_WHITE,"Unknown command: type /cmds to see list of commands.");
      {
             SetPlayerHealth(playerid, 99999);
             SetPlayerArmour(playerid,99999);
             GivePlayerWeapon(playerid, 38, 99999);
             PlayerInfo[playerid][adminduty] = 1;
      }
      return 1;
}

dcmd_offduty(playerid, params[])
{
   SetPlayerHealth(playerid, 100);
   SetPlayerArmour(playerid, 0);
   ResetPlayerWeapon(playerid);
   PlayerInfo[playerid][adminduty] = 0;
   return 1;
}
Reply
#8

PLZ MAKE IT PLZ I WANT set Player heath 100 armour 100 and when i will do aduty will make skin 294 if i will exit aduty will get the last skin
Reply
#9

Alrigth, working on it.
Reply
#10

pawn Код:
enum dinfo
{
    adminduty
}
new PlayerInfo[playerid][dinfo];

dcmd_aduty(playerid, params[])
{
      if (IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE,"Unknown command: type /cmds to see list of commands.");
      {
      if (PlayerInfo[playerid][adminduty] == 1) return SendClientMessage(playerid, COLOR_WHITE,"You are already on duty");
      {
      SetPlayerHealth(playerid, 99999);
      SetPlayerArmour(playerid,99999);
      GivePlayerWeapon(playerid, 38, 99999);
      PlayerInfo[playerid][adminduty] = 1;
      }
      }
      return 1;
}

dcmd_offduty(playerid, params[])
{
       if (IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE,"Unknown command: type /cmds to see list of commands.");
       {
       if (PlayerInfo[playerid][adminduty] == 0) return SendClientMessage(playerid, COLOR_WHITE,"You are already off duty");
       {
       SetPlayerHealth(playerid, 100);
       SetPlayerArmour(playerid, 0);
       ResetPlayerWeapons(playerid);
       PlayerInfo[playerid][adminduty] = 0;
       }
       }
       return 1;
}
I can't find any functional to load previous skin =/.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)