Whats wrong? -
Tutrix - 16.12.2010
Hello, i am making a /settalk cmd. And i get a strange error,
this is the command
pawn Код:
command(settalk, playerid, params, cmdtext, idx[])
{
if(IsPlayerConnected(playerid))
{
new settalk[128];
settalk = strtok(cmdtext, idx);
if(!strlen(settalk)) {
SendClientMessage(playerid, WHITE, "USAGE: /settalk 1-5");
return 1;
}
else if(strcmp(settalk,"1", true) == 0)
{
settalk1[playerid] = 1;
SendClientMessage(playerid, WHITE, " Chat style has been set!");
}
}
return 1;
}
Код:
error 035: argument type mismatch (argument 1)
Thanks, Alex
Re: Whats wrong? -
Tutrix - 17.12.2010
it is the
pawn Код:
settalk = strtok(cmdtext, idx);
thats what it says that is wrong
Re: Whats wrong? -
XePloiT - 17.12.2010
the idx is does not suppose to be a string...replace idx[] with idx...
Re: Whats wrong? -
Tutrix - 17.12.2010
Thanks, i will try when i get home

And i will get back to you how it went, thanks
Re: Whats wrong? -
Tutrix - 17.12.2010
Still dosent work,
pawn Код:
command(settalk, playerid, idx, cmdtext, params [])
{
if(IsPlayerConnected(playerid))
{
new settalk[128];
settalk = strtok(idx, cmdtext);
if(!strlen(settalk)) {
SendClientMessage(playerid, WHITE, "USAGE: /settalk 1-5");
return 1;
}
else if(strcmp(settalk,"1", true) == 0)
{
settalk1[playerid] = 1;
SendClientMessage(playerid, WHITE, " Chat style has been set!");
}
}
return 1;
}
Still the same error,
Re: Whats wrong? -
Kaylux - 17.12.2010
Same error?
and you are defining idx like this?
Re: Whats wrong? -
Tutrix - 17.12.2010
no i didnt :S but when i do that i get more errors/warnings
Код:
C:\Users\Jesus\Downloads\Script\lgrp\gamemodes\chrp.pwn(23410) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Jesus\Downloads\Script\lgrp\gamemodes\chrp.pwn(23415) : error 035: argument type mismatch (argument 1)
C:\Users\Jesus\Downloads\Script\lgrp\gamemodes\chrp.pwn(23418) : warning 217: loose indentation
C:\Users\Jesus\Downloads\Script\lgrp\gamemodes\chrp.pwn(23423) : warning 217: loose indentation
C:\Users\Jesus\Downloads\Script\lgrp\gamemodes\chrp.pwn(31034) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Re: Whats wrong? -
Kaylux - 17.12.2010
Well, besides the clearness that you're not actually using "idx" and from what it seems you already have it defined somewhere.
pawn Код:
command(settalk, playerid, idx, cmdtext, params [])
{
if(IsPlayerConnected(playerid))
{
new settalk[128];
settalk = strtok(idx, cmdtext);
if(!strlen(settalk))
{
SendClientMessage(playerid, WHITE, "USAGE: /settalk 1-5");
return 1;
}
else if(strcmp(settalk,"1", true) == 0)
{
settalk1[playerid] = 1;
SendClientMessage(playerid, WHITE, " Chat style has been set!");
}
}
return 1;
}
That should be your indentation fixed.
Show the line that your mismatch is on. Makes it easier to slove.
Edit:
Sat and done this:
pawn Код:
new talktype[4][MAX_PLAYERS];
new cmdtext[128];
new idx;
command(settalk, playerid, params [])
{
if(IsPlayerConnected(playerid))
{
new settalk[128];
settalk = strtok(cmdtext, idx);
if(!strlen(settalk))
{
SendClientMessage(playerid, WHITE, "USAGE: /settalk 1-5");
return 1;
}
else if(strcmp(settalk,"1", true) == 0)
{
talktype[0][playerid] = 1;
SendClientMessage(playerid, WHITE, " Chat style has been set!");
}
}
return 1;
}
Re: Whats wrong? -
Tutrix - 17.12.2010
you fixed it but now i get this warnings:
[code]C:\Users\Jesus\Downloads\Script\lgrp\pawno\include \zcmd.inc(83) : warning 219: local variable "cmdtext" shadows a variable at a preceding level
C:\Users\Jesus\Downloads\Script\lgrp\gamemodes\chr p.pwn(12832) : warning 219: local variable "cmdtext" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
[code]
Warning 1:
pawn Код:
public OnPlayerCommandReceived( playerid, cmdtext[ ] )
Warning 2
Re: Whats wrong? -
Kaylux - 17.12.2010
For the first warning. Unless you actually use that function. Just remove it.
For the second. I don't see how that afects it.