Help! -
Syntax - 03.08.2011
if (strcmp(cmd, "/heal", true) ==0)
{
SetPlayerHealth(playerid, 100);
}
Can someone tell me what is wrong in this command because when I'm trying to compile it i've got the following error:
D:\random server\gamemodes\hts.pwn(235) : error 010: invalid function or declaration
Re: Help! -
Cameltoe - 03.08.2011
Use zcmd
alot easier to use.
pawn Код:
command(heal, playerid, params[])
{
SetPlayerHealth(playerid, 100);
return 1;
}
Though :
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/heal", true, 5))
{
SetPlayerHealth(playerid, 100);
}
return 1;
}
Compiles here!
Re: Help! -
dr.pepper - 03.08.2011
Quote:
Originally Posted by Syntax
if (strcmp(cmd, "/heal", true) ==0)
{
SetPlayerHealth(playerid, 100);
}
Can someone tell me what is wrong in this command because when I'm trying to compile it i've got the following error:
D:\random server\gamemodes\hts.pwn(235) : error 010: invalid function or declaration
|
pawn Код:
if (strcmp(cmd, "/heal", true) ==0)
{
SetPlayerHealth(playerid, 100);
return 1;
}
Re: Help! -
Syntax - 03.08.2011
Ok, let me give a try.
EDIT: I've got two errors now with strcmp, but with zcmd none.
Re: Help! -
Syntax - 03.08.2011
I have just checked out the previous posts, also I'd like to know why the length is set to 3.
Quote:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/heal", true, 3))
{
SetPlayerHealth(playerid, 100);
}
return 1;
}
|
Re: Help! -
dr.pepper - 03.08.2011
He probably set a random length array. As some people actually put in random numbers.
Re: Help! -
Cameltoe - 03.08.2011
Quote:
Originally Posted by dr.pepper
He probably set a random length array. As some people actually put in random numbers.
|
Yes, its an random length, though heal + / should be 5. My bad.
Re: Help! -
Calgon - 03.08.2011
Quote:
Originally Posted by Syntax
Ok, let me give a try.
EDIT: I've got two errors now with strcmp, but with zcmd none.
|
Try change the rest of your commands to zcmd, if you're unable to, post the error code lines with the error messages.
Quote:
Originally Posted by dr.pepper
He probably set a random length array. As some people actually put in random numbers.
|
Parameter 4 in strcmp is the length of a string, not a 'length array' or anything relative of an array. I think you're confusing arrays as strings, a
string is used to hold a set of alphanumerical characters (well, symbols too), and arrays are used to hold data that require more than 1 dimension.
Re: Help! -
Syntax - 03.08.2011
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/heal", true, 3))
{
SetPlayerHealth(playerid, 100);
}
return 1;
}
This actually works and I'm able to compile it in pawn compiler but when I'm getting in-game the command doesn't exist. What should I do in order to make it work? I would really appreciate that.
Re: Help! -
Syntax - 03.08.2011
Uh seems like I really have a new errror:
D:\random server\gamemodes\hts.pwn(236) : error 021: symbol already defined: "OnPlayerCommandText"