SA-MP Forums Archive
SAMP interior bug... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SAMP interior bug... (/showthread.php?tid=421893)



SAMP interior bug... - Squirrel - 11.03.2013

Well I got an issue. Each time player enters a house he gets teleported to an interior but he cannot see it. No one can see the interior even if you are inside of it. There are walls etc. but you cannot see them.

Код:
CreateHouse("Bayside Nr.1", 200000, -2348.9600,2422.9646,7.3428, 1.808619,32.384357,1199.593750, 100000, 1);
Usage of the CreateHouse is
Код:
CreateHouse(HouseName[], CostP, Float:EnterX, Float:EnterY, Float:EnterZ, Float:TeleX, Float:TeleY, Float:TeleZ, SellP, Interiorx)
Create house fully explained
Код:
stock CreateHouse(HouseName[], CostP, Float:EnterX, Float:EnterY, Float:EnterZ, Float:TeleX, Float:TeleY, Float:TeleZ, Interiorx, SellP)
{
    format(HouseInformation[houseid][Hname], 100, "%s", HouseName);
    HouseInformation[houseid][costprice] = CostP;
    HouseInformation[houseid][EnterPos][0] = EnterX;
    HouseInformation[houseid][EnterPos][1] = EnterY;
    HouseInformation[houseid][EnterPos][2] = EnterZ;
    HouseInformation[houseid][TelePos][0] = TeleX;
    HouseInformation[houseid][TelePos][1] = TeleY;
    HouseInformation[houseid][TelePos][2] = TeleZ;
    HouseInformation[houseid][sellprice] = SellP;
    HouseInformation[houseid][interiors] = Interiorx;
    format(fquery, sizeof(fquery), "SELECT houseowner FROM HOUSEINFO WHERE housename = '%s'", HouseName); 
    queryresult = db_query(database, fquery); 
    if(db_num_rows(queryresult) != 0) db_get_field_assoc(queryresult, "houseowner", HouseInformation[houseid][owner], 24); 
    HouseInformation[houseid][checkpointidx][0] = CreateDynamicCP(EnterX, EnterY, EnterZ, 1.0);
    HouseInformation[houseid][checkpointidx][1] = CreateDynamicCP(TeleX, TeleY, TeleZ, 1.0, 15500000+houseid, Interiorx);
    if(!HouseInformation[houseid][owner][0]) format(fquery, sizeof(fquery), "House Name: %s \n House Price:$%d \n Sell Price: $%d", HouseName, CostP, SellP);
    else if(HouseInformation[houseid][owner][0] != 0) format(fquery, sizeof(fquery), "House Name: %s \n Owner: %s", HouseName, HouseInformation[houseid][owner]);
    HouseInformation[houseid][textid] = CreateDynamic3DTextLabel(fquery, 0xFFFFFF, EnterX, EnterY, EnterZ + 0.5, 50.0);
    houseid ++; 
    return 1;
}
Entering the house
Код:
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    for(new x; x<houseid; x++) 
    {
        if(HouseInformation[x][checkpointidx][0] == checkpointid)  
        {
            if(InHouse[playerid] != -1)
            {
                InHouse[playerid] = -1; 
                return 1;
            }
            InHouseCP[playerid] = x; 
            new Pname[24]; 
            GetPlayerName(playerid, Pname, 24); 
            if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0]))
            {
                SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
                SetPlayerInterior(playerid, HouseInformation[x][interiors]); 
                SetPlayerVirtualWorld(playerid, 15500000 + x); 
            }
            if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "This house is for sale /buy to buy it!");
            return 1;
        }
        if(HouseInformation[x][checkpointidx][1] == checkpointid) 
        {
            if(InHouse[playerid] == -1)
            {
                InHouse[playerid] = x;
                return 1;
            }
            SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]);
            SetPlayerInterior(playerid, 0); 
            SetPlayerVirtualWorld(playerid, 0); 
            return 1;
        }
    }
    return 1;
}
Interior is like invisible but you are inside of it.


Re: SAMP interior bug... - LetsOWN[PL] - 11.03.2013

Hello,
I have no idea whats going on.. Check, if player interior has been changed when entered house:

