Players are invisible when entering interiors
#1

I made an enter/exit system for my server and I have spent (way too) much time on it only for it to give me this weird bug that is so frustrating.

So, the way it works is, each /enter point has its own unique ID - this unique ID is used to set the player's virtual world, and to put him there when he spawns (it is stored in the player data as "IntID").

Anyways, I tested it out with a friend, and when we type in /enter, we both get sent to the same interior, same virtual world and in the MySQL database even the "IntID" value is the same (just like it should be). But for some reason, it completely messes everything up when it comes to player visibility.

When I am inside with another player, we don't see each other, but we can talk to each other and we will see the chat. Even when we go outside, we just can't see each other.

I really don't know what's causing this, but I have had this problem before on a script that I downloaded... I was hoping it wouldn't occur again after I made my /own/ script this time, but here I am, asking for support.

This is the /enter command.
pawn Code:
CMD:enter(playerid, params[])
{
    if(Dead[playerid] != 0) return SCM(playerid, COLOR_WARNING, "SERVER: You can't use this command while brutally wounded!");
   
    if(IsNear(playerid, 2.0, 1845.3463,-1873.9297,13.5889)) SendToInterior(playerid, 1);
    if(IsNear(playerid, 2.0, 2244.4397,-1665.1970,15.4766)) SendToInterior(playerid, 2);
   
    if(IsNear(playerid, 2.0, 1555.0477,-1675.6083,16.1953)) SendToInterior(playerid, 7);
   
    if(IsNear(playerid, 2.0, 2105.1631,-1806.4504,13.5547)) SendToInterior(playerid, 3);
    if(IsNear(playerid, 2.0, 1199.1548,-918.3701,43.1222)) SendToInterior(playerid, 4);
    if(IsNear(playerid, 2.0, 1038.2531,-1340.3801,13.7408)) SendToInterior(playerid, 5);
    if(IsNear(playerid, 2.0, 1567.9523,-1897.7279,13.5608))
    {
        if(GetPlayerMoney(playerid) >= 500)
        {
            SendToInterior(playerid, 6);
            GivePlayerMoney(playerid, -500);
            SaveStats(playerid);
        }
        else return SCM(playerid, COLOR_WARNING, "[!]{c9c9c9} You cannot afford to enter!");
    }
   
    if(IsNear(playerid, 2.0, 1845.8070,-1862.4299,13.5896)) SendToInterior(playerid, 8);
    if(IsNear(playerid, 2.0, 1929.0356,-1776.3191,13.5469)) SendToInterior(playerid, 9);
    if(IsNear(playerid, 2.0, 2001.8214,-1761.9598,13.5391)) SendToInterior(playerid, 10);
    if(IsNear(playerid, 2.0, 2139.1614,-1742.9899,13.5524)) SendToInterior(playerid, 11);
    if(IsNear(playerid, 2.0, 2101.1729,-1359.5189,23.9844)) SendToInterior(playerid, 12);
    if(IsNear(playerid, 2.0, 1315.5875,-898.1740,39.5781)) SendToInterior(playerid, 13);
    if(IsNear(playerid, 2.0, 1104.9192,-1370.0314,13.9844)) SendToInterior(playerid, 14);
   
    return 1;
}
As you can see, I am using a function that I have declared, which is "SendToInterior":
pawn Code:
stock SendToInterior(playerid, intid)
{
    switch(intid)
    {
        //CLOTHING SHOPS
        case 1:
        {
            SetPlayerInterior(playerid, 1);
            SetPlayerVirtualWorld(playerid, 1);
            SetPlayerPos(playerid, 203.9249, -50.3102, 1002.1138);
            Player[playerid][IntID] = 1;
            SaveStats(playerid);
            SCM(playerid, 0xcFFFF00FF, "[UNITY CLOTHES SHOP] - /buyclothes");
            GameTextForPlayer(playerid, "~y~UNITY CLOTHES SHOP", 2000, 1);
        }
        case 2:
        {
            SetPlayerInterior(playerid, 15);
            SetPlayerVirtualWorld(playerid, 2);
            SetPlayerPos(playerid, 207.6551, -110.8501, 1005.1328);
            Player[playerid][IntID] = 2;
            SaveStats(playerid);
            SCM(playerid, 0xcFFFF00FF, "[BINCO] - /buyclothes");
            GameTextForPlayer(playerid, "~y~BINCO", 2000, 1);
        }
        //POLICE STATIONS
        case 7:
        {
            SetPlayerInterior(playerid, 10);
            SetPlayerVirtualWorld(playerid, 7);
            SetPlayerPos(playerid, 246.3829, 107.5783, 1003.2188);
            Player[playerid][IntID] = 7;
            SaveStats(playerid);
            GameTextForPlayer(playerid, "~b~LSPD HQ", 2000, 1);
        }
        //RESTAURANTS
        case 3:
        {
            SetPlayerInterior(playerid, 5);
            SetPlayerVirtualWorld(playerid, 3);
            SetPlayerPos(playerid, 372.3853, -133.4391, 1001.4995);
            Player[playerid][IntID] = 3;
            SaveStats(playerid);
            SCM(playerid, 0xcFFFF00FF, "[PIZZA STACKS] - /eat");
            GameTextForPlayer(playerid, "~y~PIZZA STACKS", 2000, 1);
        }
        case 4:
        {
            SetPlayerInterior(playerid, 10);
            SetPlayerVirtualWorld(playerid, 4);
            SetPlayerPos(playerid, 363.1222, -75.0495, 1001.5078);
            Player[playerid][IntID] = 4;
            SaveStats(playerid);
            SCM(playerid, 0xcFFFF00FF, "[BURGER SHOT] - /eat");
            GameTextForPlayer(playerid, "~y~BURGER SHOT", 2000, 1);
        }
        case 5:
        {
            SetPlayerInterior(playerid, 17);
            SetPlayerVirtualWorld(playerid, 5);
            SetPlayerPos(playerid, 377.1698, -193.0990, 1000.7658);
            Player[playerid][IntID] = 5;
            SaveStats(playerid);
            SCM(playerid, 0xcFFFF00FF, "[RUSTY BROWN'S DONUTS] - /eat");
            GameTextForPlayer(playerid, "~y~RUSTY BROWN'S", 2000, 1);
        }
        case 6:
        {
            SetPlayerInterior(playerid, 1);
            SetPlayerVirtualWorld(playerid, 6);
            SetPlayerPos(playerid, -794.9139, 489.8006, 1376.4384);
            Player[playerid][IntID] = 6;
            SaveStats(playerid);
            SCM(playerid, 0xcFFFF00FF, "[LUIGI'S PIZZERIA] - /eat");
            GameTextForPlayer(playerid, "~y~LUIGI'S PIZZA", 2000, 1);
        }
        //STORES
        case 8:
        {
            SetPlayerInterior(playerid, 6);
            SetPlayerVirtualWorld(playerid, 8);
            SetPlayerPos(playerid, -27.3813, -58.1704, 1003.5394);
            Player[playerid][IntID] = 8;
            SaveStats(playerid);
            SCM(playerid, green, "[UNITY 24/7] - /withdraw /balance /buy");
            GameTextForPlayer(playerid, "~g~UNITY 24/7", 2000, 1);
        }
        case 9:
        {
            SetPlayerInterior(playerid, 6);
            SetPlayerVirtualWorld(playerid, 9);
            SetPlayerPos(playerid, -27.3813, -58.1704, 1003.5394);
            Player[playerid][IntID] = 9;
            SaveStats(playerid);
            SCM(playerid, green, "[IDLEWOOD GAS] - /withdraw /balance /buy");
            GameTextForPlayer(playerid, "~g~IDLEWOOD 24/7", 2000, 1);
        }
        case 10:
        {
            SetPlayerInterior(playerid, 6);
            SetPlayerVirtualWorld(playerid, 10);
            SetPlayerPos(playerid, -27.3813, -58.1704, 1003.5394);
            Player[playerid][IntID] = 10;
            SaveStats(playerid);
            SCM(playerid, green, "[69 CENTS ONLY] - /withdraw /balance /buy");
            GameTextForPlayer(playerid, "~g~69 CENTS ONLY", 2000, 1);
        }
        case 11:
        {
            SetPlayerInterior(playerid, 10);
            SetPlayerVirtualWorld(playerid, 11);
            SetPlayerPos(playerid, 6.0912, -31.5119, 1003.5494);
            Player[playerid][IntID] = 11;
            SaveStats(playerid);
            SCM(playerid, green, "[IDLEWOOD 24/7] - /withdraw /balance /buy");
            GameTextForPlayer(playerid, "~g~IDLEWOOD 24/7", 2000, 1);
        }
        case 12:
        {
            SetPlayerInterior(playerid, 6);
            SetPlayerVirtualWorld(playerid, 12);
            SetPlayerPos(playerid, -27.3813, -58.1704, 1003.5394);
            Player[playerid][IntID] = 12;
            SaveStats(playerid);
            SCM(playerid, green, "[JEFFERSON 24/7] - /withdraw /balance /buy");
            GameTextForPlayer(playerid, "~g~JEFFERSON 24/7", 2000, 1);
        }
        case 13:
        {
            SetPlayerInterior(playerid, 6);
            SetPlayerVirtualWorld(playerid, 13);
            SetPlayerPos(playerid, -27.3813, -58.1704, 1003.5394);
            Player[playerid][IntID] = 13;
            SaveStats(playerid);
            SCM(playerid, green, "[MULHOLLAND 24/7] - /withdraw /balance /buy");
            GameTextForPlayer(playerid, "~g~MULHOLLAND 24/7", 2000, 1);
        }
        case 14:
        {
            SetPlayerInterior(playerid, 10);
            SetPlayerVirtualWorld(playerid, 14);
            SetPlayerPos(playerid, 6.0912, -31.5119, 1003.5494);
            Player[playerid][IntID] = 14;
            SaveStats(playerid);
            SCM(playerid, green, "[VERONA MALL 24/7] - /withdraw /balance /buy");
            GameTextForPlayer(playerid, "~g~MALL 24/7", 2000, 1);
        }
    }
}
And for some reason it doesn't work! I even tried to manually set me and my friend's virtual worlds to the same one, and it still doesn't work. Can anyone please help? I will make sure to give REP+.
Reply
#2

