Bug with business script.
#1

Hi everyone!

So, I have a problem with a script (raven's Roleplay 4.2) Since when i type /buybiz and it says "You already own a business" but when try to /sellbiz it says "you don't own any business" Any ideas? I am desperate.
+ Rep will be given to the man that helps me.

Here is the code

PHP код:
//----------------------------------[BIZZ]-----------------------------------------------
    
if(strcmp(cmd"/buybiz"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            new 
Float:oldposxFloat:oldposyFloat:oldposz;
            
GetPlayerName(playeridplayernamesizeof(playername));
            
GetPlayerPos(playeridoldposxoldposyoldposz);
            if(
PlayerInfo[playerid][pPbiskey] != 9998)
            {
                
SendClientMessage(playeridCOLOR_WHITE"   You already own a business, type /sellbiz if you want to buy this one.");
                return 
1;
            }
            for(new 
0sizeof(SBizzInfo); b++)
            {
                if(
IsPlayerInRangeOfPoint(playerid2SBizzInfo[b][sbEntranceX], SBizzInfo[b][sbEntranceY], SBizzInfo[b][sbEntranceZ]) && SBizzInfo[b][sbOwned] == 0)
                {
                    if(
PlayerInfo[playerid][pLevel] < SBizzInfo[b][sbLevelNeeded])
                    {
                        
format(stringsizeof(string), "You Must Be Level %d To Purchase This",SBizzInfo[b][sbLevelNeeded]);
                        
SendClientMessage(playeridCOLOR_GRAD5string);
                        return 
1;
                    }
                    if(
GetPlayerMoney(playerid) > SBizzInfo[b][sbBuyPrice])
                    {
                        if(
PlayerInfo[playerid][pPassport] == 1)
                        {
                            
PlayerInfo[playerid][pPbiskey] = b+100;
                            
SBizzInfo[b][sbOwned] = 1;
                            
strmid(SBizzInfo[b][sbOwner], sendername0strlen(sendername), 255);
                            
SafeGivePlayerMoney(playerid,-SBizzInfo[b][sbBuyPrice]);
                            
PlayerPlayMusic(playerid);
                            
SendClientMessage(playeridCOLOR_WHITE"Congratulations, On Your New Purchase.");
                            
SendClientMessage(playeridCOLOR_WHITE"Type /help to review the new business help section.");
                            
OnPropUpdate(3,b);
                            
OnPlayerUpdateEx(playerid);
                            
OnPropTextdrawUpdate(3b);
                            new 
ymd;
                            new 
h,mi,s;
                            
getdate(y,m,d);
                            
gettime(h,mi,s);
                            
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /buybiz",d,m,y,h,mi,s,sendername);
                            
CommandLog(string);
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"* For security reasons, a passport is needed to buy a business!");
                            return 
1;
                        }
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"You don't have the cash for that");
                        return 
1;
                    }
                }
            }
            for(new 
0sizeof(BizzInfo); b++)
            {
                if(
IsPlayerInRangeOfPoint(playerid2BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]) && BizzInfo[b][bOwned] == 0)
                {
                    if(
PlayerInfo[playerid][pLevel] < BizzInfo[b][bLevelNeeded])
                    {
                        
format(stringsizeof(string), "You Must Be Level %d To Purchase This",BizzInfo[b][bLevelNeeded]);
                        
SendClientMessage(playeridCOLOR_GRAD5string);
                        return 
1;
                    }
                    if(
GetPlayerMoney(playerid) > BizzInfo[b][bBuyPrice])
                    {
                        
PlayerInfo[playerid][pPbiskey] = b;
                        
BizzInfo[b][bOwned] = 1;
                        
strmid(BizzInfo[b][bOwner], sendername0strlen(sendername), 255);
                        
SafeGivePlayerMoney(playerid,-BizzInfo[b][bBuyPrice]);
                        
PlayerPlayMusic(playerid);
                        
SafeSetPlayerInterior(playerid,BizzInfo[b][bInterior]);
                        
SetPlayerVirtualWorld(playerid,BizzInfo[b][bVirWorld]);
                        
PlayerInfo[playerid][pInteriorNr] = BizzInfo[b][bInteriorNr];
                        
SafeSetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
                        
GameTextForPlayer(playerid"~w~Welcome~n~You can exit at any time by moving to this door and typing /exit"50003);
                        
PlayerInfo[playerid][pLocal] = ;
                        
SendClientMessage(playeridCOLOR_WHITE"Congratulations, On Your New Purchase.");
                        
SendClientMessage(playeridCOLOR_WHITE"Type /help to review the new business help section.");
                        
OnPropUpdate(2,b);
                        
OnPlayerUpdateEx(playerid);
                        
OnPropTextdrawUpdate(2b);
                        
BizzEntered[playerid] = b;
                        return 
1;
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"You don't have the cash for that");
                        return 
1;
                    }
                }
            }
        }
        return 
