SA-MP Forums Archive
Helper thing - 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: Helper thing (/showthread.php?tid=646636)



Helper thing - Leomatyx - 20.12.2017

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!


Re: Helper thing - rfr - 20.12.2017

I don't understand what you mean

replace {FFFFFF} with a green hex {00ff00}


Re: Helper thing - aoky - 20.12.2017

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.


Re: Helper thing - Kaperstone - 20.12.2017

HelperDuty[playerid]
with i?
HelperDuty[i]

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


Re: Helper thing - Leomatyx - 20.12.2017

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


Re: Helper thing - aoky - 20.12.2017

My bad.