Argument type mismatch on BanEx?
#1

Hey, I made a ban command for my friend because he dont trust any other admin systems so i wanted to make one for him
He dont know how to use dcmd so i made it with strtok.

But when i try to compile it it says:
Код:
C:\Users\Administrator\Desktop\Server\admin.pwn(71) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Heres the code: (What am i doing wrong? )
pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
{
  new tmp[128];
  new tmp2[128];
  new id;
  new reason;

  tmp = strtok(cmdtext, idx);
  tmp2 = strtok(cmdtext, idx);
  id = strval(tmp);
  reason = strval(tmp2);

  BanEx(id, reason);
  return 1;
}
Reply
#2

reason must be a Array
Reply
#3

I do like this:
Код:
new reason[64];
and
Код:
reason = strval(tmp2);//Error on this row
Then i compile, i get
Код:
error 033: array must be indexed (variable "reason")
-------------------------------------------------------------------

Then i do like this:
Код:
new reason[64];
and
Код:
reason[64] = strval(tmp2);//Error on this row
Then i compile, i get
Код:
error 032: array index out of bounds (variable "reason")
Reply
#4

Quote:
Originally Posted by BlackFoX_UD_
reason must be a Array
hes right, but heres what you need:

pawn Код:
new reason; //remove this line, you dont need it

reason = strval(tmp2); //you dont need this either now

BanEx(id, tmp2); //change reason to tmp2
Reply
#5

Quote:
Originally Posted by DavidC
Quote:
Originally Posted by BlackFoX_UD_
reason must be a Array
hes right, but heres what you need:

pawn Код:
new reason; //remove this line, you dont need it

reason = strval(tmp2); //you dont need this either now

BanEx(id, tmp2); //change reason to tmp2
Thanks
Reply


Forum Jump:


Users browsing this thread: