PDA

View Full Version : argument type mismatch.


SukMathcuck
09/12/2016, 01:22 PM
Hello everyone, I have a question, should I add "[]" in stock?

stock CriarPersonagem(playerid, nome[])

stock CriarPersonagem(playerid, nome)


stock CriarPersonagem(playerid, nome)
{
new
nome[60];

format(nome, sizeof(nome), "debug: %s", nome);
SendClientMessage(playerid, -1, nome);
}

new nome[40];
strmid(nome, inputtext, 0, strlen(inputtext), 255);
CriarPersonagem(playerid, nome); //error



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

I am a beginner and I am learning from you.

SyS
09/12/2016, 01:30 PM
yes you need and also dont define the variable nome in definition as it passed to function as arguement already

GangstaaSunny
09/12/2016, 01:36 PM
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

stock CriarPersonagem(playerid, nome[])//nome is already defined now
{
format(nome, sizeof(nome), "debug: %s", nome);//here we are using the defined variable
SendClientMessage(playerid, -1, nome);
}

Vince
09/12/2016, 02:31 PM
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.

SukMathcuck
09/12/2016, 02:49 PM
Thanks Sreyas, GangstaaSunny and Vince, helped me and also will take possible doubts of newbies, closed topic, doubts withdrawals.


@edit

C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(5748) : error 010: invalid function or declaration
C:\Users\User\Desktop\San Andreas Multiplayer\gamemode RP\gamemodes\gamemode.pwn(5748) : 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 (c) 1997-2006, ITB CompuPhase


4 Errors.

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

A question, what is the stock for?

GoldenLion
09/12/2016, 02:51 PM
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?
http://forum.sa-mp.com/showthread.php?t=570635

Dayrion
09/12/2016, 03:21 PM
Please, remove stock if you are using the function.
Show the line where you have errors.