Jump to content

Warp


isa_Khamdan

Recommended Posts

Posted

Hello ,

I making a Warp panel but I am having a little problem with

setElementPosition(localPlayer,x,y,z) 

This will only change the player position so how can I make it spawn the player with the vehicle if he have one in the selected x,y,z?

Posted
The whole codes?

Only the fade camera isn't working , I think there is a mistake in the Syntax cuz I couldn't find the right one :S

So can you give me the right Syntax for FadeCamera ( Client Side ).

Posted
bool fadeCamera ( bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] ) 

'false' fade the camera.

'true' not fade.

So it should look like this?

fadeCamera ( true, 5) 

Posted
fadeCamera ( true,1 ) --Show after 1 second. 
fadeCamera ( false,1 ) --Hide after 1 second . 

It doesn't work

addEventHandler("onClientGUIClick",root, 
    function () 
        local sel = guiGridListGetSelectedItem(grid) 
        local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
        if source == move then 
          if sel ~= -1 then 
             if not isPedInVehicle ( localPlayer ) then 
             local x,y,z = unpack(guiGridListGetItemData(grid,sel,1)) 
                fadeCamera ( false, 0.5) 
                fadeCamera ( true, 2 )   
                setElementPosition(localPlayer,x,y,z) 
  
             elseif source == move then 
           if sel ~= -1 then 
                if isPedInVehicle ( localPlayer ) then 
                local Controler = getVehicleController ( theVehicle )  
                if ( Controler ) then 
                local x,y,z = unpack(guiGridListGetItemData(grid,sel,1)) 
                fadeCamera ( false, 0.5 ) 
                fadeCamera ( true, 2 )   
                setElementPosition(theVehicle,x,y,z) 
                warpPedIntoVehicle ( localPlayer, theVehicle )  
        end  
         end 
           end 
       end 
    else        
    outputChatBox("* Please Select A Positon",255,0,0) 
    end 
   end  
end 
) 

Posted

warpPedIntoVehicle is not required, that function is used to warp a player/ped into a vehicle, not change the position of it.

addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        local sel = guiGridListGetSelectedItem ( grid ) 
        local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
        if ( source == move ) then 
            if ( sel ~= -1 ) then 
                local theElement = ( theVehicle and theVehicle or localPlayer ) 
                local x, y, z = unpack ( guiGridListGetItemData ( grid, sel, 1 ) ) 
                fadeCamera ( false, 0.5 ) 
                fadeCamera ( true, 2 ) 
                setElementPosition ( theElement, x, y, z ) 
            else        
                outputChatBox ( "* Please Select A Positon", 255, 0, 0 ) 
            end 
        end 
    end 
) 

That should change the position of the vehicle ( if he/she is in one ) and the localPlayer ( if not in a vehicle ).

Posted
warpPedIntoVehicle is not required, that function is used to warp a player/ped into a vehicle, not change the position of it.
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        local sel = guiGridListGetSelectedItem ( grid ) 
        local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
        if ( source == move ) then 
            if ( sel ~= -1 ) then 
                local theElement = ( theVehicle and theVehicle or localPlayer ) 
                local x, y, z = unpack ( guiGridListGetItemData ( grid, sel, 1 ) ) 
                fadeCamera ( false, 0.5 ) 
                fadeCamera ( true, 2 ) 
                setElementPosition ( theElement, x, y, z ) 
            else        
                outputChatBox ( "* Please Select A Positon", 255, 0, 0 ) 
            end 
        end 
    end 
) 

That should change the position of the vehicle ( if he/she is in one ) and the localPlayer ( if not in a vehicle ).

It is working but why the Camera doesn't fade?

Posted
Well, you are fading it-in too fast, you should use a timer.

Like this?

setTimer ( fadeCamera, 5, true ) 

Edit: I want it to Fade just like on the freeroam when you use set position using the map.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...