Help With House System :(
#1

when i do buy its work but when i do sell its work too but when i saty do /sell the commands you can do 10x times i dont why and when i do enter its not work please help me i need help with this commands and if there wrongs help me with the true codes


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/buy", cmdtext) == 0)
    {
        for(new i; i<MAX_HOUSES; i++)
		{
            if(IsPlayerInRangeOfPoint(playerid, 1, 2385.64, -1713.42, 14.00))
	    	{
				new Pname[24]; GetPlayerName(playerid, Pname, 24);
	    	    if(strlen(dini_Get("Owned.ini", Pname)))
                if(GetPlayerMoney(playerid) < 10000000) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house");
				if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!");
                GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
                HouseInfo[i][Owned] = 1;
                format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
                dini_Set("Owners.ini", Pname, "House1");
                return 1;
            }
            SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
			return 1;
		}
        return 1;
    }
    if (strcmp("/sell", cmdtext) == 0)
    {
        for(new i; i<MAX_HOUSES; i++)
		{
            if(IsPlayerInRangeOfPoint(playerid, 2, 2385.64, -1713.42, 14.00))
	    	{
				new Pname[24]; GetPlayerName(playerid, Pname, 24);
	    	    if(strlen(dini_Get("Owned.ini", Pname)))
				if(HouseInfo[i][Owned] == 0) return SendClientMessage(playerid, 0xF60000AA, "This house is sold!");
                GameTextForPlayer(playerid, "~r~House sold!", 2000, 3);
                HouseInfo[i][Owned] = 0;
                format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
                dini_Set("Owners.ini", Pname, "House1");
                return 1;
            }
            SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
			return 1;
		}
        return 1;
    }
    if (strcmp("/enter", cmdtext) == 0)
    {
        for(new i; i<MAX_HOUSES; i++)
		{
            if(IsPlayerInRangeOfPoint(playerid, 2, 2384.95, -1708.77, 15.30))
	    	{
                new Pname[24]; GetPlayerName(playerid, Pname, 24);
                if(strlen(dini_Get("Owned.ini", Pname)))
                if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!");
                if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "You have enter the house!");
                SetPlayerPos(playerid, 1527.229980, -11.574499, 1002.097106);
                SetPlayerInterior(playerid, 3 );
                SetPlayerVirtualWorld(playerid, 0);
                InHouse[playerid] = 1;
                SendClientMessage(playerid, 0x00C4F6AA, "You have entered your house");
                return 1;
            }
            SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
            return 1;
        }
        return 1;
    }
    
    if (strcmp("/exit", cmdtext) == 0)
    {
    	if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xF60000AA, "You are not in a house");
     	SetPlayerPos(playerid, 2385.64, -1713.42, 14.00);
      	SetPlayerInterior(playerid, 0 );
       	SetPlayerVirtualWorld(playerid, 0);
       	InHouse[playerid] = -1;
   		return 1;
 	 }
	return 0;
}
	return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)