warning 202: number of arguments does not match definition
#1

I have:
pawn Код:
CMD:kick(playerid,params[])
{
    if(PInfo[playerid][Level] < 1) return SendClientMessage(playerid,COLOR_RED,"You are not authorized to use that command.");//Checking if the player has admin level 3, if not it sends him a message.
    new id;//Creating a variable to store the selected id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick <id>");//Checking if the player has selected an id, other wise it sends him a message. We used the "u" specifier, because he can put a name or an id.
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"That player is not connected!");//Checking if the selected user is connected or not.
    Kick(id);
    SendClientMessageToAll(COLOR_LIGHTRED,"AdmCmd: %s has kicked %s, reason: %s", adminname, offender, params[2]);
    return 1;
}
And I get:
Quote:

Team Deathmatch\gamemodes\LTEST.pwn(895) : warning 202: number of arguments does not match definition
Team Deathmatch\gamemodes\LTEST.pwn(895) : warning 202: number of arguments does not match definition
Team Deathmatch\gamemodes\LTEST.pwn(895) : warning 202: number of arguments does not match definition

Line 895 is:
pawn Код:
SendClientMessageToAll(COLOR_LIGHTRED,"AdmCmd: %s has kicked %s, reason: %s", adminname, offender, params[2]);
These errors occur when I put params[2] to display the kick reason.

Does anybody know what's going wrong?
Reply
#2

You have to create a string, and to format it, by puting your text in it.

Then, call SendClientMessageToAll.
Reply
#3

Quote:
Originally Posted by Steeve_Smith
Посмотреть сообщение
You have to create a string, and to format it, by puting your text in it.

Then, call SendClientMessageToAll.
Could you show me?
Reply
#4

pawn Код:
new Text[128];
format(Text,128,"AdmCmd: %s has kicked %s, reason: %s", adminname, offender, params[2]);
SendClientMessageToAll(COLOR_LIGHTRED,Text);
Reply
#5

Quote:
Originally Posted by Gustavo_Araujo
Посмотреть сообщение
pawn Код:
new Text[128];
format(Text,128,"AdmCmd: %s has kicked %s, reason: %s", adminname, offender, params[2]);
SendClientMessageToAll(COLOR_LIGHTRED,Text);
thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)