Problem with houses.
#1

Right, so I've got this problem. It's regarding the SC:RP script.


I create, for example, an admin vehicle in the normal world (virtual world 0).
Then, I enter a house, and when I come back, the vehicle is not there. I know everyone will say ohh it's a problem with virtual worlds / interiors but IT'S NOT, because when I set them manually with /setint / /setvw to 0 it's still not there.

Can you guys help me out?

P.S: I'll provide any part of the script you need.
Reply
#2

What about showing code? Don't think people have the ability here to guess everything. No code posted = no effort made to help
Reply
#3

Код:
 if ((id = House_Nearest(playerid)) != -1)
	    {
	        if (HouseData[id][houseLocked])
	            return SendErrorMessage(playerid, "You cannot enter a locked house.");

			SetPlayerPos(playerid, HouseData[id][houseInt][0], HouseData[id][houseInt][1], HouseData[id][houseInt][2]);
			SetPlayerFacingAngle(playerid, HouseData[id][houseInt][3]);

			SetPlayerInterior(playerid, HouseData[id][houseInterior]);
			SetPlayerVirtualWorld(playerid, HouseData[id][houseID] + 5000);

			SetCameraBehindPlayer(playerid);
			PlayerData[playerid][pHouse] = HouseData[id][houseID];
			return 1;
		}
		if ((id = House_Inside(playerid)) != -1 && IsPlayerInRangeOfPoint(playerid, 2.5, HouseData[id][houseInt][0], HouseData[id][houseInt][1], HouseData[id][houseInt][2]))
	    {
			SetPlayerPos(playerid, HouseData[id][housePos][0], HouseData[id][housePos][1], HouseData[id][housePos][2]);
			SetPlayerFacingAngle(playerid, HouseData[id][housePos][3] - 180.0);

			SetPlayerInterior(playerid, HouseData[id][houseExterior]);
			SetPlayerVirtualWorld(playerid, HouseData[id][houseExteriorVW]);

			SetCameraBehindPlayer(playerid);
			PlayerData[playerid][pHouse] = -1;
			return 1;
		}
That one's for entering / exiting the house
Reply
#4

Did you try to debug your data? print the values to see if it is related to your code.
Use printf(); to print shitzel in your logs
Reply
#5

I get this sort of stuff.

Note: I restarted the server and I spawned again in the normal world, but when I again entered the house, it bugged again.

Код:
[21:26:12] Number of vehicle models: 1
[21:26:12] New version of CrashDetect is available for download (4.13)
[21:26:45] [connection] incoming connection: 127.0.0.1:63124 id: 0
[21:26:45] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:26:45] [join] LctMF has joined the server (0:127.0.0.1)
[21:27:07] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:07] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:10] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:15] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:16] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:16] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:16] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:17] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:18] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:18] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[21:27:18] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
Reply
#6

What i actually said is, debug:
Код:
SetPlayerVirtualWorld(playerid, HouseData[id][houseExteriorVW]);
Are you 100 percent sure HouseData[id][houseExteriorVW] is set to 0?

otherwise it may be a desync bug or something
Reply
#7

Код:
House_Create(playerid, address[], price)
{
	static
	    Float:x,
	    Float:y,
	    Float:z,
		Float:angle;

	if (GetPlayerPos(playerid, x, y, z) && GetPlayerFacingAngle(playerid, angle))
	{
		for (new i = 0; i != MAX_HOUSES; i ++)
		{
	    	if (!HouseData[i][houseExists])
		    {
    	        HouseData[i][houseExists] = true;
        	    HouseData[i][houseOwner] = 0;
            	HouseData[i][housePrice] = price;
            	HouseData[i][houseMoney] = 0;

				format(HouseData[i][houseAddress], 32, address);

    	        HouseData[i][housePos][0] = x;
    	        HouseData[i][housePos][1] = y;
    	        HouseData[i][housePos][2] = z;
    	        HouseData[i][housePos][3] = angle;

                HouseData[i][houseInt][0] = 2269.8772;
                HouseData[i][houseInt][1] = -1210.3240;
                HouseData[i][houseInt][2] = 1047.5625;
                HouseData[i][houseInt][3] = 90.0000;

				HouseData[i][houseInterior] = 10;
				HouseData[i][houseExterior] = GetPlayerInterior(playerid);
				HouseData[i][houseExteriorVW] = GetPlayerVirtualWorld(playerid);

				HouseData[i][houseLights] = false;
				HouseData[i][houseLocked] = false;

				House_Refresh(i);
				mysql_tquery(g_iHandle, "INSERT INTO `houses` (`houseOwner`) VALUES(0)", "OnHouseCreated", "d", i);
				return i;
			}
		}
	}
	return -1;
}
This is at house_create
Reply
#8

