How to make a diff interior each house/business?
#1

I am using these scripts https://sampforum.blast.hk/showthread.php?tid=283501
and https://sampforum.blast.hk/showthread.php?tid=285406
Can you please help me?
(dynamic scripts)
Reply
#2

You mean same interior for different houses?
Reply
#3

When i enter a house and player enter a different house with the same interior we can see each other, how can i make each house a different world?
Reply
#4

Just choose different world when you are creating the house? Or change its world from house files.
Reply
#5

I mean, is there an option to do that in the creating house command? it's a dynamic system
Here's the creating house code
Quote:

COMMAND:createhouse(playerid, params[])
{
// If a player hasn't logged in properly, he cannot use this command
if (IsPlayerLoggedIn(playerid) == 0) return 0;
// If the player has an insufficient admin-level (he needs level 5 or RCON admin), exit the command
// returning "SERVER: Unknown command" to the player
if (INT_CheckPlayerAdminLevel(playerid, 5) == 0) return 0;

// Setup local variables
new HPrice, MaxLevel, HouseID;

// Check if the player isn't inside a vehicle (the admin-player must be on foot to use this command)
if (GetPlayerVehicleSeat(playerid) == -1)
{
if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Usage: \"/createhouse <price> <maxlevel (1-10)>\"");
else
{
// Check if the player entered a proper maxlevel
if ((MaxLevel >= 1) && (MaxLevel <= 10))
{
// Find the first free HouseID
for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
if (!IsValidDynamicPickup(AHouseData[HouseID][PickupID])) // Check if an empty house-index has been found (PickupID is 0)
break; // Stop searching, the first free HouseID has been found now

// Check if the house-limit hasn't been reached yet
// This would seem to double-check the pickup-id, but in case there was no free houseslot found (HouseID points
// to the last index, the last index would hold a house, so be sure to not overwrite it
if (!IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
{
// Setup some local variables
new Float, Float:y, Float:z, Msg[128];
// Get the player's position
GetPlayerPos(playerid, x, y, z);
// Set some default data
AHouseData[HouseID][Owned] = false;
AHouseData[HouseID][Owner] = 0;
AHouseData[HouseID][HouseX] = x;
AHouseData[HouseID][HouseY] = y;
AHouseData[HouseID][HouseZ] = z;
AHouseData[HouseID][HouseLevel] = 1;
AHouseData[HouseID][HouseMaxLevel] = MaxLevel;
AHouseData[HouseID][HousePrice] = HPrice;
AHouseData[HouseID][HouseOpened] = false;
AHouseData[HouseID][Insurance] = false;
AHouseData[HouseID][StaticHouse] = false;
AHouseData[HouseID][CarSlots] = 1; // This must be equal to the house-level for a normal house

// Add the pickup and 3DText at the location of the house-entrance (where the player is standing when he creates the house)
House_UpdateEntrance(HouseID);

// Save the house
HouseFile_Save(HouseID);

// Inform the player that he created a new house
format(Msg, 128, "{00FF00}You've succesfully created a house with ID: {FFFF00}%i", HouseID);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}The maximum amount of houses has been reached");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You have to use a max-level from 1 to 10");
}
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be on foot to create a house");

// Let the server know that this was a valid command
return 1;
}

Reply
#6

Then just use,
PHP код:
new randomworld random(300);
randomworld += playerid;
 
SetPlayerVirtualWorld(playeridrandomworld); 
under /enter command. This will set player world to random world when he enters the house.


PS: Before doing this please check if there is already setplayervirtualworld statement in /enter command.
Reply
#7

There is but it doesnt work properly, when i enter a house i can see other player in the same virtual world
I will try what you wrote
Reply
#8

It didn't work
Quote:

COMMAND:enter(playerid, params[])
{
// Setup local variables
new HouseID, IntID;

// If a player hasn't logged in properly, he cannot use this command
if (IsPlayerLoggedIn(playerid) == 0) return 0;

// Check if the player isn't inside a vehicle (the player must be on foot to use this command)
if (GetPlayerVehicleSeat(playerid) == -1)
{
// Loop through all houses
for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
{
// Check if the house exists
if (IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
{
// Check if the player is in range of the house-pickup
if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
{
// Check if the house is closed to the public
if (AHouseData[HouseID][HouseOpened] == false)
{
// The house isn't open to the public, so keep anyone out who isn't the owner of the house
if (House_PlayerIsOwner(playerid, HouseID) == 0)
{
// Let the player know that this house isn't open to the public and he can't enter it
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This house isn't open to the public, you can't enter it");
return 1;
}
}

// The house is open to the public, or the player trying to enter is the owner, so let the player inside the house

// Get the interior to put the player in
IntID = AHouseData[HouseID][HouseLevel]; // Get the level of the house

// Set the worldid so other players cannot see him anymore (but allow all players in the same house to see eachother)
new randomworld = random(300);
randomworld += playerid;
SetPlayerVirtualWorld(playerid, randomworld);
// Set the player inside the interior of the house
SetPlayerInterior(playerid, AHouseInteriors[IntID][InteriorID]);
// Set the position of the player at the spawn-location of the house's interior
SetPlayerPos(playerid, AHouseInteriors[IntID][IntX], AHouseInteriors[IntID][IntY], AHouseInteriors[IntID][IntZ]);
// Also set a tracking-variable to enable /housemenu to track in which house the player is
pInfo[playerid][CurrentHouse] = HouseID;
// Also let the player know he can use /housemenu to upgrade/exit his house
SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Use {FFFF00}/housemenu{00FF00} to change options for your house");

// Exit the function
return 1;
}
}
}
}

// If no house was in range, allow other script to use this command too (business-script for example)
return 0;
}

Reply
#9

I just red the PPC Housing script. The SetPlayerVirtualWorld in that is:
SetPlayerVirtualWorld(playerid, 5000 + HouseID);

Well, There is also a possibility if the houses have same ID the players will go in same Virtual World.
Reply
#10

what you can do is that set the virtual world of the house based on the primary key used to store the house in the database
example

i have 5 houses, and each each with HouseID 1,2,3,4,5

now when i enter the house , i can set the player's virtual world to the HouseID
that is for house number 1, the virtual world would be 1 , for 2 it will be 2 and so on.
Hence solving your problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)