/b command revamp
#1

Below is the basic code for the /b commad, I want to add something to it so that whenever an admin goes on duty via /aduty, his name within the /b chat turns dark green, and as soon as he goes off duty, the name color changes back to normal.


Code:
CMD:b(playerid, params[])
{
	if(gPlayerLogged{playerid} == 0)
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
		return 1;
	}
	if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /b [local ooc chat]");
    new string[128];
    if (PlayerInfo[playerid][pMask] == 0) {
        format(string, sizeof(string), "%s: (( %s ))", GetPlayerNameEx(playerid), params);
        ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }
    else if (PlayerInfo[playerid][pMask] == 1) {
        format(string, sizeof(string), "Stranger: (( %s ))",  params);
        ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        
		}

      foreach(Player, i)
	{
	    if(PlayerInfo[i][pAdmin] > 1 && BigEar[i] == 2)
	    {
			new szAntiprivacy[128];
			format(szAntiprivacy, sizeof(szAntiprivacy), "(BE) %s: %s", GetPlayerNameEx(playerid), params);
			SendClientMessageEx(i, COLOR_FADE1, szAntiprivacy);
		}
	}
	return 1;
}
Reply
#2

PHP Code:
CMD:b(playeridparams[])
{
    if(
gPlayerLogged{playerid} == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You're not logged in.");
        return 
1;
    }
    if(
isnull(params)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /b [local ooc chat]");
    new 
string[128];
    if (
PlayerInfo[playerid][pMask] == 0) {
        
format(stringsizeof(string), "%s: (( %s ))"GetPlayerNameEx(playerid), params);
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }
    else if(
PlayerInfo[i][pAdmin] > 1) {
        
format(stringsizeof(string), "{336633}%s: (( %s ))"GetPlayerNameEx(playerid), params);
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }
    else if (
PlayerInfo[playerid][pMask] == 1) {
        
format(stringsizeof(string), "Stranger: (( %s ))",  params);
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        }
      foreach(
Playeri)
    {
        if(
PlayerInfo[i][pAdmin] > && BigEar[i] == 2)
        {
            new 
szAntiprivacy[128];
            
format(szAntiprivacysizeof(szAntiprivacy), "(BE) %s: %s"GetPlayerNameEx(playerid), params);
            
SendClientMessageEx(iCOLOR_FADE1szAntiprivacy);
        }
    }
    return 
1;

Try that.
Reply
#3

Quote:
Originally Posted by aoky
View Post
PHP Code:
CMD:b(playeridparams[])
{
    if(
gPlayerLogged{playerid} == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You're not logged in.");
        return 
1;
    }
    if(
isnull(params)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /b [local ooc chat]");
    new 
string[128];
    if (
PlayerInfo[playerid][pMask] == 0) {
        
format(stringsizeof(string), "%s: (( %s ))"GetPlayerNameEx(playerid), params);
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }
    else if(
PlayerInfo[i][pAdmin] > 1) {
        
format(stringsizeof(string), "{336633}%s: (( %s ))"GetPlayerNameEx(playerid), params);
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }
    else if (
PlayerInfo[playerid][pMask] == 1) {
        
format(stringsizeof(string), "Stranger: (( %s ))",  params);
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        }
      foreach(
Playeri)
    {
        if(
PlayerInfo[i][pAdmin] > && BigEar[i] == 2)
        {
            new 
szAntiprivacy[128];
            
format(szAntiprivacysizeof(szAntiprivacy), "(BE) %s: %s"GetPlayerNameEx(playerid), params);
            
SendClientMessageEx(iCOLOR_FADE1szAntiprivacy);
        }
    }
    return 
1;

Try that.
Alight I'll try this and let you know the outcome.
Reply
#4

Go this as the only error after the compile was made

Code:
error 017: undefined symbol "i"
Reply
#5

foreach(Player, i) to foreach(new i : Player) . I recommend making their name colored if they're on admin duty rather then in general, just a thought.
Reply
#6

PHP Code:

CMD
:b(playeridparams[]) 

    if(
gPlayerLogged{playerid} == 0
    { 
        
SendClientMessageEx(playeridCOLOR_GREY"You're not logged in."); 
        return 
1
    } 
    if(
isnull(params)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /b [local ooc chat]"); 
    new 
string[128]; 
    if (
PlayerInfo[playerid][pMask] == && PlayerInfo[playerid][pAdmin] < 1) { 
        
format(stringsizeof(string), "%s: (( %s ))"GetPlayerNameEx(playerid), params); 
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5); 
    } 
    else if(
PlayerInfo[playerid][pAdmin] > 1) { 
        
format(stringsizeof(string), "{336633}%s: (( %s ))"GetPlayerNameEx(playerid), params); 
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5); 
    } 
    else if (
PlayerInfo[playerid][pMask] == 1) { 
        
format(stringsizeof(string), "Stranger: (( %s ))",  params); 
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5); 
        } 
      foreach(
Playeri
    { 
        if(
PlayerInfo[i][pAdmin] > && BigEar[i] == 2
        { 
            new 
szAntiprivacy[128]; 
            
format(szAntiprivacysizeof(szAntiprivacy), "(BE) %s: %s"GetPlayerNameEx(playerid), params); 
            
SendClientMessageEx(iCOLOR_FADE1szAntiprivacy); 
        } 
    } 
    return 
1

Reply
#7

It worked thankyou!
Reply
#8

Actually no it does not work. Doesn't change the chat color when on admin or off admin duty.
Reply
#9

Does not work, doesn't change the color of the name either when on admin duty or off admin duty
Reply
#10

Change if(PlayerInfo[playerid][pAdminDuty]) to your scripts variable for admin duty.

I removed if(gPlayerLogged{playerid} == 0) because it's just a waste of space.

You could use public OnPlayerCommandReceived(playerid, cmdtext[]) and prevent commands if you aren't logged in.

PHP Code:
CMD:b(playeridparams[])
{
    if(
isnull(params))
        return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /b [text]"); 
     new 
           
string[128]; 
    if(
PlayerInfo[playerid][pAdminDuty])
    {
          
format(stringsizeof(string), "{336633}%s: (( %s ))"GetPlayerNameEx(playerid), params);
          
ProxDetector(20.0playeridstring,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
    }
    else
    {
          
format(stringsizeof(string), "%s: (( %s ))"GetPlayerNameEx(playerid), params);
          
ProxDetector(20.0playeridstring,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
    }
    foreach(new 
Player)
    {
         if(
PlayerInfo[i][pAdmin] >= && BigEar[i] == 2)
         {
              
format(stringsizeof(string), "(BE) %s: %s"GetPlayerNameEx(playerid), params);
              
SendClientMessage(iCOLOR_FADE1string);
         }
     }
   return 
true

Reply
#11

PHP Code:
CMD:b(playeridparams[])  
{  
    if(
gPlayerLogged{playerid} == 0)  
    {  
        
SendClientMessageEx(playeridCOLOR_GREY"You're not logged in.");  
        return 
1;  
    }  
    if(
isnull(params)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /b [local ooc chat]");  
    new 
string[128];  
    if (
PlayerInfo[playerid][pMask] == && PlayerInfo[playerid][pAdmin] < 1) {  
        
format(stringsizeof(string), "%s: (( %s ))"GetPlayerNameEx(playerid), params);  
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);  
    }  
    else if(
PlayerInfo[playerid][pAdmin] > 1) {  
        
format(stringsizeof(string), "{336633}%s:{dadada} (( %s ))"GetPlayerNameEx(playerid), params);  
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);  
    }  
    else if (
PlayerInfo[playerid][pMask] == 1) {  
        
format(stringsizeof(string), "Stranger: (( %s ))",  params);  
        
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);  
        }  
      foreach(
Playeri)  
    {  
        if(
PlayerInfo[i][pAdmin] > && BigEar[i] == 2)  
        {  
            new 
szAntiprivacy[128];  
            
format(szAntiprivacysizeof(szAntiprivacy), "(BE) %s: %s"GetPlayerNameEx(playerid), params);  
            
SendClientMessageEx(iCOLOR_FADE1szAntiprivacy);  
        }  
    }  
    return 
1;  

Reply
#12

When I used your code it gave me this:

Code:
error 031: Undefined symbol pAdminDuty
Then I defined pAdminDuty and I got this error:

Code:
error 029: invalid expression, assumed zero
This is the line the error came on:

Code:
if(PlayerInfo[playerid][pAdminDuty])
Reply
#13

Yes, rename it to the variable your script uses. If you don't have one for admin duty then just set it to pAdmin or whatever.
Reply
#14

Quote:
Originally Posted by Arthur Kane
View Post
Yes, rename it to the variable your script uses. If you don't have one for admin duty then just set it to pAdmin or whatever.
I dont want to rename the variables, can you help me fix the existing code please with the [pAdmin]
Reply
#15

Just change if(PlayerInfo[playerid][pAdminDuty]) to [pAdmin].
Reply
#16

It worked but the green name for the admin stays at all times. I want to make it like whenever an administrator goes on duty, the color changes to green over /b and as soon as the administrator goes off duty the color changes back to normal.
Reply
#17

What's the variable for an admin going on duty?
Reply
#18

These sort of copy-paste "try this" responses doesn't teach jack shit to the scripter.

The way that you're checking for BigEar, will show that message double, each time someone says something nearby them.
Reply
#19

Send me the command for going on admin duty
Reply
#20

Quote:
Originally Posted by aoky
View Post
Send me the command for going on admin duty
Can you please take notice that your copy-paste rep hunting, isn't teaching anyone ANYTHING.

All you need is the actual AdminDuty enum, nothing more.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)