Need an ''Admin duty''
#1

Hy yo!

So, i need a script, there are in the RP server all color on the TAB (player list) is white.
Can somebody make a script for admins?
The admin is write /aduty he is red on the list and he gets a skin(now 295 - Mike Toreno skin)
The admin is write again /aduty he is normally white at the list and he gets the normally skin.
BuTWait!
There are more admin than 1 or 2!
So I need the script with names, now:
Tony_Giuliani, Rob_Dyrdek and much more!
Please Write soon!
Tony!
Reply
#2

Whats the point of having someone do it for you? You learn nothing, read up on https://sampwiki.blast.hk/wiki/Main_Page and code it yourself!
Reply
#3

Quote:
Originally Posted by ǝɹoɯ‾ʎ
Whats the point of having someone do it for you? You learn nothing, read up on https://sampwiki.blast.hk/wiki/Main_Page and code it yourself!
I agree.
Reply
#4

Quote:
Originally Posted by eDDy_
Quote:
Originally Posted by ǝɹoɯ‾ʎ
Whats the point of having someone do it for you? You learn nothing, read up on https://sampwiki.blast.hk/wiki/Main_Page and code it yourself!
I agree.
I tried sometimes btw it's not work :'|
Reply
#5


// top:

new OriginalSkin[MAX_PLAYERS];
new OriginalColor[MAX_PLAYERS];
new OnDuty[MAX_PLAYERS];

// on player connect:
OnDuty[playerid] = 0;

// on player disconnect:
OnDuty[playerid] = 0;

// on player spawn:
OriginalSkin[playerid] = GetPlayerSkin(playerid);

// on player command text:
if(strcmp(cmd, "/aduty", true) == 0)
{
if(Level[playerid] != ADMIN) return 0; // use this to check if there admin

if(OnDuty[playerid] == 0) {
SetPlayerSkin(playerid,295);
OnDuty[playerid] = 1;
SendClientMessage(playerid, 0xFF0000AA, "You Are Now On Duty As Admin.");
OriginalColor[playerid] = GetPlayerColor(playerid);
SetPlayerColor(playerid, 0xFF0000AA);
}
else if(OnDuty[playerid] == 1) {
SetPlayerSkin(playerid,OriginalSkin[playerid]);
OnDuty[playerid] = 0;
SendClientMessage(playerid, 0xFF0000AA, "You Are Now Off Duty As Admin.");
SetPlayerColor(playerid, OriginalColor[playerid]);
}
return 1;
}

if(strcmp(cmdtext, "/admins", true)==0)
{

new count = 0;
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(Level[ i ] == ADMIN) {
count++;
}
}

if(count > 0) {
new string[50];
SendClientMessage(playerid, COLOR_TEAL, "Current Online Admins:");
for(new i = 0; i <MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && Level[ i ] == ADMIN) {
format(string, sizeof(string), "%s (%d)", ReturnPlayerName(i), i);
SendClientMessage(playerid,0xFF0000AA, string);
}
}
}
else {
SendClientMessage(playerid,0xFF0000AA, "There Are Currently No Admins Online.");
}
return 1;
}


and then put this function at the bottom :

stock ReturnPlayerName(playerid)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
return PlayerName;
}



Edit: remember to replace the "ADMIN" and Level[playerid] with what you use to check if the player is admin.
Reply
#6

@<__Ǝthan__>: Eh, you could just use pawn tags: [ pawn ] [ / pawn ].
Reply
#7

i know, i feel that doing it manually is easier to read though, and the easier to read the faster they will learn
Reply
#8

Thx!
And with the tutorials:
I am Hungarian I can speak english, but the tutorials with the pawno are hard a bit

pawn Код:
// top:

new OriginalSkin[MAX_PLAYERS];
new OriginalColor[MAX_PLAYERS];
new OnDuty[MAX_PLAYERS];

// on player connect:
OnDuty[playerid] = 0;

// on player disconnect:
OnDuty[playerid] = 0;

// on player spawn:
OriginalSkin[playerid] = GetPlayerSkin(playerid);

// on player command text:
  if(strcmp(cmd, "/aduty", true) == 0)
  {
   if(Level[playerid] != ADMIN) return 0; // use this to check if there admin
   
   if(OnDuty[playerid] == 0) {
     SetPlayerSkin(playerid,295);
     OnDuty[playerid] = 1;
     SendClientMessage(playerid, 0xFF0000AA, "You Are Now On Duty As Admin.");
     OriginalColor[playerid] = GetPlayerColor(playerid);
     SetPlayerColor(playerid, 0xFF0000AA);
   }
   else if(OnDuty[playerid] == 1) {
     SetPlayerSkin(playerid,OriginalSkin[playerid]);
     OnDuty[playerid] = 0;
     SendClientMessage(playerid, 0xFF0000AA, "You Are Now Off Duty As Admin.");
     SetPlayerColor(playerid, OriginalColor[playerid]);
   }
   return 1;
  }

  if(strcmp(cmdtext, "/admins", true)==0)
  {
     
   new count = 0;
   for(new i = 0; i <MAX_PLAYERS; i++)
   {
     if(Level[ i ] == ADMIN) {
      count++;
     }
   }
   
   if(count > 0) {
     new string[50];
     SendClientMessage(playerid, COLOR_TEAL, "Current Online Admins:");
     for(new i = 0; i <MAX_PLAYERS; i++) {
      if(IsPlayerConnected(i) && Level[ i ] == ADMIN) {
        format(string, sizeof(string), "%s (%d)", ReturnPlayerName(i), i);
        SendClientMessage(playerid,0xFF0000AA, string);
      }
     }
   }
   else {
     SendClientMessage(playerid,0xFF0000AA, "There Are Currently No Admins Online.");
   }
   return 1;
  }


and then put this function at the bottom :

stock ReturnPlayerName(playerid)
{
  new PlayerName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
  return PlayerName;
}
But with the top, it's didn't work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)