error 035: argument type mismatch (argument 2)
#1

I added a new command to my gamemode and i got this error
Код:
CMD:announce(playerid, params[])
{

    if(!IsPlayerAdmin(playerid))
	return SendClientMessage(playerid, "You are not allowed to use this command");
    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
    SendClientMessage( playerid,"Usage: /announce <style[0-6]> <time in ms> <text>");
    if (strlen(text) > 64) return
    SendClientMessage(playerid,"Message too long please shorten it ");
    if(style == 2) return SendClientMessage(playerid,"Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
    SendClientMessage(playerid,0xFF0000FF,"Invalid style");
    if (time > 20*1000) return
    SendClientMessage(playerid,"No longer than 20 seconds");
    GameTextForAll(text, time, style);

    return 1;
}
Error :
Код:
 
C:\Users\Loed\Desktop\LOD.pwn(33184) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33187) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33189) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33190) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33194) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Help please
Reply
#2

https://sampwiki.blast.hk/wiki/SendClientMessage

You forgot about colour.
Reply
#3

Here you go:
Код:
CMD:announce(playerid, params[])
{

    if(!IsPlayerAdmin(playerid))
	return SendClientMessage(playerid, -1, "You are not allowed to use this command");
    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
    SendClientMessage( playerid, -1, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (strlen(text) > 64) return
    SendClientMessage(playerid,"Message too long please shorten it ");
    if(style == 2) return SendClientMessage(playerid, -1, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
    SendClientMessage(playerid,0xFF0000FF,"Invalid style");
    if (time > 20*1000) return
    SendClientMessage(playerid, -1, "No longer than 20 seconds");
    GameTextForAll(text, time, style);

    return 1;
}
SendClientMessage requires a color as second parameter.
Reply
#4

Thank You so much @L97 and @Misiur +Rep to both of you <3
Reply
#5

PHP код:
return SendClientMessage(playerid"You are not allowed to use this command"); 
PHP код:
SendClientMessage(playerid,"Message too long please shorten it "); 
You are missing the colour it should be for example
PHP код:
SendClientMessage(playerid, -1"string"); //replace -1 
where -1 is a colour.

error 035 is always argument type mismatch so go through that code and make sure you haven't missed anything out.
you can see it says argument 2

SendClientMessage(1playerid,"3Message too long please shorten it ");

you are missing argument 2 so it should be:

SendClientMessage(1playerid,2-1,"3Message too long please shorten it ");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)