SA-MP Forums Archive
argument type mismatch. - 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. (/showthread.php?tid=623998)



argument type mismatch. - SukMathcuck - 09.12.2016

Hello everyone, I have a question, should I add "[]" in stock?

PHP код:
stock CriarPersonagem(playeridnome[]) 
PHP код:
stock CriarPersonagem(playeridnome
PHP код:
stock CriarPersonagem(playeridnome)

    new
        
nome[60];
       
format(nomesizeof(nome), "debug: %s"nome);
    
SendClientMessage(playerid, -1nome);
}
        new 
nome[40];
            
strmid(nomeinputtext0strlen(inputtext), 255);
            
CriarPersonagem(playeridnome); //error 
Quote:

\gamemode RP\gamemodes\gamemode.pwn(5902) : error 035: argument type mismatch (argument 2)

I am a beginner and I am learning from you.


Re: argument type mismatch. - SyS - 09.12.2016

yes you need and also dont define the variable nome in definition as it passed to function as arguement already


Re: argument type mismatch. - GangstaaSunny - 09.12.2016

The variable "nome" has been already defined as you created the stock. You dont need to define it again in order to use it. Its like a standard public where stuff like "playerid, vehicleid, etc." can already be used without using "new playerid" inside of it.


This is the correct format
PHP код:
stock CriarPersonagem(playeridnome[])//nome is already defined now
{  
    
format(nomesizeof(nome), "debug: %s"nome);//here we are using the defined variable
    
SendClientMessage(playerid, -1nome); 




Re: argument type mismatch. - Vince - 09.12.2016

Can we stop calling it "the stock", please? I don't necessarily mind that you use the stock keyword (but if its not necessary it's better that you don't). What I do mind is mangled terminology. There's no such thing as "a stock". It's called a function or a stock function.


Re: argument type mismatch. - SukMathcuck - 09.12.2016

Thanks Sreyas, GangstaaSunny and Vince, helped me and also will take possible doubts of newbies, closed topic, doubts withdrawals.


@edit

Quote:

C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(574 : error 010: invalid function or declaration
C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(574 : error 017: undefined symbol "nome"
C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(5806) : warning 204: symbol is assigned a value that is never used: "str"
C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(21229) : warning 203: symbol is never used: "CriandoPersonagem"
C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(21229) : warning 203: symbol is never used: "str2"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

PHP код:
stock CriarPersonagem(playeridnome[])

    new 
str2[256];
        
format(str2,sizeof(str2),"debug:%s",nome);
       
SendClientMessage(playerid,-1,str2);
    return 
1;

A question, what is the stock for?


Re: argument type mismatch. - GoldenLion - 09.12.2016

Quote:
Originally Posted by SukMathcuck
Посмотреть сообщение
Thanks Sreyas, GangstaaSunny and Vince, helped me and also will take possible doubts of newbies, closed topic, doubts withdrawals.


@edit

A question, what is the stock for?
https://sampforum.blast.hk/showthread.php?tid=570635


Re: argument type mismatch. - Dayrion - 09.12.2016

Please, remove stock if you are using the function.
Show the line where you have errors.