onvehicleworldchange?
#1

hey everyone,

as some of you know im working on a BTTF car, but now when i change the world of the car, to the past world, the car and me stay in it and the speed stays same, but the objects i have attached to it, arent on it anymore, theyre gone... and when i go back to the future, then it does works, but how can i fix this?

pawn Код:
if(GetPlayerSpeed(playerid) >= 140 && GetPlayerVehicleID(playerid) == Delorean && PlayerInfo[playerid][HasPlutonium] == 2)
    {
        new Float:x, Float:y, Float:z;
        GetVehicleVelocity(Delorean, x, y, z);
        PlayerInfo[playerid][HasPlutonium] = 0;
        SetWorld(playerid, "PastWorld");
        SetVehicleVirtualWorld(Delorean, 1000);
        SetVehiclePos(Delorean,-1052.7469,-1634.5173,76.0235);
        SetVehicleZAngle(Delorean,94.0786);
        PutPlayerInVehicle(playerid, Delorean, 0);
        SetVehicleVelocity(Delorean, x-60, y-60, z-60);
        GameTextForPlayer(playerid, "you have been transfered to the year ~r~1955", 3000, 5);
        SendClientMessage(playerid, COLOR_WHITE, "NOTE: you have 1 plutonium bar left, use it to go back, or you will be stuck in the past ForEver!");
        SendClientMessage(playerid, COLOR_WHITE, "NOTE: if you loose the Delorean, you are also stuck in the past Forever!");
        SendClientMessage(playerid, COLOR_WHITE, "NOTE: it takes 60 seconds to reload the Plutonium in to the Delorean");
        SetTimer("EnableDelorean", 60000, 0);
    }
    if(GetPlayerSpeed(playerid) >= 140 && GetPlayerVehicleID(playerid) == Delorean && PlayerInfo[playerid][HasPlutonium] == 1)
    {
        new Float:x, Float:y, Float:z;
        GetVehicleVelocity(Delorean, x, y, z);
        SetWorld(playerid, "DriftWorld");
        SetVehicleVirtualWorld(Delorean, 1);
        SetPlayerWeather(playerid, 0);
        PlayerInfo[playerid][HasPlutonium] = 0;
        GameTextForPlayer(playerid, "you have been transfered back to the year ~r~2012", 3000, 5);
        SendClientMessage(playerid, COLOR_WHITE, "you have 0 Plutonium bars left");
        SetVehicleVelocity(Delorean, x, y, z);
    }
thats onplayerupdate

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_PASSENGER && GetPlayerVehicleID(playerid) == Delorean) return RemovePlayerFromVehicle(playerid), SendClientMessage(playerid, COLOR_RED, "only the driver may use this vehicle, no passengers allowed");
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == Delorean)
        {
            if(PlayerInfo[playerid][HasPlutonium] == 2)
            {
                SendClientMessage(playerid, COLOR_WHITE, "as soon as this Delorean hits 88 mph/140 kmh it will send you to the past");
            }
            else if(PlayerInfo[playerid][HasPlutonium] == 0)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "you cannot use this vehicle without Plutonium");
            }
        }
    }
    if(oldstate == PLAYER_STATE_DRIVER)
    {
        //
    }
    return 1;
}
how can i change the attached objects to the vehicle again at the right world at the right time?, so it will look like they have never been gone
Reply
#2

Make sure the object is created in "-1" VirtualWorld
ttach the object again once changing vehicle virtual worlds.
Reply
#3

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
Make sure the object is created in "-1" VirtualWorld
ttach the object again once changing vehicle virtual worlds.
If the player change virtual word, others will still see the objects.

Example: Player1 is in the delorian, year 2012, and he goes in year 1400, Players2 that is in year 2012 will still see the objects floating.

If you use the streamer by incognito do:

DestroyDynamicObject(the_object);
CreateDynamicObject(blablabla, new_virtual_world);
Then attach the objects back to the vehicle
Reply
#4

ah i will, so else a player would see the objects flying through the air? xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)