Jump to content

Help


yMassai

Recommended Posts

Client

carrosWindow = guiCreateWindow(100,100,175,200,"Criador de Carros",false) 
carrosList = guiCreateGridList ( 0.05, 0.10, 0.9, 0.7, true, carrosWindow) 
column = guiGridListAddColumn( carrosList, "Cars", 0.85 ) 
carrosCreate = guiCreateButton(05,170,85,45,"Create",false,carrosWindow) 
carrosClose = guiCreateButton(110,170,50,45,"Close",false,carrosWindow) 
guiWindowSetSizable( carrosWindow,false) 
guiSetVisible( carrosWindow, false ) 
row = guiGridListAddRow( carrosList ) 
row2 = guiGridListAddRow( carrosList ) 
row3 = guiGridListAddRow( carrosList ) 
guiGridListSetItemText( carrosList, row, column, "Rumpo", false, false ) 
guiGridListSetItemText( carrosList, row2, column, "Bullet", false, false ) 
guiGridListSetItemText( carrosList, row3, column, "PutUrCar", false, false ) 
  
carrosMarker = createMarker( 1543.98962, -1670.46398, 12.55753, "cylinder", 1.5, 255, 0, 0, 170 ) 
  
    function elMarker( hitPlayer ) 
         if ( hitPlayer == localPlayer ) then 
                guiSetVisible ( carrosWindow, true ) 
        showCursor(true) 
         end 
    end 
addEventHandler ( "onClientMarkerHit", carrosMarker, elMarker) 
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        if ( source == carrosClose ) then 
            guiSetVisible ( carrosWindow, false ) 
            showCursor(false) 
        elseif ( source == carrosCreate ) then 
        triggerServerEvent("CreateCarros", getLocalPlayer())     
                guiSetVisible ( carrosWindow, false ) 
        showCursor(false) 
  
        end 
    end 
) 

Server

local carros = { } 
  
addEvent ( "CreateCarros", true ) 
addEventHandler ( "CreateCarros", getRootElement(), 
    function ( ) 
        if ( isElement ( carros [ source ] ) ) then 
            destroyElement ( carros [ source ] ) 
        end 
  
        carros [ source ] = createVehicle ( 440,1543.98962, -1670.46398, 13.600, 0, 0, 90 ) 
        warpPedIntoVehicle ( source, carros [ source ] ) 
    end 
) 

To create a bullet too as i do?

Link to comment
  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Guest Guest4401
there is an error, this window open too inside a car.

You can check whether you are in a car or not with :

isPedInVehicle 

Link to comment

This?

addEventHandler("onClientMarkerHit",carros [ source ], 
function( p)  
    if p == localPlayer and not isPedInVehicle(localPlayer) then  
        guiSetVisible(carrosWindow,true)  
        showCursor(true)  
    end  
end) 

but as i use the "onPlayerQuit" to destroy the vehicle?

Link to comment
addEventHandler("onClientMarkerHit",carros [ source ], 
function(p) 
    if p == localPlayer and not isPedInVehicle(localPlayer) then 
        guiSetVisible(carrosWindow,true) 
        showCursor(true) 
    end 
end) 

No effect.

The player opens the window in a car and outside the car.

I want the window does not open when the player is in a vehicle.

Link to comment

That just makes totally no sense, no offense.

addEventHandler ( "onClientMarkerHit", carrosMarker, 
    function ( hitPlayer ) 
        if ( hitPlayer == localPlayer and not isPedInVehicle ( localPlayer ) ) then 
            guiSetVisible ( carrosWindow, true ) 
            showCursor ( true ) 
        end 
    end 
) 

Link to comment

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...