SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/08/2019, 09:55 PM   #1
DomagojSellug
Big Clucker
 
DomagojSellug's Avatar
 
Join Date: Sep 2016
Location: Croatia
Posts: 197
Reputation: 22
Default Players are invisible when entering interiors

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+.
__________________
My work:


Weapon Shop FS
Click on me!
DomagojSellug is offline   Reply With Quote
Old 09/08/2019, 09:57 PM   #2
Mobtiesgangsa
Big Clucker
 
Join Date: Oct 2016
Posts: 131
Reputation: 16
Default Re: Players are invisible when entering interiors

a simple fix, check for virtual worlds players cant be invisible if they are on different virtual world. that's it.
Mobtiesgangsa is offline   Reply With Quote
Old 10/08/2019, 07:08 AM   #3
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,048
Reputation: 115
Default Re: Players are invisible when entering interiors

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

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 10/08/2019, 12:45 PM   #4
DomagojSellug
Big Clucker
 
DomagojSellug's Avatar
 
Join Date: Sep 2016
Location: Croatia
Posts: 197
Reputation: 22
Default Re: Players are invisible when entering interiors

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.
__________________
My work:


Weapon Shop FS
Click on me!
DomagojSellug is offline   Reply With Quote
Old 10/08/2019, 01:36 PM   #5
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,048
Reputation: 115
Default Re: Players are invisible when entering interiors

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.
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 10/08/2019, 02:06 PM   #6
DomagojSellug
Big Clucker
 
DomagojSellug's Avatar
 
Join Date: Sep 2016
Location: Croatia
Posts: 197
Reputation: 22
Default Re: Players are invisible when entering interiors

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])
}
__________________
My work:


Weapon Shop FS
Click on me!
DomagojSellug is offline   Reply With Quote
Old 12/08/2019, 05:29 PM   #7
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,048
Reputation: 115
Default Re: Players are invisible when entering interiors

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.
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Entering interiors zgintasz Scripting Help 4 01/05/2012 12:30 PM
Game Freezes While Entering Some Interiors lyrical General 2 18/04/2011 02:41 AM
Help, With Entering Mapped Interiors Matthew_Johnston Help Archive 6 11/09/2010 05:41 AM
Warning on entering in some of the interiors ( NOT ALL ) silvan Help Archive 0 18/02/2010 05:27 PM
Entering interiors Ace_Steele Help Archive 2 02/07/2009 06:08 AM


All times are GMT. The time now is 10:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.