yMassai Posted April 30, 2012 Author Share Posted April 30, 2012 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
Castillo Posted April 30, 2012 Share Posted April 30, 2012 1: You never get the selected item. 2: You don't trigger the selected vehicle, as you haven't done the #1. 3: You never get the vehicle model from the name, as you haven't done #1 and #2. Link to comment
yMassai Posted May 2, 2012 Author Share Posted May 2, 2012 there is an error, this window open too inside a car. Link to comment
Guest Guest4401 Posted May 2, 2012 Share Posted May 2, 2012 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
yMassai Posted May 3, 2012 Author Share Posted May 3, 2012 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
yMassai Posted May 4, 2012 Author Share Posted May 4, 2012 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
Castillo Posted May 4, 2012 Share Posted May 4, 2012 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
yMassai Posted May 4, 2012 Author Share Posted May 4, 2012 function pQuit() destroyElement( carros[ source ] ) end addEventHandler("onPlayerQuit",getRootElement(),pQuit) detects bad argument on the console, why? Link to comment
Castillo Posted May 4, 2012 Share Posted May 4, 2012 function pQuit ( ) if ( isElement ( carros [ source ] ) ) then destroyElement ( carros [ source ] ) end end addEventHandler ( "onPlayerQuit", root, pQuit ) Link to comment
yMassai Posted May 4, 2012 Author Share Posted May 4, 2012 The window opens to a player out of a vehicle and for a player inside a vehicle. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now