PDA

View Full Version : something is wrong ?


AYOUYOU
28/11/2014, 07:50 PM
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3058) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3060) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3061) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Warnings.

SendClientMessage(playerid, RED,"Reason: %s", reason);
SendClientMessage(playerid, RED,"Admin Name: %s", GetName(playerid));
SendClientMessage(playerid, RED,"Your Name: %s", Playername);
SendClientMessage(playerid, RED,"Admin Name: %s", Adminname);
Full:
YCMD:ban(playerid,params[], help)
{
if(P_Data[playerid][pAdmin] >= 2) {
new PID; //define the playerid we wanna ban
new reason; //the reason, put into a string
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)

if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
return
SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
SendClientMessage(playerid, RED,"================================================== ===");
SendClientMessage(playerid, RED,"You have been banned from this Server!");
SendClientMessage(playerid, RED,"Reason: %s", reason);
SendClientMessage(playerid, RED,"Admin Name: %s", GetName(playerid));
SendClientMessage(playerid, RED,"Your Name: %s", Playername);
SendClientMessage(playerid, RED,"Admin Name: %s", Adminname);
SendClientMessage(playerid, RED,"================================================== ===");
SendClientMessage(playerid, RED,"if you have wroungfully banned or if you want to get a chance to play here again,please press F8 tp make screenhot and make apply in our Forum ");
Ban(PID);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 2 to use that command!"); //return this message
}
return 1;
}
Help plz

MCZOFT
28/11/2014, 07:54 PM
The lines please locate the lines so we can help you ..

silenthill
28/11/2014, 08:02 PM
(playerid, color, const message[])


SendClientMessage(playerid, RED,"Reason: %s", reason);
SendClientMessage(playerid, RED,"Admin Name: %s", GetName(playerid));
SendClientMessage(playerid, RED,"Your Name: %s", Playername);
SendClientMessage(playerid, RED,"Admin Name: %s", Adminname);

number of arguments does not match definition



use format

AYOUYOU
28/11/2014, 08:03 PM
SendClientMessage(playerid, RED,"Reason: %s", reason);
SendClientMessage(playerid, RED,"Admin Name: %s", GetName(playerid));
SendClientMessage(playerid, RED,"Your Name: %s", Playername);
SendClientMessage(playerid, RED,"Admin Name: %s", Adminname);
This is The lines 3058, 3059, 3060, 3061

mamorunl
28/11/2014, 08:05 PM
SendClientMessage(playerid, RED,"Admin Name: %s", GetName(playerid));

SendClientMessage only takes 3 parameters:
- playerid
- colour
- string

The string can first be formatted with:


new string[218], astring[218], anumber;
// imagine astring is "Hello!" and anumber is 5
format(string, sizeof(string), "My text with a string %s and a number: %d", astring, anumber);
SendClientMessage(playerid, COLOUR_WHATEVER, string);
// text now comes out in COLOUR_WHATEVER and the text is: My text with a string Hello! and a number: 5

AYOUYOU
28/11/2014, 08:22 PM
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

format(string, sizeof(string), " Reason: %s\nYour Name: %s\nAdmin Name: %s", reason, , Playername, Adminname);
SendClientMessage(playerid, RED, string);
What Wrong

mamorunl
28/11/2014, 08:27 PM
You have an empty parameter in your format

Beckett
28/11/2014, 08:47 PM
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Bureau\Nouveau dossier (3)\gamemodes\xD.pwn(3059) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

format(string, sizeof(string), " Reason: %s\nYour Name: %s\nAdmin Name: %s", reason, , Playername, Adminname);
SendClientMessage(playerid, RED, string);
What Wrong

You can't use "\n" in SendClientMessage.
Edit:

new str_reason[60],str_name[35],str_aname[35];
format(str_reason,sizeof(str_reason),"Reason: %s.",reason);
format(str_name,sizeof(str_name),"Your Name: %s.",Playername);
format(str_aname,sizeof(str_aname),"Admin Name: %s.",Adminname);
SendClientMessage(playerid,RED,str_reason);
SendClientMessage(playerid,RED,str_name);
SendClientMessage(playerid,RED,str_aname);

This is the classic way of doing it.

AYOUYOU
28/11/2014, 09:05 PM
Thanks +rep

xStunt
28/11/2014, 09:42 PM
And this

reason, , Playername, Adminname

Try

reason, Playername, Adminname