help please
#1

Hey guys. I want to make a /setstat playerid statname ammount command.
It doesn't work.

I have this:
pawn Код:
dcmd_setstat(playerid,params[])
{
new ammount,statname,ID;
if(adminlevel[playerid]<=2)

{
SendClientMessage(playerid,COLOR_RED,"Je mag dit niet doen");
return 1;
}

if(sscanf(params,"usd",ID,statname,ammount))
{
SendClientMessage(playerid,COLOR_GREY,"Gebruik /setstat [playerid] [stat] [ammount]");
return 1;
}

if(statname == "money")
{

}

return 1;
}
This:
pawn Код:
if(statname == "money")
{

}
Doesn't work. It says:
Код:
C:\Users\Bart\Desktop\Rubenbart server\gamemodes\SunlightRPG.pwn(559) : error 033: array must be indexed (variable "-unknown-")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

maybe return 1; in the statname?
Reply
#3

Nope. That's not it
Reply
#4

Please, only reply when you actually know what you're doing.
pawn Код:
if(!strcmp(statname, "money", true))
Dit forum vereist dat je 120 seconden wacht tussen het verzenden van berichten. Probeer het nogmaals over 5 seconden. <= Argh
Reply
#5

if(!strcmp(statname, "money", true))
{

}


Код:
C:\Users\Bart\Desktop\Rubenbart server\gamemodes\SunlightRPG.pwn(559) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
ty for helping btw
Reply
#6

All you have to do is give the variable statname an array value. This can be done by changing new statname; to new statname[20];.
Reply
#7

lol works. Thanks
Reply
#8

Quote:
Originally Posted by Micheliano
Посмотреть сообщение
i told u -.-
NOpe. I had it with:
pawn Код:
if(statname == "money")
{

}
That is why it didn't worked
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)