SA-MP Forums Archive
argument type mismatch (argument 3) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: argument type mismatch (argument 3) (/showthread.php?tid=658913)



argument type mismatch (argument 3) - AlfaSufaIndo - 16.09.2018

Help me, i got error on line 23 and 31 in DCC.inc
PHP код:
public SendDC(channel[], const fmat[], va_args<>)
{
    new
        
str[145];
    
va_format(strsizeof (str), fmatva_start<2>); //23
    
BotChannel DCC_FindChannelById(channel);
    return 
DCC_SendChannelMessage(BotChannelstr);
}
public 
SendDCByName(channel[], const fmat[], va_args<>)
{
    new
        
str[145];
    
va_format(strsizeof (str), fmatva_start<2>); //31
    
BotChannel DCC_FindChannelByName(channel);
    return 
DCC_SendChannelMessage(BotChannelstr);




Re: argument type mismatch (argument 3) - Dayrion - 16.09.2018

You can't modify constant variable (string, Float, intenger or w/e). Remove const keyword on both function header.


Re: argument type mismatch (argument 3) - AlfaSufaIndo - 16.09.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
You can't modify constant variable (string, Float, intenger or w/e). Remove const keyword on both function header.
I got error like this:
Код:
function heading differs from prototype (Line 19)
function heading differs from prototype (Line 27)
PHP код:
public SendDC(channel[], fmat[], va_args<>) //19
{
    new
        
str[145];
    
va_format(strsizeof (str), fmatva_start<2>);
    
BotChannel DCC_FindChannelById(channel);
    return 
DCC_SendChannelMessage(BotChannelstr);
}
public 
SendDCByName(channel[], fmat[], va_args<>)//27
{
    new
        
str[145];
    
va_format(strsizeof (str), fmatva_start<2>);
    
BotChannel DCC_FindChannelByName(channel);
    return 
DCC_SendChannelMessage(BotChannelstr);




Re: argument type mismatch (argument 3) - Dayrion - 16.09.2018

You have to edit the forwarded prototype when you are editing the prototype of the public function


Re: argument type mismatch (argument 3) - AlfaSufaIndo - 16.09.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
You have to edit the forwarded prototype when you are editing the prototype of the public function
Ohh it fixed... sorry, i forgot to remove "const" at "forward", i just remove "const" at public lol


Re: argument type mismatch (argument 3) - Dayrion - 16.09.2018

Quote:
Originally Posted by AlfaSufaIndo
Посмотреть сообщение
Ohh it fixed... sorry, i forgot to remove "const" at "forward", i just remove "const" at public lol
That's what I said with different words :P