SA-MP Forums Archive
Help, Please? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help, Please? (/showthread.php?tid=153875)



Help, Please? - Tnt12340 - 11.06.2010

Код:
if (strcmp(cmd, "/staff", true) == 0)
{
  SendClientMessage(playerid, COLOR_GREY, "Admins Online:");
  for(new i = 0; i <= MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i) == 1 && PlayerInfo[i][pAdmin] > 0)
    {
      GetPlayerName(i, sendername, sizeof(sendername));
      format(string, 256, "%s - %s", sendername,PlayerInfo[i][pAdminDuty]);
      SendClientMessage(playerid, COLOR_WHITE, string);
    }
  return 1;
	}
}
I'm needing it to say example:

Spencer_Hunt [On Duty] if they're on duty,
and
Spencer_Hunt [Off Duty] if they're off duty.

Thanks!

- Eric

P.S:

If pAdminDuty is 0 they're off duty.
If pAdminDuty is 1 they're on duty.

Thanks!


Re: Help, Please? - Tnt12340 - 11.06.2010

Bump; This is rather important.


Re: Help, Please? - TheInnocentOne - 11.06.2010

I don't completely understand what you want...

Does "Spencer_Hunt [On Duty]" or "Spencer_Hunt [Off Duty]" have to be their name?


Re: Help, Please? - ViruZZzZ_ChiLLL - 11.06.2010

pawn Код:
if(strcmp("/onduty", cmdtext, true, 7) == 0)
{
 if(IsPlayerAdmin(playerid)){
 new name[MAX_PLAYER_NAME];
 GetPlayerName(playerid, name, sizeof(name));
 new string[56];
 format(string, sizeof(string), "%s is now on duty!", name);
 SendClientMessageToAll(Color, string);
 return 1;
}



Re: Help, Please? - DJDhan - 11.06.2010

Код:
if(strcmp("/duty", cmdtext, true, 5) == 0)
{
if(!IsPlayerCop[playerid]) return SendClientMessage(playerid,0x0000ffaa,"You are not a COP"); //just an eg, check if a player is a cop or whatever
 new name[MAX_PLAYER_NAME];
 GetPlayerName(playerid, name, sizeof(name));
 new string[128]; new tmp[56], Index;
 tmp=strtok(cmdtext,Index);
 if(!strcmp(tmp,"on",true,2))
 {
 format(string, sizeof(string), "%s is now on duty!", name);
 }
 else if(!strcmp(tmp,"off",true,3))
 {
 format(string, sizeof(string), "%s is now off duty!", name);
 }
 SendClientMessageToAll(Color, string);
 return 1;
}



Re: Help, Please? - WardenCS - 11.06.2010

i think he ment if ya write /staff,you can see whos on duty and whos not


Re: Help, Please? - Tnt12340 - 11.06.2010

Aye, What Fog said;

I'm not needing an command to go on duty, i'm needing a command that shows online staff and who's on duty, and who's not.


Re: Help, Please? - DJDhan - 11.06.2010

Oh yeah my bad

Код:
if (!strcmp(cmdtext, "/staff", true, 6))
{
	new sendername[128], string[128];
	SendClientMessage(playerid, COLOR_GREY, "Admins Online:");
	for(new i = 0; i <= MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
		{
			GetPlayerName(i, sendername, sizeof(sendername));
			if(PlayerInfo[i][pAdminDuty]==0)
			{
				format(string, sizeof(string), "%s is off duty.", sendername);
			}
			else if(PlayerInfo[i][pAdminDuty]==1)
			{
				format(string, sizeof(string), "%s is on duty.", sendername);
			}
			SendClientMessage(playerid, COLOR_WHITE, string);
		}
	}
	return 1;	
}