something is wrong ?
#1

Код:
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 © 1997-2006, ITB CompuPhase


4 Warnings.
pawn Код:
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:
pawn Код:
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
Reply
#2

The lines please locate the lines so we can help you ..
Reply
#3

pawn Код:
(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
Reply
#4

pawn Код:
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
Reply
#5

pawn Код:
SendClientMessage(playerid, RED,"Admin Name: %s", GetName(playerid));
SendClientMessage only takes 3 parameters:
- playerid
- colour
- string

The string can first be formatted with:

pawn Код:
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
Reply
#6

Код:
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 © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
format(string, sizeof(string), " Reason: %s\nYour Name: %s\nAdmin Name: %s", reason, , Playername, Adminname);
            SendClientMessage(playerid, RED, string);
What Wrong
Reply
#7

You have an empty parameter in your format
Reply
#8

Quote:
Originally Posted by AYOUYOU
Посмотреть сообщение
Код:
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 © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
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:
pawn Код:
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.
Reply
#9

Thanks +rep
Reply
#10

And this
Код:
reason, , Playername, Adminname
Try
Код:
reason, Playername, Adminname
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)