argument type mismatch.
#1

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.
Reply
#2

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

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); 

Reply
#4

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.
Reply
#5

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?
Reply
#6

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
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)