BIG House Problem - Fast !
#1

Hi everyone! I have a BIG Problem with Houses. So let's start:

I created 6 Houses with Interior 2 and with /exit coordonates 225.756989,1240.000000,1082.149902 but with diferent /enter coordonates and Virtual Worlds.

OK. Fine. I go to the first house what I created and I type /buyhouse => /enter. And when I type /exit it's teleporting me to the /enter coordonates of the HOUSE 6, NOT OF THE FIRST HOUSE. I tryed /exit in House 2, house3, house 4, house5 but all teleporting me at outside of house 6. I need help ! I want when I enter in House 1, and i exit from it to teleport outside house 1 not outside house 6.


There are some codes:


/ENTER CODE:

Код:
if(strcmp(cmd, "/enter", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			for(new i = 0; i < sizeof(HouseInfo); i++)
			{
				if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
				{
					//printf("Found House :%d",i);
					if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
					{
						SetPlayerInterior(playerid,HouseInfo[i][hInt]);
						SetPlayerVirtualWorld(playerid, (i + 1));
						SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
						GameTextForPlayer(playerid, "~g~Welcome Home", 5000, 1);
						PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
						PlayerInfo[playerid][pLocal] = i;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
					}
				}
			}
/EXIT CODE:


Код:
if(strcmp(cmd, "/exit", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			for(new i = 0; i <  sizeof(HouseInfo); i++)
			{
				//printf("House :%d",i);
				if (PlayerToPoint(1, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
				{
					SetPlayerInterior(playerid,0);
					SetPlayerVirtualWorld(playerid, 0);
					SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
					PlayerInfo[playerid][pInt] = 0;
					PlayerInfo[playerid][pLocal] = 255;
					if(HouseInfo[i][hHel] == 1)
					{
						new Float:tempheal;
						GetPlayerHealth(playerid,tempheal);
						if(tempheal < 100.0)
						{
							SetPlayerHealth(playerid,100.0);
						}
					}
				}
			}
HELP ME STEP BY STEP Please !
Or help me with Team Viewer (add on yahoo: myster_blake)
Sorry for my bad english !
Reply
#2

pawn Код:
new HOUSE_ID_FOUND[499+1]; // at the top of the script
pawn Код:
if(strcmp(cmd, "/enter", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < sizeof(HouseInfo); i++)
            {
                if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
                {
                    //printf("Found House :%d",i);
                    if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
                    {
                        SetPlayerInterior(playerid,HouseInfo[i][hInt]);
                        SetPlayerVirtualWorld(playerid, (i + 1));
                        SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
                        GameTextForPlayer(playerid, "~g~Welcome Home", 5000, 1);
                        PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
                        PlayerInfo[playerid][pLocal] = i;
                                                HOUSE_ID_FOUND[playerid] = i;
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
                    }
                }
            }

pawn Код:
if(strcmp(cmd, "/exit", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
       
                //printf("House :%d",i);
                if (PlayerToPoint(1, playerid,HouseInfo[HOUSE_ID_FOUND[playerid]][hExitx], HouseInfo[HOUSE_ID_FOUND[playerid]][hExity], HouseInfo[HOUSE_ID_FOUND[playerid]][hExitz]))
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerVirtualWorld(playerid, 0);
                    SetPlayerPos(playerid,HouseInfo[HOUSE_ID_FOUND[playerid]][hEntrancex],HouseInfo[HOUSE_ID_FOUND[playerid]][hEntrancey],HouseInfo[HOUSE_ID_FOUND[playerid]][hEntrancez]);
                    PlayerInfo[playerid][pInt] = 0;
                    PlayerInfo[playerid][pLocal] = 255;
                    if(HouseInfo[HOUSE_ID_FOUND[playerid]][hHel] == 1)
                    {
                        new Float:tempheal;
                        GetPlayerHealth(playerid,tempheal);
                        if(tempheal < 100.0)
                        {
                            SetPlayerHealth(playerid,100.0);
                        }
                    }
            }
Reply
#3

Now, I can't exit from the house. Any suggestions ?
Reply
#4

ANOTHER PROBLEM NOW: WHEN I BUYHOUSE ALL THINGS ARE OK, I CAN EXIT FROM THE HOUSE, AND THE HOUSES ID ARE FINE, BUT WHEN I RELOG ON THE SERVER IT'S SPAWN ON MY HOUSE AND I CAN'T EXIT FROM IT ! Help !
Reply
#5

Midifie the array (HOUSE_ID_FOUND[playerid]) So it saves at the players userfile
Reply
#6

All problems solved !

Thanks go to tour15 !



pawn Код:
+1 Reputation
Reply
#7

Enjoy, PM me if any other problems appear
Reply
#8

Can you help me with this: https://sampforum.blast.hk/showthread.php?tid=272697 ?

Thanks !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)