Makeadmin filterscript problem.
#1

Hello. I have tried to make a makeadmin command.
I compiled it, but I got a warning saying:
Код:
 warning 235: public function lacks forward declaration (symbol "OnPlayerCommandtext")
This makes my filterscript not work.

Here is the script
Код:
public OnPlayerCommandtext(playerid, cmdtext[])
{
	new cmd[256], idx;
	cmd = strtok(cmdtext, idx);
	if(strcmp(cmd, "/makeadmin", true) == 0)
	{
	    new string[128];
	    new tmp[256];
	    new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
	    new giveplayerid;
	    if(IsPlayerAdmin(playerid))
	    {
	        tmp = strtok(cmdtext, idx);
	        if(!strlen(tmp))
	        {
	            SCM(pid, -1, "SYNTAX: /makeadmin [playerid/PartOfName] [level]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			new level = strval(tmp);
			if(giveplayerid != INVALID_PLAYER_ID)
			{
			    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			    GetPlayerName(pid, player, sizeof(player));
			    PlayerInfo[giveplayerid][AdminLevel] = level;
			    printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
			    format(string, sizeof(string), " You have been promoted to a level %d admin by %s. Use /ah for help.");
			    SCM(giveplayerid, COLOR_LIGHTBLUE, string);
			    format(string, sizeof(string), " You have promoted %s to a level %d admin.");
       			SCM(pid, COLOR_LIGHTBLUE, string);
			}
			else if(giveplayerid == INVALID_PLAYER_ID)
			{
			    format(string, sizeof(string), "%i is not an active player.");
			    SCM(pid, -1, string);
			}
		}
		else
		{
	    SCM(pid, -1, ADMIN_MESSAGE);
		}
      	return 1;
	}

	return 0;

}

			    
#endif
Reply
#2

OnPlayerCommandText
Reply
#3

Barely saw it. Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)