SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/01/2020, 09:20 PM   #1
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Bug help please!

Well, I have a bug that when I enter house/biz/apartment/complex and than exit I can't see people/vehicles but can see chat etc, player interior and vw moves to 0 after leaving one of those but when I do /near its says that i'm inside
for example: House ID 14.
and i'm not even far from it.

that's the /exit code.


PHP Code:
CMD:exit(playeridparams[])
{
    if(!
pLoggedIn[playerid])return true;

    if(
PlayerData[playerid][pEditingFurniture] && PlayerData[playerid][pEditingDuplicate])
        return 
SendClientMessage(playeridCOLOR_ADM"ACCESS DENIED:{FFFFFF} You can't /exit anywhere while editing furniture.");

    if(
PlayerData[playerid][pAdjustPackage] != -1)
        return 
SendClientMessage(playeridCOLOR_ADM"ACCESS DENIED:{FFFFFF} You can't /exit anywhere while adjusting a package.");

    for(new 
0MAX_PROPERTYh++)
    {
        if(
PropertyData[h][propertyid] != 0){
            if(
PropertyData[h][propertyType] == 2){
                if(
IsPlayerInRangeOfPoint(playerid3.0PropertyData[h][propertyInterior][0], PropertyData[h][propertyInterior][1], PropertyData[h][propertyInterior][2]) && PlayerData[playerid][pInsideApartment] == h){
                    if(
GetPlayerVirtualWorld(playerid) == PropertyData[h][propertyInteriorWorld]){
                        
SendPlayer(playeridPropertyData[h][propertyExterior][0], PropertyData[h][propertyExterior][1], PropertyData[h][propertyExterior][2], PropertyData[h][propertyExteriorID], PropertyData[h][propertyExteriorWorld]);
                        
PlayerData[playerid][pInsideApartment] = 0;
                        
PlayerData[playerid][pInsideComplex] = PropertyData[h][propertyComplexLink];

                        
StopAudioStreamForPlayer(playerid);

                    }
                }
            }
            else{
                if(
IsPlayerInRangeOfPoint(playerid3.0PropertyData[h][propertyInterior][0], PropertyData[h][propertyInterior][1], PropertyData[h][propertyInterior][2])){
                    if(
GetPlayerVirtualWorld(playerid) == PropertyData[h][propertyInteriorWorld]){
                        
SendPlayer(playeridPropertyData[h][propertyExterior][0], PropertyData[h][propertyExterior][1], PropertyData[h][propertyExterior][2], 00);
                        
PlayerData[playerid][pInsideComplex] = 0;
                        
PlayerData[playerid][pInsideHouse] = 0;

                        
StopAudioStreamForPlayer(playerid);
                    }
                }
            }
        }
    }

    for(new 
0MAX_BUSINESSb++)
    {
        if(
BusinessData[b][businessID] != 0){
            if(
IsPlayerInRangeOfPoint(playerid3.0BusinessData[b][businessInt][0], BusinessData[b][businessInt][1], BusinessData[b][businessInt][2])){
                if(
GetPlayerVirtualWorld(playerid) == BusinessData[b][businessWorld]){
                    
SendPlayer(playeridBusinessData[b][businessExt][0], BusinessData[b][businessExt][1], BusinessData[b][businessExt][2], 00);
                    
PlayerData[playerid][pInsideBusiness] = 0;
                }
            }
        }
    }

    for(new 
0MAX_DOORSi++)
    {
        if(
DoorData[i][doorID] != 0)
        {
            if(
IsPlayerInRangeOfPoint(playerid4.0DoorData[i][doorInt][0], DoorData[i][doorInt][1], DoorData[i][doorInt][2]))
            {
                if(
GetPlayerVirtualWorld(playerid) == DoorData[i][doorIntWorld])
                {
                    
SendPlayer(playeridDoorData[i][doorPos][0], DoorData[i][doorPos][1], DoorData[i][doorPos][2], DoorData[i][doorPosIntID], DoorData[i][doorPosWorld]);
                    
PlayerData[playerid][pInsideDoor] = i;
                }
            }
        }
    }

    for(new 
0MAX_PROPERTY_GARAGESg++)
    {
        if(
GarageData[g][garageSQLID] != 0)
        {
            if(
IsPlayerInRangeOfPoint(playerid4.0GarageData[g][garageInt][0], GarageData[g][garageInt][1], GarageData[g][garageInt][2]))
            {
                if(
GetPlayerVirtualWorld(playerid) == GarageData[g][garageWorld])
                {
                    
SendPlayer(playeridGarageData[g][garagePos][0], GarageData[g][garagePos][1], GarageData[g][garagePos][2], 00);

                    
PlayerData[playerid][pInsideGarage] = 0;

                    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                    {
                        
//SetVehicleZAngle(GetPlayerVehicleID(playerid), GarageData[g][garagePos][3]);

                        
foreach(new Player)
                        {
                            if(
IsPlayerInVehicle(iGetPlayerVehicleID(playerid)))
                            {
                                
SetPlayerInterior(i0);
                                
SetPlayerVirtualWorld(i0);
                                
PlayerData[i][pInsideGarage] = 0;
                            }
                        }
                    }
                }
            }
        }
    }

    new 
idx;
    if(
IsPlayerInsideEntrance(playerid) != -1)
    {
        
idx IsPlayerInsideEntrance(playerid);
        
ExitEntrance(playerididx);
    }

    return 
true;

salev13 is offline   Reply With Quote
Old 26/01/2020, 02:49 AM   #2
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 614
Reputation: 57
Default Re: Bug help please!

Reset Player Virtual World and Interior to 0 when you exit.
SiaReyes is offline   Reply With Quote
Old 26/01/2020, 08:36 AM   #3
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: Bug help please!

Quote:
Originally Posted by SiaReyes View Post
Reset Player Virtual World and Interior to 0 when you exit.
Players getting vw and int to 0 when exit.

Want to show me how?
salev13 is offline   Reply With Quote
Old 26/01/2020, 09:21 AM   #4
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 364
Reputation: 17
Default Re: Bug help please!

Quote:
Originally Posted by salev13 View Post
Players getting vw and int to 0 when exit.

Want to show me how?
Code:
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
However, it seems you've already got a similar function:
Code:
SendPlayer(playerid, DoorData[i][doorPos][0], DoorData[i][doorPos][1], DoorData[i][doorPos][2], DoorData[i][doorPosIntID], DoorData[i][doorPosWorld]);
You may want to consider debugging what this does (printing the parameters in the function)
__________________
Developer @ Trucknation
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Old 26/01/2020, 09:51 AM   #5
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: Bug help please!

Quote:
Originally Posted by Proxus View Post
Code:
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
However, it seems you've already got a similar function:
Code:
SendPlayer(playerid, DoorData[i][doorPos][0], DoorData[i][doorPos][1], DoorData[i][doorPos][2], DoorData[i][doorPosIntID], DoorData[i][doorPosWorld]);
You may want to consider debugging what this does (printing the parameters in the function)
It should work because it debug show nothing.
salev13 is offline   Reply With Quote
Old 26/01/2020, 09:57 AM   #6
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 614
Reputation: 57
Default Re: Bug help please!

Show us SendPlayer function.
SiaReyes is offline   Reply With Quote
Old 26/01/2020, 10:03 AM   #7
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: Bug help please!

Quote:
Originally Posted by SiaReyes View Post
Show us SendPlayer function.
PHP Code:
stock SendPlayer(playeridFloatposxFloatposyFloatposzinteriorvirtualworld)
{
    if(
GetPlayerState(playerid) == 2){
        
SetPlayerVirtualWorld(playeridvirtualworld);
        
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), virtualworld);

        
SetPlayerInterior(playeridinterior);
        
LinkVehicleToInterior(GetPlayerVehicleID(playerid), interior);

        
SetVehiclePos(GetPlayerVehicleID(playerid), posxposyposz);
    }
    else{
        
SetPlayerVirtualWorld(playeridvirtualworld);
            
SetPlayerInterior(playeridinterior);
            
SetPlayerPos(playeridposxposyposz);
    }
    return 
