need help
#1

Hi ,

I need an text before the Admin's name called "Admin" when he is in /aduty
/aduty's code:
Код:
CMD:aduty(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] >1)
   {
	  SendClientMessage(playerid, COL_WHITE, "Good Luck on your duties!");
	  return 1;
   }
}
Please help.
Reply
#2

You can use one of these:

https://sampwiki.blast.hk/wiki/SetPlayerChatBubble

https://sampwiki.blast.hk/wiki/Attach3DTextLabelToPlayer

Or simply you can format the new name of the admin and set it with https://sampwiki.blast.hk/wiki/SetPlayerName
Reply
#3

I meant that when they chat and are on /aduty if they aren't nothing else come
Reply
#4

Quote:
Originally Posted by Gotham
Посмотреть сообщение
I meant that when they chat and are on /aduty if they aren't nothing else come
Create a global variable like

PHP код:
new bool:onduty[MAX_PLAYERS] = false
And so:

PHP код:
CMD:aduty(playeridparams[])
{
   if(
PlayerInfo[playerid][pAdmin] >1)
   {
          if(
onduty[playerid] == false)
          {
                 
SendClientMessage(playeridCOL_WHITE"Good Luck on your duties!");
                 
onduty[playerid] = true;
          }
          else
          {
                 
SendClientMessage(playeridCOL_WHITE"message!");
                 
onduty[playerid] = false;
          }      
      return 
1;
   }

And in OnPlayerText:

PHP код:

if(onduty[playerid == true)
{
     new 
str[144];
     
format(strsizeof (str), "{FFFF00}ON DUTY{FFFFFF} %s"text);
     
SendPlayerMessageToAll(playeridstr);
     return 
0;

Remember to toggle it off under OnPlayerDisconnect(playerid)


It should work
Reply
#5

How do I toggle it off?
Reply
#6

Quote:
Originally Posted by Gotham
Посмотреть сообщение
How do I toggle it off?
I already replied that question xD Keep attention

PHP код:
CMD:aduty(playeridparams[]) 

   if(
PlayerInfo[playerid][pAdmin] >1
   { 
          if(
onduty[playerid] == false
          { 
                 
SendClientMessage(playeridCOL_WHITE"Good Luck on your duties!"); 
                 
onduty[playerid] = true
          } 
          else 
          { 
                 
SendClientMessage(playeridCOL_WHITE"message!"); 
                 
onduty[playerid] = false
          }       
      return 
1
   } 

Reply
#7

Sorry,

Here I failed to put the return in the correct position:
PHP код:
CMD:aduty(playeridparams[])  
{  
   if(
PlayerInfo[playerid][pAdmin] >1)  
   {  
          if(
onduty[playerid] == false)  
          {  
                 
SendClientMessage(playeridCOL_WHITE"Good Luck on your duties!");  
                 
onduty[playerid] = true;  
          }  
          else  
          {  
                 
SendClientMessage(playeridCOL_WHITE"message!");  
                 
onduty[playerid] = false;  
          }        
   }  
   return 
1;  

Here I forgot to close this "if(onduty[playerid"
PHP код:
public OnPlayerText(playeridtext[])
{
    if(
onduty[playerid] == true)
    {
         new 
str[144];
         
format(strsizeof (str), "{FFFF00}ON DUTY{FFFFFF} %s"text);
         
SendPlayerMessageToAll(playeridstr);
         return 
0;
    }
    return 
1;

Reply
#8

those arguement errors wont go though
Код:
:\Users\gouth_000\Desktop\Server SAMP\gamemodes\test.pwn(159) : error 035: argument type mismatch (argument 2)
C:\Users\gouth_000\Desktop\Server SAMP\gamemodes\test.pwn(164) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#9

PHP код:
CMD:aduty(playeridparams[])   
{   
   if(
PlayerInfo[playerid][pAdmin] >1)   
   {   
          if(
onduty[playerid] == false)   
          {   
                 
SendClientMessage(playerid, -1"Good Luck on your duties!");   
                 
onduty[playerid] = true;   
          }   
          else   
          {   
                 
SendClientMessage(playerid, -1"message!");   
                 
onduty[playerid] = false;   
          }         
   }   
   return 
1;   

Reply
#10

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
PHP код:
CMD:aduty(playeridparams[])   
{   
   if(
PlayerInfo[playerid][pAdmin] >1)   
   {   
          if(
onduty[playerid] == false)   
          {   
                 
SendClientMessage(playerid, -1"Good Luck on your duties!");   
                 
onduty[playerid] = true;   
          }   
          else   
          {   
                 
SendClientMessage(playerid, -1"message!");   
                 
onduty[playerid] = false;   
          }         
   }   
   return 
1;   

+REP and thank you , Color white doesn't need to be defined , I saw that somewhere though xd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)