pawn Код:
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    for(new x; x<houseid; x++)
    {
        if(HouseInformation[x][checkpointidx][0] == checkpointid)  
        {
            if(InHouse[playerid] != -1)
            {
                InHouse[playerid] = -1;
                return 1;
            }
            InHouseCP[playerid] = x;
            new Pname[24];
            GetPlayerName(playerid, Pname, 24);
            if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0]))
            {
                SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
                SetPlayerInterior(playerid, HouseInformation[x][interiors]);
                printf("Interior: %d", HouseInformation[x][interiors]); // <<<<<
                SetPlayerVirtualWorld(playerid, 15500000 + x);
            }
            if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "This house is for sale /buy to buy it!");
            return 1;
        }
        if(HouseInformation[x][checkpointidx][1] == checkpointid)
        {
            if(InHouse[playerid] == -1)
            {
                InHouse[playerid] = x;
                return 1;
            }
            SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
        }
    }
    return 1;
}
See in SAMP output, if interior is bigger than 0.

Greetz,
LetsOWN



Re: SAMP interior bug... - Squirrel - 11.03.2013

Doesnt help

Here is how it looks like



Re: SAMP interior bug... - LetsOWN[PL] - 11.03.2013

Perhaps you understood me badly..

Lets try again.
pawn Код:
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    for(new x; x<houseid; x++)
    {
        if(HouseInformation[x][checkpointidx][0] == checkpointid)  
        {
            if(InHouse[playerid] != -1)
            {
                InHouse[playerid] = -1;
                return 1;
            }
            InHouseCP[playerid] = x;
            new Pname[24];
            GetPlayerName(playerid, Pname, 24);
            if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0]))
            {
                SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
                SetPlayerInterior(playerid, HouseInformation[x][interiors]);
               
new debugStr[214];
new myIntr;
myIntr = GetPlayerInterior(playerid);
format(debugStr, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr);
SendClientMessage(playerid, 0xFF0000FF, debugStr);
                SetPlayerVirtualWorld(playerid, 15500000 + x);
            }
            if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "This house is for sale /buy to buy it!");
            return 1;
        }
        if(HouseInformation[x][checkpointidx][1] == checkpointid)
        {
            if(InHouse[playerid] == -1)
            {
                InHouse[playerid] = x;
                return 1;
            }
            SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
        }
    }
    return 1;
}
Paste THIS code, go back into game, enter a house, get ss and post it here.

Greetz,
LetsOWN



Re: SAMP interior bug... - Squirrel - 11.03.2013

Error

Код:
format(debugStr, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr);
error 035: argument type mismatch (argument 2)


Re: SAMP interior bug... - LetsOWN[PL] - 11.03.2013

Quote:
Originally Posted by Squirrel
Посмотреть сообщение
Error

Код:
format(debugStr, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr);
error 035: argument type mismatch (argument 2)
My bad, however if you werent so distracted, you would notice what caused error

pawn Код:
format(debugStr, 214, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr);
Greetz,
LetsOWN



Re: SAMP interior bug... - Squirrel - 11.03.2013

Yeah lmao

Here is it how it looks now. I'll add a link to the picture bellow.

http://imageshack.us/photo/my-images/194/samp150y.png/


Re: SAMP interior bug... - LetsOWN[PL] - 11.03.2013

Good job
Okay, so as you could see, your interior were 0 (and could be higher).
Check if everything is ok when loading your 'interior' variable from DB.

Perhaps there is small mistake there.
Good luck!

Greetz,
LetsOWN



Re: SAMP interior bug... - Squirrel - 11.03.2013

I dont really understand lite that much.
Код:
database = db_open(databasename);
    db_query(database, "CREATE TABLE IF NOT EXISTS `HOUSEINFO` (housename varchar(51), houseowner varchar(25))");



Re: SAMP interior bug... - LetsOWN[PL] - 11.03.2013

Quote:
Originally Posted by Squirrel
Посмотреть сообщение
I dont really understand lite that much.
Код:
database = db_open(databasename);
    db_query(database, "CREATE TABLE IF NOT EXISTS `HOUSEINFO` (housename varchar(51), houseowner varchar(25))");
It creates table called 'HOUSEINFO' in (databasename=??).db in ur scriptfiles with subtables housename and houseowner.

But.. Can you post here code which loads all houses?