SetVehicleVirtualWorld
#1

Код:
CMD:drag(playerid, params[])
{
	if(!IsPlayerInAnyVehicle(playerid)){
		SetPlayerPos(playerid, -2911.2407,-194.6217,2.7821);
		CreateDynamicObject(4247, -3037.851074, -103.473968, 1.177714, 0.000000, 0.000000, 0.000000,1,-1,-1,300.0);//floor
		SetPlayerFacingAngle(playerid, 0.0);
		SetPlayerInterior(playerid, 0);
	 	new string[128], pName[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	    format(string, sizeof(string), "{6666FF}(/drag) {00CCFF}%s {6666FF}has Teleported to Drag Area",pName);
	    SendClientMessageToAll(playerid, string);
		SetPlayerVirtualWorld(playerid, 1);
	}
	else{
		new veh = GetPlayerVehicleID(playerid);
		SetVehiclePos(veh, -2911.2407,-194.6217,2.7821);
		SetVehicleZAngle(veh, 0.0);
		new string[128], pName[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	    format(string, sizeof(string), "{6666FF}(/drag) {00CCFF}%s {6666FF}has Teleported to Drag Area",pName);
        SendClientMessageToAll(playerid, string);
		LinkVehicleToInterior(veh, 0);
		SetVehicleVirtualWorld(veh, 1);
		PutPlayerInVehicle(playerid, veh, 0);
	}
	return SendClientMessage(playerid, 0xFF0000FF, "You have been teleported to Drag Arena");
}
After I do /drag with vehicle. The vehicle teleports and i kicked out on my own vehicle. LOLOLOL
Edit: I mean is, if im inside the car and I do /drag is kicks me out of my vehicle and only vehicle teleports to drag.
Reply
#2

Try
pawn Код:
CMD:drag(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)){
        SetPlayerPos(playerid, -2911.2407,-194.6217,2.7821);
        CreateDynamicObject(4247, -3037.851074, -103.473968, 1.177714, 0.000000, 0.000000, 0.000000,1,-1,-1,300.0);//floor
        SetPlayerFacingAngle(playerid, 0.0);
        SetPlayerInterior(playerid, 0);
        new string[128], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "{6666FF}(/drag) {00CCFF}%s {6666FF}has Teleported to Drag Area",pName);
        SendClientMessageToAll(playerid, string);
        SetPlayerVirtualWorld(playerid, 1);
    }
    else{
        new veh = GetPlayerVehicleID(playerid);
        LinkVehicleToInterior(veh, 0);
        SetVehicleVirtualWorld(veh, 1);
        SetVehiclePos(veh, -2911.2407,-194.6217,2.7821);
        SetVehicleZAngle(veh, 0.0);
        new string[128], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "{6666FF}(/drag) {00CCFF}%s {6666FF}has Teleported to Drag Area",pName);
        SendClientMessageToAll(playerid, string);
        PutPlayerInVehicle(playerid, veh, 0);
        SetPlayerVirtualWorld(playerid, 1);
    }
    return SendClientMessage(playerid, 0xFF0000FF, "You have been teleported to Drag Arena");
}
Reply
#3

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Try
pawn Код:
CMD:drag(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)){
        SetPlayerPos(playerid, -2911.2407,-194.6217,2.7821);
        CreateDynamicObject(4247, -3037.851074, -103.473968, 1.177714, 0.000000, 0.000000, 0.000000,1,-1,-1,300.0);//floor
        SetPlayerFacingAngle(playerid, 0.0);
        SetPlayerInterior(playerid, 0);
        new string[128], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "{6666FF}(/drag) {00CCFF}%s {6666FF}has Teleported to Drag Area",pName);
        SendClientMessageToAll(playerid, string);
        SetPlayerVirtualWorld(playerid, 1);
    }
    else{
        new veh = GetPlayerVehicleID(playerid);
        LinkVehicleToInterior(veh, 0);
        SetVehicleVirtualWorld(veh, 1);
        SetVehiclePos(veh, -2911.2407,-194.6217,2.7821);
        SetVehicleZAngle(veh, 0.0);
        new string[128], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "{6666FF}(/drag) {00CCFF}%s {6666FF}has Teleported to Drag Area",pName);
        SendClientMessageToAll(playerid, string);
        PutPlayerInVehicle(playerid, veh, 0);
        SetPlayerVirtualWorld(playerid, 1);
    }
    return SendClientMessage(playerid, 0xFF0000FF, "You have been teleported to Drag Arena");
}
Thanks but not working. The vehicle teleports and I always kicked out of my car. When I go /drag the vehicle i just used is there.
Reply
#4

You have to set the player interior and virtual world aswell
Reply
#5

Fixed but when I spawn a vehicle it spawn in Virtualworld 0. How do i spawn it in same world? I set /drag in VirtualWorld1
Reply
#6

Are you using SetPlayerVirtualWorld in OnVehicleSpawn ?
Reply
#7

You'll have to add a check to your spawn command. And link the vehicle to the same virtual world as the player when you create it.
Reply
#8

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Are you using SetPlayerVirtualWorld in OnVehicleSpawn ?
Nope i dont use. Take a look.

Код:
public OnVehicleSpawn(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        for(new u=0;u<MAX_PLAYERVEHICLES;u++)
        {
            if(vehicleid==PlayerVehicle[i][u])
            {
                VehicleDeleter(vehicleid);
                PlayerVehicle[i][u]=0;
                Turn[i]--;
            }
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by FUNExtreme
Посмотреть сообщение
You'll have to add a check to your spawn command. And link the vehicle to the same virtual world as the player when you create it.
How do i do that? I am using vehicle menu filterscript.

EDIT: I can now use teleport with my vehicle (FIXED) The problem now is after I teleport to a certain place like /lva which is in virtualworld 0, ONLY the vehicle teleports to /lva. But my character is in the same place. Weird @_@
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)