help +rep
#1

Код:
if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
error:
Код:
argument type mismatch (argument 1)
Reply
#2

pawn Код:
if(sscanf(params,"ud",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
Reply
#3

Код:
if(sscanf(params,"dd",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
Try that.
Reply
#4

Quote:
Originally Posted by nmader
Посмотреть сообщение
pawn Код:
if(sscanf(params,"ud",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
Quote:
Originally Posted by XVlaDX
Посмотреть сообщение
Код:
if(sscanf(params,"dd",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
Try that.
Quote:
Originally Posted by TenTen
Посмотреть сообщение
Код:
if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
The error is on "ui"
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..
Reply
#5

Код:
if(sscanf(params,"ui",pname,adminlvl))return SendClientMessage(playerid,COL_GREEN,"USAGE:/makeadmin [ID] [LEVEL]");
The error is on "ui"
Reply
#6

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
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;
}
here u go
Reply
#7

Removed, dump post
Reply
#8

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
change this
pawn Код:
new adminlvl,pmsg[128],adminmsg[128],string [128],pname,pID,string2[128];
to this
pawn Код:
new adminlvl,pmsg[128],adminmsg[128],string [128],pname[MAX_PLAYER_NAME],pID,string2[128];
You were passing a string as an integer, a name is a string so you must add "[MAX_PLAYER_NAME]" or "[28]" when you pass something to the string.
i still get the same error on the same line
Reply
#9

My bad, that was dump of me but here you go, this should work
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;
}
I just added an [] after params in the first line
Reply
#10

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
My bad, that was dump of me but here you go, this should work
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;
}
I just added an [] after params in the first line
LOL how i didnt notice , thanks man +repped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)