Wrong Virtual World
#1

Hey guys. I've searched this forum and ****** and all and didnt find a solution to my serious problem.

Problem:

When i open a server, and any players joins, gets a random virtual world. (I know that because i made a function to /stats so i can see what VW i have).
But when player Reconnects, he gets Virtual world 0 like normally. So basically everyone must rejoin atleast twice to get in same Virtual World.

Problem 2:

I made like 200 houses now. But the problem is that when i buy a house, and enter it, and then want to /exit, nothing happens:
Quote:

if(strcmp(cmd, "/exit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
//printf("House :%d",i);
if(GetPlayerVirtualWorld(playerid) == HouseInfo[i][hWorld])
{
if (PlayerToPoint(3, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
{
SetPlayerVirtualWorld(playerid,0);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pLocal] = 255;
if(HouseInfo[i][hHel] == 1)
{
new Float:tempheal;
GetPlayerHealth(playerid,tempheal);
if(tempheal < 100.0)
{
SetPlayerHealth(playerid,100.0);
}
}
}
}
}
}

But when i remove this:
Quote:

if(GetPlayerVirtualWorld(playerid) == HouseInfo[i][hWorld])

It works perfectly, except i spawn at other house door.

What could be possibly the problem?
Reply
#2

I think it would be much easier to set everyone in their own Player ID +1-Virtualworld.. so of course ID 0 would be set to world 1, when he enters a house.

Код:
if(strcmp(cmd, "/exit", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
     for(new i = 0; i < sizeof(HouseInfo); i++)
     {
     //printf("House :%d",i);
        if(GetPlayerVirtualWorld(playerid) == playerid+1)
        {
        if (PlayerToPoint(3, playerid,HouseInfo[hExitx], HouseInfo[hExity], HouseInfo[hExitz]))
        {
         SetPlayerVirtualWorld(playerid,0);
         SetPlayerInterior(playerid,0);
         SetPlayerPos(playerid,HouseInfo[hEntrancex],HouseInfo[hEntrancey],HouseInfo[hEntrancez]);
         PlayerInfo[playerid][pInt] = 0;
         PlayerInfo[playerid][pLocal] = 255;
         if(HouseInfo[hHel] == 1)
         {
           new Float:tempheal;
           GetPlayerHealth(playerid,tempheal);
           if(tempheal < 100.0)
           {
            SetPlayerHealth(playerid,100.0);
           }
         }
       }
     }
   }
}
Reply
#3

But i added like 200 different virtual worlds because of houses that is using same interiors. So you mean that whenever house i enter it gets VW 1 or?
Reply
#4

I mean every player will get their own virtual world. For example: PlayerID 3 => VirtualWorld = 4, PlayerID 47 => VirtualWorld = 48.
Reply
#5

Quote:
Originally Posted by Khelif
I mean every player will get their own virtual world. For example: PlayerID 3 => VirtualWorld = 4, PlayerID 47 => VirtualWorld = 48.
Even if like 4 players will rent same house, they still get different Virtual World? Cause i dont want that.

But then i should add to /enter like SetPlayerVirtualWorld(playerid) == playerid +1) or something?
Reply
#6

Anyone help please..
Reply
#7

are all houses at different locations?
Reply
#8

Of course, you mean the "enter" pickups? Yeah they are on different locations, but many houses are using same interiors..
Reply
#9

my guess to why it doesn't work is because it doesn't return a value.
pawn Код:
if(strcmp(cmd, "/exit", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        for(new i = 0; i < sizeof(HouseInfo); i++)
        {
            //printf("House :%d",i);
            if(GetPlayerVirtualWorld(playerid) == HouseInfo[i][hWorld])
            {
                if (PlayerToPoint(3, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
                {
                    SetPlayerVirtualWorld(playerid,0);
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
                    PlayerInfo[playerid][pInt] = 0;
                    PlayerInfo[playerid][pLocal] = 255;
                    if(HouseInfo[i][hHel] == 1)
                    {
                        new Float:tempheal;
                        GetPlayerHealth(playerid,tempheal);
                        if(tempheal < 100.0)
                        {
                            SetPlayerHealth(playerid,100.0);
                        }
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#10

No it haves return value:

Quote:

if(strcmp(cmd, "/exit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
//printf("House :%d",i);
if (PlayerToPoint(3, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pLocal] = 255;
if(HouseInfo[i][hHel] == 1)
{
new Float:tempheal;
GetPlayerHealth(playerid,tempheal);
if(tempheal < 100.0)
{
SetPlayerHealth(playerid,100.0);
}
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
//printf("Bizz :%d",i);
if (PlayerToPoint(3, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
{
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
SetPlayerPos(playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ]);
PlayerInfo[playerid][pLocal] = 255;
}
}
if(GetPlayerVehicleID(playerid) >= 71 && GetPlayerVehicleID(playerid) <= 77)
{
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
}
else if (PlayerToPoint(3.0, playerid,387.7978,173.8582,1008.382)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1481.0356,-1771.5741,18.795;
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pLocal] = 255;
}
else if (PlayerToPoint(6.0, playerid,-1404.5299,-259.0602,1043.6563))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2695.6235,-1704.6960,11.843;
}
else if (PlayerToPoint(8.0, playerid,-1443.0554,-581.1879,1055.0472))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2111.5686,-443.9720,38.7344);
}
else if (PlayerToPoint(8.0, playerid,-1464.7732,1557.5533,1052.5313))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2080.3079,-406.0309,38.7344);
}
else if (PlayerToPoint(8.0, playerid,377.0454,-191.8478,1000.632)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1038.2638,-1338.3038,13.7266);
}
else if(NoFuel[playerid] == 1)
{
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
NoFuel[playerid] = 0;
}
else if (PlayerToPoint(3.0, playerid,134.6460,1379.9669,1088.3672))//LaCosaNostra hq roof entrance
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,299.7548,-1547.5985,76.5391);
}
}
else if (PlayerToPoint(3.0, playerid,-2159.122802,641.517517,1052.381713))//La Cosa Nostra hq exit
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2481.3496,-1536.6400,24.1253);
}
else if (PlayerToPoint(3.0, playerid,963.418762,2108.292480,1011.030273))//Ferrington hq exit
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2729.3279,-2451.4595,17.5937);
}
else if (PlayerToPoint(3.0, playerid,140.2971,1366.2645,1083.8594))//LaCosaNostra hq exit
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,326.1143,-1514.0546,36.0325);
}
else if (PlayerToPoint(4.0, playerid,1262.6093,-785.5226,1091.9063))//Miyakazi hq interior exit
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1258.0593,-785.4180,92.0302);
}
else if (PlayerToPoint(4.0, playerid,1299.0443,-795.2476,1084))//Miyakazi hq interior exit 2
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1298.4813,-798.3877,84.1406);
}

}
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)