SA-MP Forums Archive
need help - 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: need help (/showthread.php?tid=617449)



need help - Gotham - 21.09.2016

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.


Re: need help - ReshiramZekrom - 21.09.2016

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


Re: need help - Gotham - 21.09.2016

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


Re: need help - ReshiramZekrom - 21.09.2016

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


Re: need help - Gotham - 21.09.2016

How do I toggle it off?


Re: need help - ReshiramZekrom - 21.09.2016

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
   } 




Re: need help - ReshiramZekrom - 21.09.2016

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;




Re: need help - Gotham - 21.09.2016

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



Re: need help - SyS - 21.09.2016

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;   




Re: need help - Gotham - 21.09.2016

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