24.07.2015, 19:00
Код:
if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
Код:
argument type mismatch (argument 1)
if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
argument type mismatch (argument 1)
if(sscanf(params,"ud",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
if(sscanf(params,"dd",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
pawn Код:
|
Код:
if(sscanf(params,"dd",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]"); |
if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
d, i and u isn't the problem and using any will make it work, the only difference between u and i that u checks for the name too, if not it returns an invalid id..
%TOPIC this error's because you added a wrong parameter, for example a string where you should put an integer, Show me the whole function/Command |
CMD:makeadmin(playerid,params) { if(!IsPlayerAnAdmin(playerid,6))return SendClientMessage(playerid,COL_RED,"<!>You are not authorized to use this command!"); new adminlvl,pmsg[128],adminmsg[128],string [128],pname,pID,string2[128]; if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]"); if(adminlvl<0||adminlvl>6)return SendClientMessage(playerid,COL_GREEN,"Please write an acceptable level."); format(pmsg,sizeof(pmsg),"You have been promoted to level %i by Adminstrator %s",adminlvl,PlayerName(playerid)); format(adminmsg,sizeof(adminmsg),"You have promoted %s to level %i",pname,adminlvl); SetPVarInt(pID,"Admin",adminlvl); for(new i=0;i<GetMaxPlayers();i++) { if(IsPlayerConnected(i)) { if(IsPlayerAnAdmin(i,1)) { format(string,sizeof(string),"A: %s [LEVEL %i] used the MAKEADMIN command.",PlayerName(playerid),GetPVarInt(playerid,"Admin")); format(string2,sizeof(string2),"A; %s Has been promoted by Adminstrator %s to Level %i",pname,PlayerName(playerid),adminlvl); SendClientMessage(i,COL_LIGHTBLUE,string); SendClientMessage(i,COL_LIGHTBLUE,string2); } } } SendClientMessage(playerid,COL_LIGHTBLUE,adminmsg); SendClientMessage(pID,COL_LIGHTBLUE,pmsg); return 1; }
change this
pawn Код:
pawn Код:
|
CMD:makeadmin(playerid,params[])
{
if(!IsPlayerAnAdmin(playerid,6))return SendClientMessage(playerid,COL_RED,"<!>You are not authorized to use this command!");
new adminlvl,pmsg[128],adminmsg[128],string [128],pname,pID,string2[128];
if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
if(adminlvl<0||adminlvl>6)return SendClientMessage(playerid,COL_GREEN,"Please write an acceptable level.");
format(pmsg,sizeof(pmsg),"You have been promoted to level %i by Adminstrator %s",adminlvl,PlayerName(playerid));
format(adminmsg,sizeof(adminmsg),"You have promoted %s to level %i",pname,adminlvl);
SetPVarInt(pID,"Admin",adminlvl);
for(new i=0;i<GetMaxPlayers();i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerAnAdmin(i,1))
{
format(string,sizeof(string),"A: %s [LEVEL %i] used the MAKEADMIN command.",PlayerName(playerid),GetPVarInt(playerid,"Admin"));
format(string2,sizeof(string2),"A; %s Has been promoted by Adminstrator %s to Level %i",pname,PlayerName(playerid),adminlvl);
SendClientMessage(i,COL_LIGHTBLUE,string);
SendClientMessage(i,COL_LIGHTBLUE,string2);
}
}
}
SendClientMessage(playerid,COL_LIGHTBLUE,adminmsg);
SendClientMessage(pID,COL_LIGHTBLUE,pmsg);
return 1;
}
My bad, that was dump of me but here you go, this should work
pawn Код:
|