Rentroom problem ( renters )
#1

I have a problem with rentroom!
I pRented online server for Renteria
The problem is next to the house I rent if I take my show on the home owner list, but if I go and take unrent and rent another house to appear on all lists
so all lists / renters appear to each owner
I know what the problem where it is, but do not know how to fix what they can do, atnci when owneru yes / renters to protect them Renteria's house!
How do I resolve?


Код:
	if(strcmp(cmd, "/rentroom", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			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(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 1 &&  HouseInfo[h][hRentabil] == 1)
				{
					/*if(HouseInfo[h][hInsurance] == 1)
					{
					    SCM(playerid, COLOR_CRS2, "** This house has no insurance and you can not rent a room.");
					    return 1;
					}*/
					if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
					{
						SendClientMessage(playerid, COLOR_WHITE, "** You already own a house, type /sellhouse if you want to rent this one.");
						return 1;
					}
					if(GetPlayerMoney(playerid) > HouseInfo[h][hRent])
					{
						PlayerInfo[playerid][pPhousekey] = h;
						PlayerInfo[playerid][pRented] = 1;
						GivePlayerCash(playerid,-HouseInfo[h][hRent]);
						HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
						PlayerPlayMusic(playerid);
						SetPlayerInterior(playerid,HouseInfo[h][hInt]);
						SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
						PlayerInfo[playerid][pVirWorld] = HouseInfo[h][hWorld];
						SetPlayerMapIcon(playerid,h + 20,HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancey],HouseInfo[h][hEntrancez],31,COLOR_LIGHTRED);
						SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
						GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and press enter", 5000, 3);
						PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
						PlayerInfo[playerid][pLocal] = h;
						SpawnPlayer(playerid);
						SendClientMessage(playerid, COLOR_WHITE, "** Congratulations, You can enter and exit here anytime.");
						SendClientMessage(playerid, COLOR_WHITE, "** Type /help to review the new property help section.");
						OnPlayerUpdateEx(playerid);
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
						return 1;
					}
				}
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/renters", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		    new count = 0;
			GetPlayerName(playerid, playername, sizeof(playername));
			for(new h = 0; h < sizeof(HouseInfo); h++)
			{
				if(PlayerInfo[playerid][pPhousekey] == h && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
	  			{
    				for(new i = 0; i < MAX_PLAYERS; i++)
					{
				    	if(PlayerInfo[i][pRented] >= 1)
				    	{
				        	if(IsPlayerConnected(i))
				        	{
						        GetPlayerName(i,giveplayer,sizeof(giveplayer));
						        format(string,sizeof(string),"** %s",giveplayer);
						        SendClientMessage(playerid, COLOR_WHITE, string);
						        count++;
							}
						}
					}
                	if(count == 0)
					{
		    			SendClientMessage(playerid,COLOR_CRS3,"* No renters online.");
					}
					else if(count >= 1)
					{
						format(string, 256, "* There are %d renters online.", count);
						SCM(playerid, COLOR_CRS3, string);
					}
				}
			}
		}
		return 1;
	}
Reply


Messages In This Thread
Rentroom problem ( renters ) - by iRealSAMP - 02.02.2012, 10:24
Re: Rentroom problem ( renters ) - by milanosie - 02.02.2012, 10:32
Re: Rentroom problem ( renters ) - by iRealSAMP - 02.02.2012, 15:49
Re: Rentroom problem ( renters ) - by iRealSAMP - 04.02.2012, 18:37

Forum Jump:


Users browsing this thread: 2 Guest(s)