SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/04/2018, 10:07 AM   #1
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,065
Reputation: 106
Default Virtual world Desync/world problem

I have a script which saves the coordinates of where the player was standing when the player entered a house.
This is done because after a player changed his character or logged out. He became stuck in the interior because the exit was made with createdynamicpickup. So when the player switches to this specific character again. He gets teleported outside of the house.

The problem here is that it looks like the virtual world hasn't changed but the coords are correct.
However when i type /whereami (a command i created to check position and coords.) it shows me the right coords + virtual world 0.

But instead it looks like this as if the virtual world is still the same as the house int:

Click here for screenshot

Now i wonder if this is a desync problem or a virtual world bug? Anyone familiar with this problem? Any help would be appreciated.

Code:
PHP Code:
if(HasEnteredHouse[playerid] == 1)
    {
        
SetPlayerPos(playerid,HasEnteredHouseX[playerid],HasEnteredHouseY[playerid],HasEnteredHouseZ[playerid]);
         
SetPlayerVirtualWorld(playerid0);
        new 
DBResult:CLEAR_HENTER_RESULT;
        new 
szQuery3[128];
        
format(szQuery3sizeof(szQuery3), "delete from `ENTEREDHOUSE` where `CHARID` = '%d'"CHARID[playerid]);
        
CLEAR_HENTER_RESULT db_query(LARP_DATABASEszQuery3);
        
db_free_result(CLEAR_HENTER_RESULT);
        
    } else {
         
SetPlayerPos(playerid,pX[playerid],pY[playerid],pZ[playerid]);
         
SetPlayerVirtualWorld(playerid0);
     } 
Note: This problem only occurs when the players virtual world is NOT 0.
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 25/04/2018, 10:12 AM   #2
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,917
Reputation: 258
Default Re: Virtual world Desync/world problem

What about interior? On your screen, there is some vehicles spawned already so you might be on the correct virtual world with the wrong interiorid. http://wiki.sa-mp.com/wiki/SetPlayerInterior
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 25/04/2018, 10:20 AM   #3
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,065
Reputation: 106
Default Re: Virtual world Desync/world problem

Quote:
Originally Posted by Dayrion View Post
What about interior? On your screen, there is some vehicles spawned already so you might be on the correct virtual world with the wrong interiorid. http://wiki.sa-mp.com/wiki/SetPlayerInterior
Thank you very much this fixed the problem. I haven't considered about that one yet. I've been trying to fix this for 3 days now and the playerinteriors hadn't slipped my mind yet.
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 25/04/2018, 10:26 AM   #4
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,917
Reputation: 258
Default Re: Virtual world Desync/world problem

Quote:
Originally Posted by jasperschellekens View Post
Thank you very much this fixed the problem. I haven't considered about that one yet. I've been trying to fix this for 3 days now and the playerinteriors hadn't slipped my mind yet.
You are welcome. Have a good day.
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion 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
Set Virtual world problem Shadowsea Scripting Help 1 12/04/2018 09:19 AM
Virtual World problem maximthepain Scripting Help 15 24/03/2015 10:28 PM
Virtual World problem MrBlake Scripting Help 3 04/11/2012 12:01 PM
Problem with Virtual World GrInDzO Help Archive 12 13/04/2011 03:41 PM


All times are GMT. The time now is 02:49 AM.


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