SA-MP Forums Archive
House exit interior - 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: House exit interior (/showthread.php?tid=644114)



House exit interior - Puff - 04.11.2017

PHP код:
housesTryEnterExit(playerid) {
    for(new 
i=0;i<sizeof(Houses);i++) {
        if(
IsPlayerInRangeOfPoint(playerid1.5Houses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ])) {
            if(
IsHouseLocked(i)) {
                
GameTextForPlayer(playerid"~r~Locked"20001);
                return 
1;
            }
            if(
Houses[i][EHouseLights] == 1) {
                
TextDrawShowForPlayer(playeridHouseLightsText);
            }
            if(
Houses[i][EHouseRadioIndex] != -1) {
                new 
url[128];
                
getRadioURL(Houses[i][EHouseRadioIndex], urlsizeof(url));
                
PlayAudioStreamForPlayer(playeridurl);
            }
            
SetPlayerPos(playerid,  Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ]);
            
SetPlayerInterior(playeridHouses[i][EHouseInterior]);
            
SetPlayerVirtualWorld(playeridhouseGetVirtualWorld(i));
        } else if(
IsPlayerInRangeOfPoint(playerid5.0Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ])) {
            if(
GetPlayerVirtualWorld(playerid) == houseGetVirtualWorld(i)) {
                if(
Houses[i][EHouseLights] == 1) {
                    
TextDrawHideForPlayer(playeridHouseLightsText);
                }
                if(
Houses[i][EHouseRadioIndex] != -1) {
                    
StopAudioStreamForPlayer(playerid);
                }
                
SetPlayerPos(playeridHouses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ]);
                
//SetPlayerInterior(playerid, 0);
                
SetPlayerVirtualWorld(playerid0);
            }
        }
    }
    return 
1;

Hey right now if I create a house in an interior e.g Interior ID is 18.. and when I create a house in interior ID 18, I go inside the house it works and all.. and that house interior id is 5.. but when I exit it doesn't change my Interior ID back to 18.. is it possible to do that?


Re: House exit interior - StrikerZ - 04.11.2017

PHP код:
housesTryEnterExit(playerid) { 
    for(new 
i=0;i<sizeof(Houses);i++) { 
        if(
IsPlayerInRangeOfPoint(playerid1.5Houses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ])) { 
            if(
IsHouseLocked(i)) { 
                
GameTextForPlayer(playerid"~r~Locked"20001); 
                return 
1
            } 
            if(
Houses[i][EHouseLights] == 1) { 
                
TextDrawShowForPlayer(playeridHouseLightsText); 
            } 
            if(
Houses[i][EHouseRadioIndex] != -1) { 
                new 
url[128]; 
                
getRadioURL(Houses[i][EHouseRadioIndex], urlsizeof(url)); 
                
PlayAudioStreamForPlayer(playeridurl); 
            } 
            
SetPlayerPos(playerid,  Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ]); 
            
SetPlayerInterior(playeridHouses[i][EHouseInterior]); 
            
SetPlayerVirtualWorld(playeridhouseGetVirtualWorld(i));
            
SetPVarInt(playerid"Interior"GetPlayerInterior(playerid));
        } else if(
IsPlayerInRangeOfPoint(playerid5.0Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ])) { 
            if(
GetPlayerVirtualWorld(playerid) == houseGetVirtualWorld(i)) { 
                if(
Houses[i][EHouseLights] == 1) { 
                    
TextDrawHideForPlayer(playeridHouseLightsText); 
                } 
                if(
Houses[i][EHouseRadioIndex] != -1) { 
                    
StopAudioStreamForPlayer(playerid); 
                } 
                
SetPlayerPos(playeridHouses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ]); 
                
SetPlayerInterior(playeridGetPVarInt(playerid"Interior"));
                
SetPlayerVirtualWorld(playerid0); 
            } 
        } 
    } 
    return 
1




Re: House exit interior - Puff - 04.11.2017

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
PHP код:

                SetPlayerInterior
(playeridGetPVarInt(playerid"Interior"));
                
SetPlayerVirtualWorld(playerid0); 
            } 
        } 
    } 
    return 
1

Thanks man, that fixed the interior problem but I am now having problem with Virtual World.. is itpossible to do that for VW aswell?


Re: House exit interior - StrikerZ - 04.11.2017

PHP код:
housesTryEnterExit(playerid) {
    for(new 
i=0;i<sizeof(Houses);i++) {
        if(
IsPlayerInRangeOfPoint(playerid1.5Houses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ])) {
            if(
IsHouseLocked(i)) {
                
GameTextForPlayer(playerid"~r~Locked"20001);
                return 
1;
            }
            if(
Houses[i][EHouseLights] == 1) {
                
TextDrawShowForPlayer(playeridHouseLightsText);
            }
            if(
Houses[i][EHouseRadioIndex] != -1) {
                new 
url[128];
                
getRadioURL(Houses[i][EHouseRadioIndex], urlsizeof(url));
                
PlayAudioStreamForPlayer(playeridurl);
            }
            
SetPlayerPos(playerid,  Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ]);
            
SetPlayerInterior(playeridHouses[i][EHouseInterior]);
            
SetPlayerVirtualWorld(playeridhouseGetVirtualWorld(i));
            
SetPVarInt(playerid"Interior"GetPlayerInterior(playerid));
            
SetPVarInt(playerid"VirtualW"GetPlayerVirtualWorld(playerid));
        } else if(
IsPlayerInRangeOfPoint(playerid5.0Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ])) {
            if(
GetPlayerVirtualWorld(playerid) == houseGetVirtualWorld(i)) {
                if(
Houses[i][EHouseLights] == 1) {
                    
TextDrawHideForPlayer(playeridHouseLightsText);
                }
                if(
Houses[i][EHouseRadioIndex] != -1) {
                    
StopAudioStreamForPlayer(playerid);
                }
                
SetPlayerPos(playeridHouses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ]);
                
SetPlayerInterior(playeridGetPVarInt(playerid"Interior"));
                
SetPlayerVirtualWorld(playeridGetPVarInt(playerid"VirtualW"));
            }
        }
    }
    return 