Try this m8

PHP код:
#define MAX_HOUSES 500
//Don't store information such as ID of entered house in player data enum, it has nothing to do with it. Instead, you can create a new variable:
// Top
new bool:IsInHouse[MAX_PLAYERS];
public 
OnPlayerDisconnect(playeridreason)
{
    
bool:IsInHouse[playerid] = false;
    return 
1;
}
CMD:exit(playerid)
{
    for(new 
0MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.5HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
        {
            
SetPlayerPos(playeridHouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]);
            
SetPlayerFacingAngle(playeridHouseData[i][housePos][3] - 180.0);
            
SetPlayerVirtualWorld(playeridHouseData[i][houseExteriorVW]); // I don't know why you use this, you should have a default virtual world and reset it
            
SetCameraBehindPlayer(playerid);
            
IsInHouse[playerid] = false;
            break;
        }
    }
    return 
1;
}
CMD:enter(playerid)
{
    for(new 
0MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.5HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
        {
            if(
HouseData[i][houseLocked]) return SendErrorMessage(playerid"You cannot enter a locked house.");
            
SetPlayerPos(playeridHouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2]);
            
SetPlayerFacingAngle(playeridHouseData[i][houseInt][3]);
            
SetPlayerInterior(playeridHouseData[i][houseInterior]);
            
SetPlayerVirtualWorld(playeridi); // You can just use house id as virtual world, it won't mix with others
            
SetCameraBehindPlayer(playerid);
            
IsInHouse[playerid] = true;
            break;
        }
    }
    return 
1;

Reply
#9

Quote:
Originally Posted by kovac
Посмотреть сообщение
Try this m8

PHP код:
#define MAX_HOUSES 500
//Don't store information such as ID of entered house in player data enum, it has nothing to do with it. Instead, you can create a new variable:
// Top
new bool:IsInHouse[MAX_PLAYERS];
public 
OnPlayerDisconnect(playeridreason)
{
    
bool:IsInHouse[playerid] = false;
    return 
1;
}
CMD:exit(playerid)
{
    for(new 
0MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.5HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
        {
            
SetPlayerPos(playeridHouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]);
            
SetPlayerFacingAngle(playeridHouseData[i][housePos][3] - 180.0);
            
SetPlayerVirtualWorld(playeridHouseData[i][houseExteriorVW]); // I don't know why you use this, you should have a default virtual world and reset it
            
SetCameraBehindPlayer(playerid);
            
IsInHouse[playerid] = false;
            break;
        }
    }
    return 
1;
}
CMD:enter(playerid)
{
    for(new 
0MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.5HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
        {
            if(
HouseData[i][houseLocked]) return SendErrorMessage(playerid"You cannot enter a locked house.");
               
SetPlayerPos(playeridHouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2]);
            
SetPlayerFacingAngle(playeridHouseData[i][houseInt][3]);
            
SetPlayerInterior(playeridHouseData[i][houseInterior]);
            
SetPlayerVirtualWorld(playeridi); // You can just use house id as virtual world, it won't mix with others
            
SetCameraBehindPlayer(playerid);
            
IsInHouse[playerid] = true;
            break;
        }
    }
    return 
1;

I'm using KEY_FIRE or w/e for that
Reply
#10

Literally this

Код:
	else if (newkeys & KEY_SECONDARY_ATTACK)
	{
		static
		    id = -1;
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)