Makeadmin command troubles -
Ov3rl0rd - 13.09.2009
Read the 3rd post in this topic
Re: ID 0 not working -
dice7 - 13.09.2009
Show the commands where id 0 doesnt work
Re: ID 0 not working -
Ov3rl0rd - 13.09.2009
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?
Re: Makeadmin command troubles -
dice7 - 13.09.2009
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];
Re: ID 0 not working -
Karlip - 13.09.2009
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;
}
Re: Makeadmin command troubles -
Ov3rl0rd - 13.09.2009
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
Re: Makeadmin command troubles -
dice7 - 13.09.2009
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
Re: Makeadmin command troubles -
Ov3rl0rd - 13.09.2009
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 :/
Re: Makeadmin command troubles -
dice7 - 13.09.2009
And what is the error and on which line ?
Re: Makeadmin command troubles -
Ov3rl0rd - 13.09.2009
SendClientMessageToAll(COLOR_YELLOW, str); AdminLvl = PlayerInfo[giveplayerid][pAdmin]; }
error 006: Must be assigned to an Array