undefined symbol "playerid" please help me -
Scripter12345 - 23.04.2012
Why is this giving me this error
pawn Код:
forward AntiCheat();
public AntiCheat()
{
foreach(Player, i)
{
new weap = GetPlayerWeapon(i);
if(weap > 0 && Weapon[i][weap] == false)
{
if(GetPlayerState(i) == 1 || GetPlayerState(i) == 2 || GetPlayerState(i) == 3) {
SendClientMessage(playerid, COL_RED, "No Hacking");
//ban or warning code here
//Ban or warning code here
//ban or warning code here
//Ban or warning code here
//ban or warning code here
}
}
}
return 1;
}
pawn Код:
error 017: undefined symbol "playerid"
Thank You
Please Help Me Please
Re: undefined symbol "playerid" please help me -
Scripter12345 - 23.04.2012
Quote:
Originally Posted by .FuneraL.
pawn Код:
forward AntiCheat(playerid); public AntiCheat(playerid) { foreach(Player, i) { new weap = GetPlayerWeapon(i); if(weap > 0 && Weapon[i][weap] == false) { if(GetPlayerState(i) == 1 || GetPlayerState(i) == 2 || GetPlayerState(i) == 3) { SendClientMessage(playerid, COL_RED, "No Hacking"); //ban or warning code here //Ban or warning code here //ban or warning code here //Ban or warning code here //ban or warning code here
} } } return 1; }
Try This.
|
Now i am getting this error
pawn Код:
error 035: argument type mismatch (argument 2)
Thank You
Please Help Me Please
Re: undefined symbol "playerid" please help me -
JaTochNietDan - 23.04.2012
Quote:
Originally Posted by Scripter12345
Now i am getting this error
pawn Код:
error 035: argument type mismatch (argument 2)
Thank You
Please Help Me Please
|
On what line? Also what is the purpose of the callback having a playerid parameter if it's never going to be used since you loop through all players anyway?
Also SendClientMessage should be using the i variable for the playerid argument:
pawn Код:
SendClientMessage(i, COL_RED, "No Hacking");
Re: undefined symbol "playerid" please help me -
MP2 - 23.04.2012
Pretty obvious to work out:
SendClientMessage(playerid, COL_RED, "No Hacking");
->
SendClientMessage(
i, COL_RED, "No Hacking");
Re: undefined symbol "playerid" please help me -
JaTochNietDan - 23.04.2012
Okay, so what is "COL_RED" defined as in your script? Because it's clearly not a valid colour, that's why it's telling you "error 035: argument type mismatch (argument 2)", because you have an argument type mismatch and it's on argument 2 of the function on that line.
This is how you learn to debug code yourself, you learn to understand the errors!
Re: undefined symbol "playerid" please help me -
Scripter12345 - 23.04.2012
Quote:
Originally Posted by JaTochNietDan
Okay, so what is "COL_RED" defined as in your script? Because it's clearly not a valid colour, that's why it's telling you "error 035: argument type mismatch (argument 2)", because you have an argument type mismatch and it's on argument 2 of the function on that line.
This is how you learn to debug code yourself, you learn to understand the errors!
|
#define COL_RED "{F81414}"
Thank You
Please Help Me Please
Re: undefined symbol "playerid" please help me -
.FuneraL. - 23.04.2012
pawn Код:
#define COL_RED 0xFF0000FF
Re: undefined symbol "playerid" please help me -
JaTochNietDan - 23.04.2012
Quote:
Originally Posted by Scripter12345
#define COL_RED "{F81414}"
Thank You
Please Help Me Please
|
Well there's your problem, I don't see why you are wrapping it in brackets like that, it is not a valid colour format that the SendClientMessage function uses.
You should be using this for SendClientMessage colours:
Re: undefined symbol "playerid" please help me -
Scripter12345 - 23.04.2012
Quote:
Originally Posted by JaTochNietDan
Well there's your problem, I don't see why you are wrapping it in brackets like that, it is not a valid colour format that the SendClientMessage function uses.
You should be using this for SendClientMessage colours:
|
But if i change the way i define my colours i get a lot of errors
Thank You
Please Help Me Please
Re: undefined symbol "playerid" please help me -
JaTochNietDan - 23.04.2012
Quote:
Originally Posted by Scripter12345
But if i change the way i define my colours i get a lot of errors
Thank You
Please Help Me Please
|
That's because obviously you use that colour for other functions too that require other formats. Just make a separate define for the colour for SendClientMessage.
I'm sure you could come up with a solution to make them work both ways, but I don't think your PAWN knowledge level is high enough to work with that, so stick with the basics. Make a new define for red for SendClientMessage.