[Ajuda] Sistema de Casas (Create3DTextLabel)
#1

Код:
if(HouseInfo[h][hOwned] == 0)
		{
			format(string1, sizeof(string), "[SALE]\n$ %d",HouseInfo[h][hValue]);
			housesale = Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
			pickups++;
		}
		if(HouseInfo[h][hOwned] == 1)
		{
			format(string1, sizeof(string), "[OWNED BY]\n%s",HouseInfo[h][hOwner]);
			Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			AddStaticPickup(1239, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
			pickups++;
		}
Eu tenho este sistema, quando a casa estб a venda aparece "[SALE] Preзo" mas depois de a casa estбr comprada aparece na mesma [SALE] Preзo em vez de "[OWNED BY] nome jogador" o que estб errado ai nesse sistema? agradeзo pela ajuda
Reply
#2

Error nao pareзe sair dessa parte que postas-te..aparentimente nesse cod tudo ok. Deve haver outra parte que defina o error
Reply
#3

Deve ser do /buyhouse ou /sellhouse que nao define o 3D Label ne? vou postar aqui os 2

Код:
if(strcmp(cmd, "/buyhouse", 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] == 0)
				{
					if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
					{
						format(string, sizeof(string), "   You must be Level %d to purchase this !", HouseInfo[h][hLevel]);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						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 buy this one !");
						return 1;
					}
					if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
					{
					    Delete3DTextLabel(Text3D:housesale);
						PlayerInfo[playerid][pPhousekey] = h;
						HouseInfo[h][hOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
						SafeGivePlayerMoney(playerid,-HouseInfo[h][hValue]);
						PlayerPlayMusic(playerid);
						/*SetPlayerInterior(playerid,HouseInfo[h][hInt]);
						SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
						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 typing /exit", 5000, 3);
						PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
						PlayerInfo[playerid][pLocal] = h;
						SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
						SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
						Delete3DTextLabel(Text3D:housesale);
                        DateProp(playerid);
						OnPropUpdate();
						OnPlayerUpdate(playerid);
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "   You don't have the cash for that !");
						return 1;
					}
				}
			}
		}
		return 1;
	}
Код:
if(strcmp(cmd, "/sellhouse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid, playername, sizeof(playername));
			if(PlayerInfo[playerid][pPhousekey] == 255)
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
				return 1;
			}
			if(PlayerInfo[playerid][pMarried] > 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "   You are Married, can't sell the House !");
		        return 1;
		    }
			if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
			{
				new house = PlayerInfo[playerid][pPhousekey];
				HouseInfo[house][hHel] = 0;
				HouseInfo[house][hArm] = 0;
				HouseInfo[house][hHealthx] = 0;
				HouseInfo[house][hHealthy] = 0;
				HouseInfo[house][hHealthz] = 0;
				HouseInfo[house][hArmourx] = 0;
				HouseInfo[house][hArmoury] = 0;
				HouseInfo[house][hArmourz] = 0;
				HouseInfo[house][hLock] = 1;
				HouseInfo[house][hOwned] = 0;
				HouseInfo[house][hVec] = 418;
				HouseInfo[house][hVcol1] = -1;
				HouseInfo[house][hVcol2] = -1;
				GetPlayerName(playerid, sendername, sizeof(sendername));
				strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
				//ConsumingMoney[playerid] = 1;
				SafeGivePlayerMoney(playerid,HouseInfo[house][hValue]);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", HouseInfo[house][hValue]);
				GameTextForPlayer(playerid, string, 10000, 3);
				format(string1, sizeof(string), "[SALE]\n$ %d",HouseInfo[house][hValue]);
				housesale = Create3DTextLabel(string1,0x006400FF,HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez]+1,15,0,1);
				PlayerInfo[playerid][pPhousekey] = 255;
				if(PlayerInfo[playerid][pLocal] == house)
				{
					SetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid,0);
					SetPlayerPos(playerid,HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
					PlayerInfo[playerid][pInt] = 0;
				}
				OnPropUpdate();
				OnPlayerUpdate(playerid);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
			}
		}
		return 1;
	}
Reply
#4

pawn Код:
if(strcmp(cmd, "/buyhouse", 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] == 0)
                {
                    if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
                    {
                        format(string, sizeof(string), "   You must be Level %d to purchase this !", HouseInfo[h][hLevel]);
                        SendClientMessage(playerid, COLOR_GRAD5, string);
                        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 buy this one !");
                        return 1;
                    }
                    if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
                    {
                        Delete3DTextLabel(Text3D:housesale);
                        PlayerInfo[playerid][pPhousekey] = h;
                        HouseInfo[h][hOwned] = 1;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
                        SafeGivePlayerMoney(playerid,-HouseInfo[h][hValue]);
                        PlayerPlayMusic(playerid);
                        /*SetPlayerInterior(playerid,HouseInfo[h][hInt]);
                        SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
                        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 typing /exit", 5000, 3);
                        PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
                        PlayerInfo[playerid][pLocal] = h;
                        SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
                        SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
                        Delete3DTextLabel(Text3D:hOwner);
                        DateProp(playerid);
                        OnPropUpdate();
                        OnPlayerUpdate(playerid);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "   You don't have the cash for that !");
                        return 1;
                    }
                }
            }
        }
        return 1;
    }
Reply
#5

Fail, nгo alterou nada :S

Edit@

Eu editei assim:

Text3Dlabel:

Код:
------------------------------------------------------------------------------------------------
//news
new Text3D:housesale
newText3D:housebuy
------------------------------------------------------------------------------------------------
//public OnGameModeInit
------------------------------------------------------------------------------------------------
if(HouseInfo[h][hOwned] == 0)
		{
			format(string1, sizeof(string), "[SALE]\n$ %d",HouseInfo[h][hValue]);
			housesale = Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
			pickups++;
		}
  		if(HouseInfo[h][hOwned] == 1)
		{
   			format(string1, sizeof(string), "[OWNED BY]\n%s",HouseInfo[h][hOwner]);
			housebuy = Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			AddStaticPickup(1239, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
			pickups++;
		}
------------------------------------------------------------------------------------------------
//CommandText = Comandos para comprar e vender casa
------------------------------------------------------------------------------------------------
if(strcmp(cmd, "/buyhouse", 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] == 0)
				{
					if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
					{
						format(string, sizeof(string), "   You must be Level %d to purchase this !", HouseInfo[h][hLevel]);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						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 buy this one !");
						return 1;
					}
     				if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
     				if(HouseInfo[h][hOwned] == 1)
					{
					    Delete3DTextLabel(Text3D:housesale);
						PlayerInfo[playerid][pPhousekey] = h;
						HouseInfo[h][hOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
						SafeGivePlayerMoney(playerid,-HouseInfo[h][hValue]);
						PlayerPlayMusic(playerid);
						/*SetPlayerInterior(playerid,HouseInfo[h][hInt]);
						SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
						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 typing /exit", 5000, 3);
						PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
						PlayerInfo[playerid][pLocal] = h;
						SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
						SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
						format(string1, sizeof(string), "[OWNED BY]\n%s",HouseInfo[h][hOwner]);
						housebuy = Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
                        DateProp(playerid);
						OnPropUpdate();
						OnPlayerUpdate(playerid);
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "   You don't have the cash for that !");
						return 1;
					}
				}
			}
		}
		return 1;
	}
----------------------------------------------------------------------------------------------------
if(strcmp(cmd, "/sellhouse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid, playername, sizeof(playername));
			if(PlayerInfo[playerid][pPhousekey] == 255)
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
				return 1;
			}
			if(PlayerInfo[playerid][pMarried] > 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "   You are Married, can't sell the House !");
		        return 1;
		    }
			if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
			{
				new house = PlayerInfo[playerid][pPhousekey];
				Delete3DTextLabel(Text3D:housebuy);
				HouseInfo[house][hHel] = 0;
				HouseInfo[house][hArm] = 0;
				HouseInfo[house][hHealthx] = 0;
				HouseInfo[house][hHealthy] = 0;
				HouseInfo[house][hHealthz] = 0;
				HouseInfo[house][hArmourx] = 0;
				HouseInfo[house][hArmoury] = 0;
				HouseInfo[house][hArmourz] = 0;
				HouseInfo[house][hLock] = 1;
				HouseInfo[house][hOwned] = 0;
				HouseInfo[house][hVec] = 418;
				HouseInfo[house][hVcol1] = -1;
				HouseInfo[house][hVcol2] = -1;
				GetPlayerName(playerid, sendername, sizeof(sendername));
				strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
				//ConsumingMoney[playerid] = 1;
				SafeGivePlayerMoney(playerid,HouseInfo[house][hValue]);
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", HouseInfo[house][hValue]);
				GameTextForPlayer(playerid, string, 10000, 3);
				format(string1, sizeof(string), "[SALE]\n$ %d",HouseInfo[house][hValue]);
				housesale = Create3DTextLabel(string1,0x006400FF,HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez]+1,15,0,1);
				PlayerInfo[playerid][pPhousekey] = 255;
				if(PlayerInfo[playerid][pLocal] == house)
				{
					SetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid,0);
					SetPlayerPos(playerid,HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
					PlayerInfo[playerid][pInt] = 0;
				}
				OnPropUpdate();
				OnPlayerUpdate(playerid);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
			}
		}
		return 1;
	}
Mas quando a casa estб a venda diz "[SALE] Preзo" depois quando vou a comprar o 3dtext do "[SALE] Preзo" apaga e aparece o "[OWNED BY] Nome do jogador" mas quando volto a vender a casa aparece os 2 3dtxt , o "[OWNED BY] nome jogador" e o "[SALE] Preзo" um em cima do outro, ou seja o 3dtxt do "[OWNED BY] nome jogador" nao apaga no comando /sellhouse :S algem me ajuda? agradeзo mesmo
Reply
#6

Morreja,eu jб disse,fale por mim por PM por aqui,ou falamos pelo msn. Entre em contacto comigo novamente para lhe dar meu mail
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)