Help at making /CMD [ID] [SOMETHING ELSE] commands
#1

I made this MakeAdmin cmd here:

Код:
CMD:makeadmin(playerid, params[])
{
	if(IsPlayerAdmin(playerid))
	{

		if(isnull(params))
 		{
 		    SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /Makeadmin [ID] [Level]");
 		    return 1;
		}
                if(!isnumeric(params))
 		{
 		    SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /Makeadmin [ID] [Level]");
 		    return 1;
		}
		
		new targetid = strval(params);
		new SendMSG[180];
		new SendMSGtoall[180];
		new SendMSGtoguy[180];
		new Givername[MAX_PLAYER_NAME];
		new Receivername[MAX_PLAYER_NAME];
		new levelz;
		sscanf(params," i",levelz);
		if(levelz > 5)
		{
			SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Max admin level is 5!");
			return 1;
		}
		GetPlayerName(playerid,Givername,sizeof(Givername));
		GetPlayerName(targetid,Receivername,sizeof(Receivername));
		format(SendMSGtoguy,sizeof(SendMSGtoguy),"{B900EF}Admin %s(%d) has made you an Administrator level %d!",Givername,playerid,levelz);
		format(SendMSG,sizeof(SendMSG),"{B900EF}You made %s(%d) an Admin level %d!",Receivername,targetid,levelz);
		format(SendMSGtoall,sizeof(SendMSGtoall),"{B900EF}Admin %s(%d) has made %s(%d) an Admin! Level:%d",Givername,playerid,Receivername,targetid,levelz);
		SendClientMessage(targetid,COLOR_WHITE,SendMSG);
		SendClientMessageToAll(COLOR_WHITE,SendMSGtoall);
		SendClientMessage(targetid,COLOR_WHITE,SendMSGtoguy);
                AdminLevel[playerid] = levelz;
                return 1;
}
	else return 0;
}
But the level is the same than the id i put in! i even put the space at sscanf so it wont take the first param but it does! how to fix it?
Reply


Messages In This Thread
Help at making /CMD [ID] [SOMETHING ELSE] commands - by henry jiggy - 18.09.2011, 14:55
Re: Help at making /CMD [ID] [SOMETHING ELSE] commands - by =WoR=Varth - 18.09.2011, 14:57
Re: Help at making /CMD [ID] [SOMETHING ELSE] commands - by henry jiggy - 18.09.2011, 14:59
Re: Help at making /CMD [ID] [SOMETHING ELSE] commands - by _ELIX_ - 18.09.2011, 16:30
Re: Help at making /CMD [ID] [SOMETHING ELSE] commands - by Issam - 18.09.2011, 16:32

Forum Jump:


Users browsing this thread: 1 Guest(s)