1;
    }
    if(
strcmp(cmd"/sellbiz"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
GetPlayerName(playeridplayernamesizeof(playername));
            if(
PlayerInfo[playerid][pPbiskey] == 9998)
            {
                
SendClientMessage(playeridCOLOR_WHITE"* You don't own a bizz.");
                return 
1;
            }
            if(
PlayerInfo[playerid][pMarried] > 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"* You are Married, can't sell the Bizz !");
                return 
1;
            }
              if(
CanSellBizz[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"You can't sell the bizz without first authorizing it at /account panel!");
                return 
1;
            }
            if(
PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playernameSBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
            {
                new 
bouse PlayerInfo[playerid][pPbiskey]-100;
                
SafeGivePlayerMoney(playerid,SBizzInfo[bouse][sbBuyPrice]);
                
SafeGivePlayerMoney(playerid,SBizzInfo[bouse][sbTill]);
                
SBizzInfo[bouse][sbLocked] = 1;
                
SBizzInfo[bouse][sbOwned] = 0;
                
strmid(SBizzInfo[bouse][sbOwner], "The State"0strlen("The State"), 255);
                
strmid(SBizzInfo[bouse][sbExtortion], "No-one"0strlen("No-one"), 255);
                
//ConsumingMoney[playerid] = 1;
                
PlayerPlaySound(playerid10520.00.00.0);
                
format(stringsizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d + $%d"SBizzInfo[bouse][sbBuyPrice], SBizzInfo[bouse][sbTill]);
                
GameTextForPlayer(playeridstring100003);
                
SBizzInfo[bouse][sbTill] = 0;
                
PlayerInfo[playerid][pPbiskey] = 255;
                
OnPropUpdate(3,bouse);
                
OnPlayerUpdateEx(playerid);
                
OnPropTextdrawUpdate(3bouse);
                return 
1;
            }
            if(
strcmp(playernameBizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
            {
                new 
bouse PlayerInfo[playerid][pPbiskey];
                
BizzInfo[bouse][bLocked] = 1;
                
BizzInfo[bouse][bOwned] = 0;
                
strmid(BizzInfo[bouse][bOwner], "The State"0strlen("The State"), 255);
                
strmid(BizzInfo[bouse][bExtortion], "No-one"0strlen("No-one"), 255);
                
//ConsumingMoney[playerid] = 1;
                
SafeGivePlayerMoney(playerid,BizzInfo[bouse][bBuyPrice]);
                
SafeGivePlayerMoney(playerid,BizzInfo[bouse][bTill]);
                
PlayerPlaySound(playerid10520.00.00.0);
                
format(stringsizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d + $%d"BizzInfo[bouse][bBuyPrice], BizzInfo[bouse][bTill]);
                
GameTextForPlayer(playeridstring100003);
                
BizzInfo[bouse][bTill] = 0;
                
PlayerInfo[playerid][pPbiskey] = 9999;
                
OnPropUpdate(2bouse);
                
OnPlayerUpdateEx(playerid);
                
OnPropTextdrawUpdate(2bouse);
                return 
1;
            }
            else
            {
                
SendClientMessage(playeridCOLOR_WHITE"You don't own a business.");
            }
        } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)