a simple fix, check for virtual worlds players cant be invisible if they are on different virtual world. that's it.
Reply
#3

Set Player's VW same as the object ID (or interior entrance ID) instead of setting it manually. Sometimes it can work.
Reply
#4

Quote:
Originally Posted by Mobtiesgangsa
View Post
a simple fix, check for virtual worlds players cant be invisible if they are on different virtual world. that's it.
Aren't players supposed to be invisible if they are in different virtual worlds?

Quote:
Originally Posted by GTLS
View Post
Set Player's VW same as the object ID (or interior entrance ID) instead of setting it manually. Sometimes it can work.
What do you mean? I assigned each business ID to the virtual world, let me show you the list:

pawn Code:
/*
Each interior pickup has its own name, and ID.
Each interior has its own virtual world too, so it doesn't glitch out
Each time a player uses /enter, a unique business ID will be assigned to him too (PlayerData >> IntID)

List of Interior IDs:
---CLOTHES---
"Unity Clothing Shop" - Unity - INT 1
"Binco" - Ganton - INT 2
---RESTAURANTS---
"Pizza Stacks" - Idlewood - INT 3
"Burger Shot" - Mulholland - INT 4
"Jim's Sticky Ring" - Mall - INT 5
"Luigi's Pizzeria" - Pershing Square - INT 6
---POLICE STATIONS---
"Los Santos Police Department HQ" - Pershing Square - INT 7
---STORES---
"Unity 24/7" - Unity - INT 8
"Idlewood Gas" - Idlewood Gas Station - INT 9
"69 Cents Only" - Idlewood - INT 10
"Idlewood 24/7" - Idlewood - INT 11
"Jefferson 24/7" - Jefferson - INT 12
"Mulholland 24/7" - Mulholland - INT 13
"Verona Mall 24/7" - Mall - INT 14

*/
So, for example, if player enters "Unity 24/7", in the PlayerData his "IntID" value will be 8, and his virtual world will also be 8.
Reply
#5

I was trying to say is, each entrance pickup has a pickup ID right? So set player's Virtualworld, equal to the pickup ID they enter.
Reply
#6

Quote:
Originally Posted by GTLS
View Post
I was trying to say is, each entrance pickup has a pickup ID right? So set player's Virtualworld, equal to the pickup ID they enter.
Well, actually, the pickups are only there to show the text. /enter works entirely based on which position player is in (is player in range of point).

But, what you mean is, e.g.

pawn Code:
StorePickup[1] = CreateDynamicPickup(blah)

CMD:enter
{
if(IsNear(coords) then SetPlayerVirtualWorld(playerid, StorePickup[1])
}
Reply
#7

Quote:
Originally Posted by DomagojSellug
View Post
Well, actually, the pickups are only there to show the text. /enter works entirely based on which position player is in (is player in range of point).

But, what you mean is, e.g.

pawn Code:
StorePickup[1] = CreateDynamicPickup(blah)

CMD:enter
{
if(IsNear(coords) then SetPlayerVirtualWorld(playerid, StorePickup[1])
}
Yes like that. It reduces the hassle of VWs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)