This command isn't working in a copcar. But it should.
#1

Hi everybody !

I've a police command, which is "/p record PLAYERID" to see what contain the record of a specific player.
The thing is that, when I coded it, I missed something at the very beginning I guess.

You can use it only in front of the police computer, or in a police car.


pawn Code:

pawn Код:
else if(strcmp(subcmd, "records", true) == 0 || strcmp(subcmd, "computer", true) == 0)
            {
                if(PlayerInfo[playerid][pMember] == FACT_COPS_LS && !PlayerToPoint(5, playerid,1550.79,-1663.25,-9.19) || IsPlayerInAnyVehicle(playerid) && !IsACopCar(GetPlayerVehicleID(playerid)))
                    {SendClientMessage(playerid, COLOR_COPS, "{FF6600}[Police]{11BB00} You're not in front of the police computer or you're not in a police car."); return 1;}
                tmp=strtok(cmdtext,idx);

For me everything is alright. But still... When a policeman use it in a cop car it says that he's not in front of a police computer or in a cop car.

I have no errors, no warnings, but still, it's buggued o_o
Reply
#2

I'm not a mathematician unfortunatly, this is chinese for me (and I think I understand more chinese than math !).
Is this a problem with the "!" ?
Reply
#3

Ok, I just edited the code with the one you see here, but nothing change..
Can someone provide me some help please ?
Reply
#4

Have you tried debugging it?

Instead of having lots of checks on one line, spread them out and find the problem.

EG:

pawn Код:
if(PlayerInfo[playerid][pMember] == FACT_COPS_LS)
{
    if(!PlayerToPoint(5, playerid,1550.79,-1663.25,-9.19))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(IsACopCar(GetPlayerVehicleID(playerid)))
            {
            }
            else
            {
                printf("<error> Player is not in a cop car");
            {
        }
        else
        {
            print("<error> Player is not in a vehicle");
        }
    }
    else
    {
        print("<error> Player is in range of 1550.79,-1663.25,-9.19");
    }
}
else
{
    printf("<error> Var PlayerInfo[playerid][pMember] == %d", PlayerInfo[playerid][pMember]);
}
It is more code but a million times easier to debug than all in one line. This is just an example you may want that to be structured differently.
Reply
#5

I can't setup it correctly ^^'
I don't want to release the entire code here so.. Can someone even see what is wrong with this one ?
Reply
#6

You gave me a link that only someone who know what he's reading can understand, I'm not an engineer, a mathematician, and in my studies I've no maths since 3 years, so, I've not your level maybe, and I'm not able to undertsand this clearly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)