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);
}
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;
}
Make sure the object is created in "-1" VirtualWorld
ttach the object again once changing vehicle virtual worlds. |