1;




Re: House exit interior - Puff - 04.11.2017

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
PHP код:

                SetPlayerVirtualWorld
(playeridGetPVarInt(playerid"VirtualW")); 

Didn't work for some reason.. it sets my VW same as house VW.. and not that int VW


Re: House exit interior - StrikerZ - 04.11.2017

Quote:
Originally Posted by Puff
Посмотреть сообщение
Didn't work for some reason.. it sets my VW same as house VW.. and not that int VW
It'll set your VW to the one in which you were before entering the house


Re: House exit interior - Puff - 04.11.2017

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
It'll set your VW to the one in which you were before entering the house
yes it should do that but it isnt doing that.. so.


Re: House exit interior - StrikerZ - 05.11.2017

PHP код:
housesTryEnterExit(playerid) {
    for(new 
i=0;i<sizeof(Houses);i++) {
        if(
IsPlayerInRangeOfPoint(playerid1.5Houses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ])) {
            if(
IsHouseLocked(i)) {
                
GameTextForPlayer(playerid"~r~Locked"20001);
                return 
1;
            }
            if(
Houses[i][EHouseLights] == 1) {
                
TextDrawShowForPlayer(playeridHouseLightsText);
            }
            if(
Houses[i][EHouseRadioIndex] != -1) {
                new 
url[128];
                
getRadioURL(Houses[i][EHouseRadioIndex], urlsizeof(url));
                
PlayAudioStreamForPlayer(playeridurl);
            }
            
SetPVarInt(playerid"Interior"GetPlayerInterior(playerid));
            
SetPVarInt(playerid"VirtualW"GetPlayerVirtualWorld(playerid));
            
SetPlayerPos(playerid,  Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ]);
            
SetPlayerInterior(playeridHouses[i][EHouseInterior]);
            
SetPlayerVirtualWorld(playeridhouseGetVirtualWorld(i));
        } else if(
IsPlayerInRangeOfPoint(playerid5.0Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ])) {
            if(
GetPlayerVirtualWorld(playerid) == houseGetVirtualWorld(i)) {
                if(
Houses[i][EHouseLights] == 1) {
                    
TextDrawHideForPlayer(playeridHouseLightsText);
                }
                if(
Houses[i][EHouseRadioIndex] != -1) {
                    
StopAudioStreamForPlayer(playerid);
                }
                
SetPlayerPos(playeridHouses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ]);
                
SetPlayerInterior(playeridGetPVarInt(playerid"Interior"));
                
SetPlayerVirtualWorld(playeridGetPVarInt(playerid"VirtualW"));
            }
        }
    }
    return 
1;

It should work now, all that was wrong that interior was getting set to house interior before getting saved.
It will work perfectly now.


Re: House exit interior - Puff - 05.11.2017

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
PHP код:
housesTryEnterExit(playerid) {
    for(new 
i=0;i<sizeof(Houses);i++) {
        if(
IsPlayerInRangeOfPoint(playerid1.5Houses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ])) {
            if(
IsHouseLocked(i)) {
                
GameTextForPlayer(playerid"~r~Locked"20001);
                return 
1;
            }
            if(
Houses[i][EHouseLights] == 1) {
                
TextDrawShowForPlayer(playeridHouseLightsText);
            }
            if(
Houses[i][EHouseRadioIndex] != -1) {
                new 
url[128];
                
getRadioURL(Houses[i][EHouseRadioIndex], urlsizeof(url));
                
PlayAudioStreamForPlayer(playeridurl);
            }
            
SetPVarInt(playerid"Interior"GetPlayerInterior(playerid));
            
SetPVarInt(playerid"VirtualW"GetPlayerVirtualWorld(playerid));
            
SetPlayerPos(playerid,  Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ]);
            
SetPlayerInterior(playeridHouses[i][EHouseInterior]);
            
SetPlayerVirtualWorld(playeridhouseGetVirtualWorld(i));
        } else if(
IsPlayerInRangeOfPoint(playerid5.0Houses[i][EHouseExitX],Houses[i][EHouseExitY],Houses[i][EHouseExitZ])) {
            if(
GetPlayerVirtualWorld(playerid) == houseGetVirtualWorld(i)) {
                if(
Houses[i][EHouseLights] == 1) {
                    
TextDrawHideForPlayer(playeridHouseLightsText);
                }
                if(
Houses[i][EHouseRadioIndex] != -1) {
                    
StopAudioStreamForPlayer(playerid);
                }
                
SetPlayerPos(playeridHouses[i][EHouseX],Houses[i][EHouseY],Houses[i][EHouseZ]);
                
SetPlayerInterior(playeridGetPVarInt(playerid"Interior"));
                
SetPlayerVirtualWorld(playeridGetPVarInt(playerid"VirtualW"));
            }
        }
    }
    return 
1;

It should work now, all that was wrong that interior was getting set to house interior before getting saved.
It will work perfectly now.
Worked Thanks +REP