/duty problem.
#1

Why in LARP when being a cop/fbi and using /duty you can do it everywhere, not only at lockers!

pawn Код:
if(strcmp(cmd, "/duty", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
            {
                if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerToPoint(3,playerid,-1616.1294,681.1594,7.1875) || PlayerInfo[playerid][pLocal] != 255)
                {
                    if(OnDuty[playerid]==0)
                    {
                        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                        {
                            format(string, sizeof(string), "* Officer %s took a Badge and a Gun from his locker.", sendername);
                        }
                        else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
                        {
                            format(string, sizeof(string), "* Agent %s took a Badge and a Gun from his locker.", sendername);
                        }
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SafeGivePlayerWeapon(playerid, 24, 70);
                        SafeGivePlayerWeapon(playerid, 3, 0);
                        SetPlayerArmour(playerid, 100);
                        OnDuty[playerid] = 1;
                    }
                    else if(OnDuty[playerid]==1)
                    {
                        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                        {
                            format(string, sizeof(string), "* Officer %s places his Badge and Gun in his locker.", sendername);
                        }
                        else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
                        {
                            format(string, sizeof(string), "* Agent %s places his Badge and Gun in his locker.", sendername);
                        }
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SafeResetPlayerWeapons(playerid);
                        SetPlayerArmour(playerid, 0);
                        SafeGivePlayerWeapon(playerid, 41, 500);
                        OnDuty[playerid] = 0;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "   You are not in a locker room !");
                    return 1;
                }
            }
            else if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
            {
                if(JobDuty[playerid] == 1)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Medic Job and will not receive calls anymore.");
                    JobDuty[playerid] = 0;
                    Medics -= 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Medic Job and will receive calls from people in need.");
                    JobDuty[playerid] = 1;
                    Medics += 1;
                    GetPlayerName(playerid,sendername,sizeof(sendername));
                    format(string, sizeof(string), "[Advert] Paramedic %s is On Duty, /call 911.", sendername);
                    OOCNews(COLOR_ALLDEPT,string);
                }
            }
            else if(PlayerInfo[playerid][pJob] == 17)
            {
                if(JobDuty[playerid] == 1)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Pizza Delivery Job and will not receive calls anymore.");
                    JobDuty[playerid] = 0;
                    PizzaBoys -= 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Pizza Delivery Job and will receive calls from people in need.");
                    JobDuty[playerid] = 1;
                    PizzaBoys += 1;
                    GetPlayerName(playerid,sendername,sizeof(sendername));
                    format(string, sizeof(string), "[Advert] Well stacked pizza worker %s is now On Duty, /call 111 to order a pizza.", sendername);
                    OOCNews(0xFF7E00AA,string);
                }
            }
            else if(PlayerInfo[playerid][pJob] == 7)
            {
                if(JobDuty[playerid] == 1)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Car Mechanic Job and will not receive calls anymore.");
                    JobDuty[playerid] = 0;
                    Mechanics -= 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Car Mechanic Job and will receive calls from people in need.");
                    JobDuty[playerid] = 1;
                    Mechanics += 1;
                    GetPlayerName(playerid,sendername,sizeof(sendername));
                    format(string, sizeof(string), "[Advert] Car mechanic %s is now On Duty, /call 555 to call a mechanic.", sendername);
                    OOCNews(0x2993EDAA,string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not a Cop !");
            }
        }
        return 1;
    }
Reply
#2

Its beacause of this line:
pawn Код:
if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerToPoint(3,playerid,-1616.1294,681.1594,7.1875) || PlayerInfo[playerid][pLocal] != 255
Reply
#3

or you could add a
Quote:

IsPlayerInRangeOfPoint(playerid,X,Y,Z);

You could use the X,Y,Z location to like only lspd.
Reply
#4

Quote:
Originally Posted by [DM]Kane
Посмотреть сообщение
Its beacause of this line:
pawn Код:
if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerToPoint(3,playerid,-1616.1294,681.1594,7.1875) || PlayerInfo[playerid][pLocal] != 255
Yeah I understand that, BUT I'll try it with IsPlayerInRangeOfPoint, give me a few mins.

Nah, still same shit as PlayerToPoint, works everywhere, damn!
Help please.

Nevermind, the return 1 wasn't where it should be.
Solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)