undefined symbol "playerid" please help me
#1

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
Reply
#2

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
Reply
#3

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");
Reply
#4

Pretty obvious to work out:

SendClientMessage(playerid, COL_RED, "No Hacking");

->
SendClientMessage(i, COL_RED, "No Hacking");
Reply
#5

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!
Reply
#6

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
Reply
#7

pawn Код:
#define COL_RED 0xFF0000FF
Reply
#8

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:

pawn Код:
#define COL_RED 0xF81414
Reply
#9

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:

pawn Код:
#define COL_RED 0xF81414
But if i change the way i define my colours i get a lot of errors


Thank You


Please Help Me Please
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)