command /setlevel
#1

Hi guys,
I am new in scripting and I need help for this command.I write in server /setlevel 0 5 and return UNKNOW COMMAND.

Код:
dcmd_setlevel(playerid,params[])
{
	new id,lvl,string[128];
	if(PInfo[playerid][Level] < 5) return SendClientMessage(playerid,red,error);
	if(sscanf(params,"ui",id,lvl)) return SendClientMessage(playerid,green2,"USAGE: "lyellow2"/setlevel <id> <level>");
	if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,red,notconnected);
	format(string,sizeof(string),"*** %s(ID:%d) has set your admin level to %d!",GetPName(playerid),playerid,lvl);
	SendClientMessage(id,green,string);
	if(PInfo[id][Level] < lvl)
	{
	    GameTextForPlayer(id,"~g~~h~~h~Promoted!",4000,3);
	    PlaySound(id,1057);
	}
	if(PInfo[id][Level] > lvl)
	{
	    GameTextForPlayer(id,"~r~~h~Demoted!",4000,3);
	    PlaySound(playerid,1085);
	}
	format(string,sizeof(string),"*** You've set %s(ID:%d)'s level to %d!",GetPName(id),id,lvl);
	SendClientMessage(playerid,green,string);
	PInfo[id][Level] = lvl;
	return 1;
}
Reply
#2

Did you added:

pawn Код:
dmcd(setlevel,35,cmdtext) //35, should you use the newest sscanf plugin bcz the MAX_PLAYER_NAME lenght, otherwise 12
under the Callback:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
??
Reply
#3

@ulbi1990 Ty for help +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)