Makeadmin command troubles
#1

Read the 3rd post in this topic
Reply
#2

Show the commands where id 0 doesnt work
Reply
#3

scratch what I said before lol the problem lies in my makeadmin command.

Код:
dcmd_makeadmin(playerid, params[])
{
  new str[128], AdminLvl[128];
	if(IsPlayerConnected(playerid))
	{
	if(PlayerInfo[playerid][pAdmin] == 0) return SystemMsg (playerid, "You must be a admin to use this command!");
  	new giveplayerid = ReturnUser(params);
  	if(sscanf(params, "us", giveplayerid, AdminLvl)) return SystemMsg(playerid, " Usage : /makeadmin [playerid / name] [admin level]");
  	if(!IsPlayerConnected(giveplayerid)) return SystemMsg(playerid, "That player is not connected!");
  else
	{
  format(str, sizeof(str), "ADMIN %s has made %s level %d admin", PlayerName(playerid), PlayerName(giveplayerid), AdminLvl);
  SendClientMessageToAll(COLOR_YELLOW, str); AdminLvl = PlayerInfo[giveplayerid][pAdmin]; }
	}
	return 1;
}
Now this is NOT my coding and am not use to dcmd, so there in lies my problem. I realize the " SendClientMessageToAll(COLOR_YELLOW, str); AdminLvl = PlayerInfo[giveplayerid][pAdmin]; }" is not correct. Any suggestions on fixing this command to make to make it work properly?
Reply
#4

The only problem I see with this code is that you need to do
pawn Код:
PlayerInfo[giveplayerid][pAdmin] = AdminLvl;
instead of
pawn Код:
AdminLvl = PlayerInfo[giveplayerid][pAdmin];
Reply
#5

pawn Код:
dcmd_makeadmin(playerid, params[])
{
  new str[128], AdminLvl[128];
  if(IsPlayerConnected(playerid))
  {
    if(PlayerInfo[playerid][pAdmin] == 0) return SystemMsg (playerid, "You must be a admin to use this command!");
    new giveplayerid = ReturnUser(params);
    if(sscanf(params, "us", giveplayerid, AdminLvl)) return SystemMsg(playerid, " Usage : /makeadmin [playerid / name] [admin level]");
    if(!IsPlayerConnected(giveplayerid)) return SystemMsg(playerid, "That player is not connected!");
    else
    {
        format(str, sizeof(str), "ADMIN %s has made %s level %d admin", PlayerName(playerid), PlayerName(giveplayerid), AdminLvl);
        SendClientMessageToAll(COLOR_YELLOW, str);
        PlayerInfo[giveplayerid][pAdmin]; = AdminLvl;
        }
    }
    return 1;
}
Reply
#6

I have tried both ways and the first time I get an array error saying it needs to be assigned to an array (even though it is) and the second time I get different errors, but its because of the ]; = AdminLvl
Reply
#7

pawn Код:
if(sscanf(params, "us", giveplayerid, AdminLvl))
should be
pawn Код:
if(sscanf(params, "ud", giveplayerid, AdminLvl))
since the admin level is an integer, not string
Reply
#8

Quote:
Originally Posted by dice7
pawn Код:
if(sscanf(params, "us", giveplayerid, AdminLvl))
should be
pawn Код:
if(sscanf(params, "ud", giveplayerid, AdminLvl))
since the admin level is an integer, not string
Even if this is the case, I am still getting the Array error :/
Reply
#9

And what is the error and on which line ?
Reply
#10

SendClientMessageToAll(COLOR_YELLOW, str); AdminLvl = PlayerInfo[giveplayerid][pAdmin]; }
error 006: Must be assigned to an Array
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)