Help me understand this biz script please?
#5

pawn Код:
if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pBizKey] == -1)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You do not own a business.");
                return 1;
            }
            new business = PlayerInfo[playerid][pBizKey];
            new x_nr[32];
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid, COLOR_WHITE, "{CC1100}USAGE: {FFFFFF} /biz [name]");
                SendClientMessage(playerid, COLOR_GRAD1, "Available names: EntryFee, Lock, Till, Restock");
                if(business == 1)
                    SendClientMessage(playerid, COLOR_GRAD1, "Available names: Gate");
                return 1;
            }
is the start of it, after that is the first x_nr, e.g.:
pawn Код:
else if(strcmp(x_nr,"lock",true) == 0)
            {
                new inbusiness = 0;
                if(IsPlayerInRangeOfPoint(playerid,5.0,BizInfo[business][bInsideX],BizInfo[business][bInsideY],BizInfo[business][bInsideZ]))
                {
                    if(GetPlayerVirtualWorld(playerid) == playerid)
                    {
                        inbusiness = 1;
                    }
                }
                if(!inbusiness && !IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[business][bOutsideX], BizInfo[business][bOutsideY], BizInfo[business][bOutsideZ]))
                {
                    SendClientMessage(playerid,COLOR_GREY,"   You are not near/inside your business.");
                    return 1;
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(BizInfo[business][bLocked] == 1)
                {
                    BizInfo[business][bLocked] = 0;
                   
                    format(string, sizeof(string), "%s\nOwner: %s\nEntry Fee: $%d",BizInfo[business][bName],BizInfo[business][bOwner],BizInfo[business][bEntryFee]);
                    Update3DTextLabelText(Text3D:BizText[business], BIZ_COLOR, string);
                   
                    PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                    format(string, sizeof(string), "* %s has unlocked the door to their business.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                }
                else
                {
                    BizInfo[business][bLocked] = 1;
                   
                    format(string, sizeof(string), "%s\nOwner: %s\nEntry Fee: $%d",BizInfo[business][bName],BizInfo[business][bOwner],BizInfo[business][bEntryFee]);
                    Update3DTextLabelText(Text3D:BizText[business], BIZ_COLOR, string);
                   
                    PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                    format(string, sizeof(string), "* %s has locked the door to their business.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                }
            }
I know it finds the owner with this code:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,25.0,BizInfo[business][bInsideX],BizInfo[business][bInsideY],BizInfo[business][bInsideZ]))
But I don't understand how at all..
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)