Need help with dcmd
#1

I cant figure out what Iґve made wrong..

Код:
dcmd_aduty(playerid, params[])
{
	new	string[128], name[MAX_PLAYER_NAME];
	if (sscanf(params)) SendClientMessage(playerid, COLOR_GREY, "|| Usage: /aduty ||");
	else
	{
	  if(PlayerInfo[playerid][AdminLevel]>=g_Level[lsay])
	  {
	  	GetPlayerName(playerid, name, sizeof(name));
	  	format(string, sizeof(string), "|| Administrator %s is now on ADMIN DUTY - dont shoot him! ||", name); // You will probably want to re-format this.
	  	SendClientMessageToAll(COLOR_ORANGE, string);
	  	SetPlayerHealth(playerid,9999999999.9);
	  	SetPlayerColor(playerid,COLOR_BLACK);
	  	SetPlayerSkin(playerid,186);
	  	adminduty = true;
	  }
	  else
	  {
	    SendClientMessage(playerid, COLOR_ORANGE, "You're not the needed admin level");
	  }
	}
	return 1;
}

dcmd_saduty(playerid, params[])
{
	new	string[128], name[MAX_PLAYER_NAME];
	if (sscanf(params)) SendClientMessage(playerid, COLOR_GREY, "|| Usage: /saduty ||");
	else
	{
	  if(PlayerInfo[playerid][AdminLevel]>=g_Level[lsay])
	  {
	  	SetPlayerHealth(playerid,9999999999.9);
	  	SetPlayerColor(playerid,COLOR_BLACK);
	  	SetPlayerSkin(playerid,186);
	  	adminduty = true;
	  }
	  else
	  {
	    SendClientMessage(playerid, COLOR_ORANGE, "You're not the needed admin level");
	  }
	}
	return 1;
}


dcmd_adutyoff(playerid, params[])
{
	new	string[128], name[MAX_PLAYER_NAME];
	if (sscanf(params)) SendClientMessage(playerid, COLOR_GREY, "|| Usage: /adutyoff ||");
	else
	{
	  if(PlayerInfo[playerid][AdminLevel]>=g_Level[lsay])
	  {
	  	GetPlayerName(playerid, name, sizeof(name));
	  	format(string, sizeof(string), "|| Administrator %s is now off admin duty enjoying the game. ||", name); // You will probably want to re-format this.
	  	SendClientMessageToAll(COLOR_ORANGE, string);
	  	SetPlayerHealth(playerid,100);
	  	SetPlayerColor(playerid,COLOR_GREY);
	  	SetPlayerSkin(playerid,283);
	  	adminduty = false;
	  }
	  else
	  {
	    SendClientMessage(playerid, COLOR_ORANGE, "You're not the needed admin level");
	  }
	}
	return 1;
}
Reply
#2

You don't need to use sscanf nor params since your command is only '/a...' and not something with additional parameters like '/admin on'.

Just add
pawn Код:
#pragma unused params
and delete sscanf from your commands.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)