2 Houses Bugs
#1

Hello every one, and Big Thank's who going to help me !
Anyways, I have 2 bugs.
First:
When I use the Command /buyhouse Nothing happen.
Here is the CMD:
PHP код:
CMD:buyhouse(playeridparams[])
    {
        new 
string[128];
        new 
playername[MAX_PLAYER_NAME];
        new 
sendername[MAX_PLAYER_NAME];
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        
GetPlayerName(playeridplayernamesizeof(playername));
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        for(new 
0sizeof(HouseInfo); h++)
        {
            if(
IsPlayerInRangeOfPoint(playerid,2.0,HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]) )
            {
                if( 
HouseInfo[h][hOwned] == )
                {
                    if(
PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
                    {
                        
format(stringsizeof(string), "   You must be Level %d to purchase this!"HouseInfo[h][hLevel]);
                        
SendClientMessageEx(playeridCOLOR_GRAD5string);
                        return 
1;
                    }
                    if(
PlayerInfo[playerid][pPhousekey] == INVALID_HOUSE_ID)
                    {
                        if(
GetPlayerCash(playerid) > HouseInfo[h][hValue])
                        {
                            
PlayerInfo[playerid][pPhousekey] = h;
                            
HouseInfo[h][hOwned] = 1;
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            
strmid(HouseInfo[h][hOwner], sendername0strlen(sendername), 255);
                            
GivePlayerCash(playerid,-HouseInfo[h][hValue]);
                            
SetPlayerInterior(playerid,HouseInfo[h][hHInteriorWorld]);
                            if(
HouseInfo[h][hCustomInterior] == 1)
                            {
                                
TogglePlayerControllable(playerid0);
                                
GameTextForPlayer(playerid"Objects loading..."40005);
                                
SetPVarInt(playerid"LoadingObjects"1);
                                
SetTimerEx("SafeLoadObjects"40000"d"playerid);
                            }
                            
SetPlayerPos(playerid,HouseInfo[h][hInteriorX],HouseInfo[h][hInteriorY],HouseInfo[h][hInteriorZ]);
                            
GameTextForPlayer(playerid"~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit."50003);
                            
PlayerInfo[playerid][pInt] = HouseInfo[h][hHInteriorWorld];
                            
SendClientMessageEx(playeridCOLOR_WHITE"Congratulations on your new purchase!");
                            
SendClientMessageEx(playeridCOLOR_WHITE"Type /help to review the property help section!");
                            
SaveHouses();
                            
OnPlayerStatsUpdate(playerid);
                            
PlayerInfo[playerid][pLocal] = h+6000;
                            
PlayerInfo[playerid][pVW] = h+6000;
                            
SetPlayerVirtualWorld(playeridh+6000);
                            
DestroyDynamicPickup(HouseInfo[h][hPickupID]);
                            
HouseInfo[h][hPickupID] = CreateDynamicPickup(127323HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]);
                            
format(stringsizeof(string), "This house is owned by\n %s\nLevel: %d\nID: %d",HouseInfo[h][hOwner],HouseInfo[h][hLevel],h);
                            
UpdateDynamic3DTextLabelText(HouseInfo[h][hTextID], COLOR_GREENstring);
                            new 
ip[32];
                            
GetPlayerIp(playerid,ip,sizeof(ip));
                            
format(string,sizeof(string),"%s (IP: %s) has bought house ID %d for $%d.",GetPlayerNameEx(playerid),ip,h,HouseInfo[h][hValue]);
                            
Log("logs/house.log"string);
                            return 
1;
                        }
                        else
                        {
                            
SendClientMessageEx(playeridCOLOR_WHITE"   You don't have the cash for that!");
                            return 
1;
                        }
                    }
                    else if(
PlayerInfo[playerid][pPhousekey2] == INVALID_HOUSE_ID)
                    {
                        if(
GetPlayerCash(playerid) > HouseInfo[h][hValue])
                        {
                            
PlayerInfo[playerid][pPhousekey2] = h;
                            
HouseInfo[h][hOwned] = 1;
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            
strmid(HouseInfo[h][hOwner], sendername0strlen(sendername), 255);
                            
GivePlayerCash(playerid,-HouseInfo[h][hValue]);
                            
SetPlayerInterior(playerid,HouseInfo[h][hHInteriorWorld]);
                            if(
HouseInfo[h][hCustomInterior] == 1)
                            {
                                
TogglePlayerControllable(playerid0);
                                
GameTextForPlayer(playerid"Objects loading..."40005);
                                
SetPVarInt(playerid"LoadingObjects"1);
                                
SetTimerEx("SafeLoadObjects"40000"d"playerid);
                            }
                            
SetPlayerPos(playerid,HouseInfo[h][hInteriorX],HouseInfo[h][hInteriorY],HouseInfo[h][hInteriorZ]);
                            
GameTextForPlayer(playerid"~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit."50003);
                            
PlayerInfo[playerid][pInt] = HouseInfo[h][hHInteriorWorld];
                            
SendClientMessageEx(playeridCOLOR_WHITE"Congratulations on your new purchase!");
                            
SendClientMessageEx(playeridCOLOR_WHITE"Type /help to review the property help section!");
                            
SaveHouses();
                            
OnPlayerStatsUpdate(playerid);
                            
PlayerInfo[playerid][pLocal] = h+6000;
                            
PlayerInfo[playerid][pVW] = h+6000;
                            
SetPlayerVirtualWorld(playeridh+6000);
                            
DestroyDynamicPickup(HouseInfo[h][hPickupID]);
                            
HouseInfo[h][hPickupID] = CreateDynamicPickup(127323HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]);
                            
format(stringsizeof(string), "This house is owned by\n %s\nLevel: %d\nID: %d",HouseInfo[h][hOwner],HouseInfo[h][hLevel],h);
                            
UpdateDynamic3DTextLabelText(HouseInfo[h][hTextID], COLOR_GREENstring);
                            new 
ip[32];
                            
GetPlayerIp(playerid,ip,sizeof(ip));
                            
format(string,sizeof(string),"%s (IP: %s) has bought house ID %d for $%d.",GetPlayerNameEx(playerid),ip,h,HouseInfo[h][hValue]);
                            
Log("logs/house.log"string);
                            return 
1;
                        }
                        else
                        {
                            
SendClientMessageEx(playeridCOLOR_WHITE"   You don't have the cash for that!");
                            return 
1;
                        }
                    }
                }
                else
                {
                    
SendClientMessageExplayeridCOLOR_WHITE"This house is owned." );
                }
            }
        }
        return 
1;
    } 
Second:
When I create a house IG, there is a bug that create some random and a lot of house on X:0, Y:0, Z:0, And if you go near that place it make you lag as F**K and Crash you after, then you can't login to play instead if you TP'ed.
Well, I delete all the houses from the .cfg, and it still creating.


I think the Second bug make the /buyhouse laggy.

Well thank's for who will help.
Reply
#2

try to change oldposz,y,x to x,y,z only
Reply
#3

Sorry I'm on my phone now, But you need to use X,Y,Z with If and new..
Reply
#4

I can't understand What you mean Guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)