Need help with /admins, RCON and also text colours.
#1

Hey hey,

Can anyone teach me how to make an /admins command? I'm not a bad scripter, but I've got problems with this. I'm admin in-game, and typing ''/ban'' but it says: ''/ban : you're not an admin'' (from RCON). How do I disable that?

I'm not a bad scripter but got problems with the names and text colours...

Код:
dcmd_banip(playerid, params[])
{
	new index = 0;
  tmp2 = strtok(params, index);
	if (pInfo[playerid][pAdmin] == 3)
	{
		SystemMessage(playerid, "You are not an Administrator.");
		return 1;
	}
  if(!strlen(tmp2))
	{
		SystemMessage(playerid, "Correct usage: '/banip [playername] [reason]'");
		return 1;
	}
	new string[MAX_STRING];
	new second, minute, hour, day, month, year;
	giveplayerid = ReturnUser(tmp2);
	if (IsPlayerConnected(giveplayerid))
	{
		format(string, sizeof(string), "You have been IP banned by Administrator %s. (Reason: '%s')", PlayerName(playerid), params);
		SendClientMessage(giveplayerid, COLOR_SYSTEM, string);
		format(string, sizeof(string), "Player %s has been IP banned by Administrator %s. (Reason: '%s')", PlayerName(giveplayerid), PlayerName(playerid), params);
		SendClientMessageToAll(COLOR_SYSTEM, string);
		format(string, sizeof(string), "%s has been IP banned by Administrator %s. (Reason: '%s')", PlayerName(giveplayerid), PlayerName(playerid), params);
		print(string);
		gettime(hour, minute, second);
		getdate(year, month, day);
		format(string,sizeof(string),"Player %s IP banned player %s on %d/%d/%d at %d:%d:%d. (Reason: '%s')", PlayerName(playerid), PlayerName(giveplayerid), month, day, year, hour, minute, second, params);
		ServerLog(string);
		BanPlayer(giveplayerid, "");
  }
  	else
  {
		SendClientMessage(playerid, COLOR_SYSTEM, "That player is not active.");
	}
  return 1;
}
Can someone tell me how to change the text colour? Default is red. And I want it in an other colour, where do I put the ''DEFINE_COLOUR'' ? Please explain.
Reply
#2

Код:
if (pInfo[playerid][pAdmin] == 3)
I'm guessing this is unintended. This would mean if you ARE level 3 admin, you can't use it, but any other level can. It'd be correct as

Код:
if (pInfo[playerid][pAdmin] < 3)
Reply
#3

Код:
#define COLOR_SYSTEM 0x0000FFAA //blue
just place it somewhere above in the script like under the includes or something...

and this means if player is not 3:

Код:
if (pInfo[playerid][pAdmin] != 3)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)