SA-MP Forums Archive
A problem with Command (ADUTY) => - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A problem with Command (ADUTY) => (/showthread.php?tid=506504)



A problem with Command (ADUTY) => - gekas - 13.04.2014

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;
}



Re: A problem with Command (ADUTY) => - gekas - 13.04.2014

Can Fix ?


Re: A problem with Command (ADUTY) => - PrivatioBoni - 13.04.2014

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.


Re: A problem with Command (ADUTY) => - SupaFool - 13.04.2014

Why use dcmd? use zcmd its more faster!


Re: A problem with Command (ADUTY) => - Equuuuin0X - 13.04.2014

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


Re: A problem with Command (ADUTY) => - Sojo12 - 13.04.2014

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?


Re: A problem with Command (ADUTY) => - Equuuuin0X - 13.04.2014

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;
}



Re: A problem with Command (ADUTY) => - gekas - 13.04.2014

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


Re: A problem with Command (ADUTY) => - Equuuuin0X - 13.04.2014

Alrigth, working on it.


Re: A problem with Command (ADUTY) => - Equuuuin0X - 13.04.2014

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 =/.