Posts: 28
Threads: 4
Joined: Mar 2014
Reputation:
0
Right, so I've got this problem. It's regarding the SC:RP script.
I create, for example, an admin vehicle in the normal world (virtual world 0).
Then, I enter a house, and when I come back, the vehicle is not there. I know everyone will say ohh it's a problem with virtual worlds / interiors but IT'S NOT, because when I set them manually with /setint / /setvw to 0 it's still not there.
Can you guys help me out?
P.S: I'll provide any part of the script you need.
Posts: 1,168
Threads: 60
Joined: Dec 2016
Reputation:
0
What about showing code? Don't think people have the ability here to guess everything. No code posted = no effort made to help
Posts: 1,168
Threads: 60
Joined: Dec 2016
Reputation:
0
Did you try to debug your data? print the values to see if it is related to your code.
Use printf(); to print shitzel in your logs
Posts: 180
Threads: 3
Joined: Mar 2018
Try this m8
PHP код:
#define MAX_HOUSES 500
//Don't store information such as ID of entered house in player data enum, it has nothing to do with it. Instead, you can create a new variable:
// Top
new bool:IsInHouse[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason)
{
bool:IsInHouse[playerid] = false;
return 1;
}
CMD:exit(playerid)
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.5, HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
{
SetPlayerPos(playerid, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]);
SetPlayerFacingAngle(playerid, HouseData[i][housePos][3] - 180.0);
SetPlayerVirtualWorld(playerid, HouseData[i][houseExteriorVW]); // I don't know why you use this, you should have a default virtual world and reset it
SetCameraBehindPlayer(playerid);
IsInHouse[playerid] = false;
break;
}
}
return 1;
}
CMD:enter(playerid)
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.5, HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
{
if(HouseData[i][houseLocked]) return SendErrorMessage(playerid, "You cannot enter a locked house.");
SetPlayerPos(playerid, HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2]);
SetPlayerFacingAngle(playerid, HouseData[i][houseInt][3]);
SetPlayerInterior(playerid, HouseData[i][houseInterior]);
SetPlayerVirtualWorld(playerid, i); // You can just use house id as virtual world, it won't mix with others
SetCameraBehindPlayer(playerid);
IsInHouse[playerid] = true;
break;
}
}
return 1;
}