/buyhouse Bug
#1

Hi.My Gamemode /buyhouse has a bug.
If player use /buyhouse house Can not be purchased and system don't sent a message to player.
/buyhouse NOT WORK.
CODE:
Код:
CMD:buyhouse(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 100.0, 1109.0, 1537.0, 5.0) && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_WHITE, "You cannot use this command in this area!");
    new string[128];
    new playername[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new Float:oldposx, Float:oldposy, Float:oldposz;
    GetPlayerName(playerid, playername, sizeof(playername));
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    for(new h = 0; h < sizeof(HouseInfo); h++)
	{
        if(IsPlayerInRangeOfPoint(playerid,3.0,HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]) )
		{
		    if(PlayerInfo[playerid][pFreezeHouse] == 1)
		    {
		        return SendClientMessageEx(playerid, COLOR_WHITE, "ERROR: Your house assets are frozen, you cannot buy a house!");
			}
            if( HouseInfo[h][hOwned] == 0 )
			{
                if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
				{
                    format(string, sizeof(string), "   You must be Level %d to purchase this!", HouseInfo[h][hLevel]);
                    SendClientMessageEx(playerid, COLOR_GRAD5, string);
                    return 1;
                }
                if(PlayerInfo[playerid][pPhousekey] == INVALID_HOUSE_ID)
				{

					if(GetPlayerCash(playerid) > HouseInfo[h][hValue])
					{
						PlayerInfo[playerid][pPhousekey] = h;
						HouseInfo[h][hOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
						GivePlayerCash(playerid,-HouseInfo[h][hValue]);
						SetPlayerInterior(playerid,HouseInfo[h][hHInteriorWorld]);
						SetPlayerPosEx(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.", 5000, 3);
						PlayerInfo[playerid][pInt] = HouseInfo[h][hHInteriorWorld];
						SendClientMessageEx(playerid, COLOR_WHITE, "Congratulations on your new purchase!");
						SendClientMessageEx(playerid, COLOR_WHITE, "Type /help to review the property help section!");
						SaveHouse(h);
						OnPlayerStatsUpdate(playerid);
						PlayerInfo[playerid][pVW] = h+6000;
						SetPlayerVirtualWorld(playerid, h+6000);
						DestroyPickupEx(HouseInfo[h][hPickupID]);
						HouseInfo[h][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]);
						format(string, sizeof(string), "This house is owned by\n %s\nLevel: %d\nID: %d",HouseInfo[h][hOwner],HouseInfo[h][hLevel],h);
						UpdateDynamic3DTextLabelText(HouseInfo[h][hTextID], COLOR_GREEN, string);
						format(string,sizeof(string),"%s (IP: %s) has bought house ID %d for $%d.",GetPlayerNameEx(playerid),GetPlayerIpEx(playerid),h,HouseInfo[h][hValue]);
						Log("logs/house.log", string);
						if(HouseInfo[h][hCustomInterior] == 1) Player_StreamPrep(playerid, HouseInfo[h][hInteriorX],HouseInfo[h][hInteriorY],HouseInfo[h][hInteriorZ], FREEZE_TIME);
						return 1;
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_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(playerid, sendername, sizeof(sendername));
						strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
						GivePlayerCash(playerid,-HouseInfo[h][hValue]);
						SetPlayerInterior(playerid,HouseInfo[h][hHInteriorWorld]);
						SetPlayerPosEx(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.", 5000, 3);
						PlayerInfo[playerid][pInt] = HouseInfo[h][hHInteriorWorld];
						SendClientMessageEx(playerid, COLOR_WHITE, "Congratulations on your new purchase!");
						SendClientMessageEx(playerid, COLOR_WHITE, "Type /help to review the property help section!");
						SaveHouse(h);
						OnPlayerStatsUpdate(playerid);
						PlayerInfo[playerid][pVW] = h+6000;
						SetPlayerVirtualWorld(playerid, h+6000);
						DestroyPickupEx(HouseInfo[h][hPickupID]);
						HouseInfo[h][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]);
						format(string, sizeof(string), "This house is owned by\n %s\nLevel: %d\nID: %d",HouseInfo[h][hOwner],HouseInfo[h][hLevel],h);
						UpdateDynamic3DTextLabelText(HouseInfo[h][hTextID], COLOR_GREEN, string);
						format(string,sizeof(string),"%s (IP: %s) has bought house ID %d for $%d.",GetPlayerNameEx(playerid),GetPlayerIpEx(playerid),h,HouseInfo[h][hValue]);
						Log("logs/house.log", string);
						if(HouseInfo[h][hCustomInterior] == 1) Player_StreamPrep(playerid, HouseInfo[h][hInteriorX],HouseInfo[h][hInteriorY],HouseInfo[h][hInteriorZ], FREEZE_TIME);
						return 1;
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_WHITE, "   You don't have the cash for that!");
						return 1;
					}
				}
            }
            else
			{
                SendClientMessageEx( playerid, COLOR_WHITE, "This house is owned." );
            }
        }
    }
    return 1;
}
Thank you.
And sorry for my bad English.
Reply
#2

UP...
Reply
#3

Who can help?
Reply
#4

Firsty Dont Bump your topic
Reply
#5

Can you help me?
Reply
#6

Could someone please help me?
Reply
#7

There Is no scripter?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)