Command for Helpers
#1

i need to make /hduty, for helpers.

Quote:

stock GetAdminRank(playerid)
{
new arank[64];
switch(PlayerInfo[playerid][Admin])
{
case 5: arank = "Owner";
case 4: arank = "Co-Owner";
case 3: arank = "Admin";
case 2: arank = "Mod";
case 1: arank = "Helper";
default: arank = "Usuario";
}
return arank;
}

enum @ID
{
Admin,
Ayudante,
AyudanteDuty
};

new Ayudante2[MAX_PLAYERS][@ID];

CMD:hduty(playerid)
{
if(!(Ayudante2[playerid][Admin] == 1)) return SendClientMessage(playerid,-1,"{ff0000}[ERROR]:{ffffff} No permission.");
new string[128], name[24];
new Text3D:label = Create3DTextLabel("HELPER", -1, 0.0,0.0,0.0,40.0,0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
GetPlayerName(playerid,name,24);
format(string,sizeof(string), "{ff0000}[!]{ffffff} %s {ff0000}(ID: %d){ffffff} %s", name, playerid, ((Ayudante2[playerid][AyudanteDuty] == 1) ? ("is on duty") : ("is off duty")));
SendClientMessageToAll(-1, string);
Ayudante2[playerid][AyudanteDuty] = ((Ayudante2[playerid][AyudanteDuty] == 1) ? (0) : (1));
return 1;
}

Reply
#2

ok so u made a command, so? what's the issue?

Reply
#3

This is a clean code which you can understand easily.
Create the 3DTextLabel outside the command, like I did, so you will be able to delete it when they go off duty.


PHP код:
stock GetAdminRank(playerid)
{
new 
arank[10];
switch(
PlayerInfo[playerid][Admin])
{
case 
5arank "Owner";
case 
4arank "Co-Owner";
case 
3arank "Admin";
case 
2arank "Mod";
case 
1arank "Helper";
default: 
arank "Usuario";
}
return 
arank;
}
stock GetDutyStatus(playerid)
{
          new 
string[8];
         switch(
Ayudante2[playerid][AyudanteDuty])
         {
                    case 
0format(string8"Off Duty");
                    case 
1format(string8"On Duty");
          }
          return 
string;
}
new 
Text3D:helperlabel[MAX_PLAYERS];
enum @ID
{
Admin,
Ayudante,
AyudanteDuty
};
new 
Ayudante2[MAX_PLAYERS][@ID];
CMD:hduty(playerid)
{
if(
Ayudante2[playerid][Admin] != 1) return SendClientMessage(playerid,-1,"{ff0000}[ERROR]:{ffffff} No permission.");
if(
Ayudante2[playerid][AyudanteDuty] == 0) {
Text3D:helperlabel Create3DTextLabel("HELPER", -10.0,0.0,0.0,40.0,0);
Attach3DTextLabelToPlayer(labelplayerid0.00.00.7)
Ayudante2[playerid][AyudanteDuty] = 1;
}
else 
{
         
Ayudante2[playerid][AyudanteDuty] = 0;
         
DeletePlayer3DTextLabel(playeridhelperlabel);
}
new 
string[128], name[24];
GetPlayerName(playerid,name,24);
format(string,sizeof(string), "{ff0000}[!]{ffffff} %s {ff0000}(ID: %d){ffffff} is %s"nameplayeridGetDutyStatus(playerid));
SendClientMessageToAll(-1string);
return 
1;

Reply
#4

PHP код:
CMD:hduty(playerid)
{
    if(!(
Ayudante2[playerid][Admin] == 1)) 
Reply
#5

Quote:
Originally Posted by cuber
Посмотреть сообщение
PHP код:
CMD:hduty(playerid)
{
    if(!(
Ayudante2[playerid][Admin] == 1)) 
Yeah, I noticed that too. The code I posted for him is fixed
Use x!=1 next time instead of (!(x==1))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)