SA-MP Forums Archive
Virtual World - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Virtual World (/showthread.php?tid=273574)



Virtual World - shahartal - 02.08.2011

i wont to do that if i enter car,
check what the car virtual world and what the player virtual world
and it's change the car virtual world to the player virtual world

some can help me?



Re: Virtual World - MetalScript - 02.08.2011

If you are in a virtual world number 0 and the vehicle is in number 1, then you can't see the vehicle.
So you cant enter a vehicle that has a different virtual world, because it doesn't exist in your world.


Re: Virtual World - shahartal - 02.08.2011

you cant see im but you can get in to the car (invisible car)


Re: Virtual World - antonio112 - 02.08.2011

Well, it ain't that hard. Use OnPlayerEnterVehicle.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        new pVW = GetPlayerVirtualWorld(playerid);
        SetVehicleVirtualWorld(vehicleid, pVW);
    return 1;
}
Or, if that won't work, try using OnPlayerStateChange:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new pVW = GetPlayerVirtualWorld(playerid);
        new vID = GetPlayerVehicleID(playerid);
        SetVehicleVirtualWorld(vID, pVW);
    }
    return 1;
}



Re: Virtual World - shahartal - 02.08.2011

work!

wait you can help me, if i in car and i change the virtual world, the car still in the first virtual world,
i can do that the car change the virtual world?


this is the code to changeworld:
Quote:

new string[256];
if(dialogid == ChangeWorld_Dialog)
{
if(!response) return SendClientMessage(playerid, 0xFFFFFF00, "You canceled the dialog.");
SetPlayerVirtualWorld(playerid, strval(inputtext));
format(string, sizeof(string), "Your virtual World change to : %d, GetPlayerVirtualWorld(playerid));
SendClientMessage(playerid, 0xFFFFFF00, string);
return 0;
}

i try to do after the "You canceled the dialog." that:
Quote:

if(IsPlayerInAnyVehicle(playerid))
{
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid,GetPlayerVehicleID(pla yerid),GetPlayerVirtualWorld(playerid));
}

but it dont work =\


Re: Virtual World - shahartal - 03.08.2011

UP


Re: Virtual World - shahartal - 04.08.2011

UP S:


Re: Virtual World - MadeMan - 04.08.2011

pawn Код:
if(dialogid == ChangeWorld_Dialog)
{
    if(!response) return SendClientMessage(playerid, 0xFFFFFF00, "You canceled the dialog.");
    SetPlayerVirtualWorld(playerid, strval(inputtext));
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(playerid));
    }
    format(string, sizeof(string), "Your virtual World change to : %d", GetPlayerVirtualWorld(playerid));
    SendClientMessage(playerid, 0xFFFFFF00, string);
    return 0;
}



Re: Virtual World - shahartal - 04.08.2011

Thanks