Helper thing
#1

Hello every one, i know that my english isn't that good but i wanna ask you about a thing.
i have a command on my server when i wright "/helpers", it will show me the helpers that are connected on the server.

But i wanna make something new and if the Helper is duty it must show with Green Color so here it is the code and what must be, who can help me i will kiss him xD.

Код:
				if(PlayerInfo[i][pHelper] == 1)
				{
					GetPlayerName(i, sendername,  sizeof(sendername));
					format(string, 256, "{FF6347}%s {FFFFFF}(%d) - Helper Nivel 1", sendername,i);
					SendClientMessage(playerid, COLOR_WHITE, string);
					count++;
				}
And it must be something like this

Код:
				if(PlayerInfo[i][pHelper] == 1)
				{
					GetPlayerName(i, sendername,  sizeof(sendername));
					if (HelperDuty[playerid] == 1) format(string, 256, "{009900}%s {FFFFFF}(%d) - Helper Nivel 1", sendername,i);
					else format(string, 256, "{FF6347}%s {FFFFFF}(%d) - Helper Nivel 1", sendername,i);
					SendClientMessage(playerid, COLOR_WHITE, string);
					count++;
				}
but the problem is here "if (HelperDuty[playerid] == 1)" i must replace playerid with something but i don't know with what...
Thanks!
Reply
#2

I don't understand what you mean

replace {FFFFFF} with a green hex {00ff00}
Reply
#3

Here try this, just re-scripted your code for you.
PHP код:
CMD:helpers(playeridparams[])
{
    new 
str[128];
    for(new 
player 0player MAX_PLAYERSplayer++)
    {
        if(
IsPlayerConnected(player))
        {
              if(
PlayerInfo[playeri][pHelper] == 1)
              {
                  if (
HelperDuty[playeri] == 0)
                  {
                      
format(strsizeof(str), "{DADADA}%s (Off Duty): %s"GetPlayerName(player));
                  }
                  else
                {
                    
format(strsizeof(str), "{008000}%s (On Duty)"GetPlayerName(player));
                }
                
SendClientMessage(playeridCOLOR_WHITEstr);
            }
        }
    }
    return 
1;

Note: Change CMD: to whatever command processer you are using.
Reply
#4

HelperDuty[playerid]
with i?
HelperDuty[i]

Because it seems like in a loop and playerid is probably the one who typed the command.
Reply
#5

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
HelperDuty[playerid]
with i?
HelperDuty[i]

Because it seems like in a loop and playerid is probably the one who typed the command.
Thanks there it is <3
Reply
#6

My bad.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)