LSPD job
#1

Hello everyone,

I have a problem: I made a script that makes a cop on/off duty. When I login, and I go to the locker room, everything is right. I type /duty, and I get the message: Officier ... is on duty. When I type /duty again, I get off duty. So that's good too. When I type it again, I get off duty again! Also, other commands/actions that require ponduty = 1 work fine after the third time. So, the first time /duty makes me on-duty, second time off duty, and all other attempts after the second, makes me off duty, but I already am...

pawn Код:
else if (strcmp("/duty", cmdtext, true) == 0)
    {
        if (pjob[playerid] == 1)
        {
            if(!IsPlayerInRangeOfPoint(playerid, 4.0, 223.51014709473, 188.08520507813, 1003.03125))
            {
                SendClientMessage(playerid, COLOR_RED, "You are not in the LSPD locker room!");
                return 1;
            }
            else
            {
                if (ponduty[playerid] == 0)
                {
                    ponduty[playerid] = 1;
                    format(message, sizeof(message), "Officer %s is now on duty");
                    lspdradio(message);
                    return 1;
                }
                else if (ponduty[playerid] == 1)
                {
                    format(message, sizeof(message), "Officer %s is now off duty");
                    lspdradio(message);
                    ponduty[playerid] = 0;
                    return 1;
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You aren't a cop, so you can't get on duty!");
            return 1;
        }

    }
I can't find the mistake

Bas
Reply
#2

As far as I can see everything looks good. Try removing the returns under if(ponduty .. , though.
Reply
#3

I already tried that :S
Thanks for the reply anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)