true;

salev13 is offline   Reply With Quote
Old 26/01/2020, 10:10 AM   #8
Jstylezzz
High-roller
 
Jstylezzz's Avatar
 
Join Date: Sep 2011
Location: Netherlands
Posts: 1,859
Reputation: 1571
Default Re: Bug help please!

Quote:
Originally Posted by Proxus View Post
You may want to consider debugging what this does (printing the parameters in the function)
This is good advice. On line 17 in the first post you do
Code:
SendPlayer(playerid, PropertyData[h][propertyExterior][0], PropertyData[h][propertyExterior][1], PropertyData[h][propertyExterior][2], PropertyData[h][propertyExteriorID], PropertyData[h][propertyExteriorWorld]);
This looks like the only other part where the interior/vw are not hardcoded to '0'. You might want to add a printf() below that line and check what the values are of PropertyData[h][propertyExteriorID] and PropertyData[h][propertyExteriorWorld] are when you encounter the bug ingame.
Jstylezzz is offline   Reply With Quote
Old 26/01/2020, 10:30 AM   #9
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: Bug help please!

Quote:
Originally Posted by Jstylezzz View Post
This is good advice. On line 17 in the first post you do
Code:
SendPlayer(playerid, PropertyData[h][propertyExterior][0], PropertyData[h][propertyExterior][1], PropertyData[h][propertyExterior][2], PropertyData[h][propertyExteriorID], PropertyData[h][propertyExteriorWorld]);
This looks like the only other part where the interior/vw are not hardcoded to '0'. You might want to add a printf() below that line and check what the values are of PropertyData[h][propertyExteriorID] and PropertyData[h][propertyExteriorWorld] are when you encounter the bug ingame.
Well it looks nothing wrong with it but for some reason its still happened.

PHP Code:
[11:29:50Your world0 Your Interior
salev13 is offline   Reply With Quote
Old 26/01/2020, 10:04 PM   #10
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: Bug help please!

Someone?
salev13 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



All times are GMT. The time now is 11:48 AM.


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