WASSIm. Posted January 4, 2013 Share Posted January 4, 2013 hi guys 1- i want show GUI for team police and fbi 2- spawn car to team color or nametagcolor Client Wnd = guiCreateWindow ( 0.4, 0.25, 0.25, 0.5, "Police Vehicles", true ) guiSetAlpha( Wnd, 1 ) button = guiCreateButton ( 0.01, 0.8, 0.99, 0.15, "Close", true, Wnd ) label = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "Double Click Vehicle to take it.", true, Wnd ) showCursor(false) guiSetVisible( Wnd, false ) guiWindowSetSizable( Wnd, false ) guiWindowSetMovable( Wnd, false ) vehicles = { {"HPV1000", 523}, {"Police LS", 596}, {"Police LV", 598}, {"Police Ranger", 599}, } grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Wnd) guiGridListAddColumn(grid, "Vehicles", 0.85) for i,veh in ipairs(vehicles) do row = guiGridListAddRow(grid) -- guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(veh[2])) end function use() local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then triggerServerEvent("CreVehiceP", localPlayer, model) end end end addEventHandler("onClientDoubleClick", root, use, false) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) function showGUI2p() guiSetVisible(Wnd,true) showCursor(true) end addEvent("showGUI2p",true) addEventHandler("showGUI2p", getRootElement(), showGUI2p) Server markerp = createMarker( 1556.9852294922, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker2p = createMarker( 1570.1909179688, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker3p = createMarker( 1584.61328125, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker4p = createMarker( 1595.1407470703, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) local vehicles = {} function spawnVehP(id) theTeam = getPlayerTeam( source ) theTeamName = getTeamName( theTeam ) if ( theTeamName == "police" ) or ( theTeamName == "FBI" ) then local x, y, z = getElementPosition(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x, y, z + 1) warpPedIntoVehicle(source, vehicles[source]) else outoutChatBox("Only police agents and FBI can get free vehicles from here!", source, 255, 0, 0) end end addEvent("CreVehiceP",true) addEventHandler("CreVehiceP", root, spawnVehP) addEventHandler("onPlayerQuit", root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUIp(hitPlayer) setElementFrozen(source, true) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",markerp,showGUIp) function showGUIp(hitPlayer) setElementFrozen(source, true) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",marker2p,showGUIp) function showGUIp(hitPlayer) setElementFrozen(source, true) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",marker3p,showGUIp) function showGUIp(hitPlayer) setElementFrozen(source, true) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",marker4p,showGUIp) Link to comment
Castillo Posted January 4, 2013 Share Posted January 4, 2013 markerp = createMarker( 1556.9852294922, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker2p = createMarker( 1570.1909179688, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker3p = createMarker( 1584.61328125, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker4p = createMarker( 1595.1407470703, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) local vehicles = { } function spawnVehP ( id ) local theTeam = getPlayerTeam ( source ) local theTeamName = getTeamName ( theTeam ) if ( theTeamName == "police" ) or ( theTeamName == "FBI" ) then local x, y, z = getElementPosition ( source ) if isElement ( vehicles [ source ] ) then destroyElement ( vehicles [ source ] ) end vehicles [ source ] = createVehicle ( id, x, y, z + 1 ) setVehicleColor ( vehicles [ source ], getTeamColor ( theTeam ) ) warpPedIntoVehicle ( source, vehicles [ source ] ) else outoutChatBox ( "Only police agents and FBI can get free vehicles from here!", source, 255, 0, 0 ) end end addEvent ( "CreVehiceP", true ) addEventHandler ( "CreVehiceP", root, spawnVehP ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement ( vehicles [ source ] ) then destroyElement ( vehicles [ source ] ) vehicles [ source ] = nil end end ) function showGUIp ( hitPlayer ) if ( source == markerp or source == marker2p or source == marker3p or source == marker4p ) then local theTeam = getPlayerTeam ( hitPlayer ) local theTeamName = getTeamName ( theTeam ) if ( theTeamName == "police" ) or ( theTeamName == "FBI" ) then setElementFrozen ( hitPlayer, true ) triggerClientEvent ( hitPlayer, "showGUI2p", getRootElement(), hitPlayer ) end end end addEventHandler ( "onMarkerHit",root, showGUIp ) Link to comment
WASSIm. Posted January 4, 2013 Author Share Posted January 4, 2013 markerp = createMarker( 1556.9852294922, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker2p = createMarker( 1570.1909179688, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker3p = createMarker( 1584.61328125, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) marker4p = createMarker( 1595.1407470703, -1608.2557373047, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) local vehicles = { } function spawnVehP ( id ) local theTeam = getPlayerTeam ( source ) local theTeamName = getTeamName ( theTeam ) if ( theTeamName == "police" ) or ( theTeamName == "FBI" ) then local x, y, z = getElementPosition ( source ) if isElement ( vehicles [ source ] ) then destroyElement ( vehicles [ source ] ) end vehicles [ source ] = createVehicle ( id, x, y, z + 1 ) setVehicleColor ( vehicles [ source ], getTeamColor ( theTeam ) ) warpPedIntoVehicle ( source, vehicles [ source ] ) else outoutChatBox ( "Only police agents and FBI can get free vehicles from here!", source, 255, 0, 0 ) end end addEvent ( "CreVehiceP", true ) addEventHandler ( "CreVehiceP", root, spawnVehP ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement ( vehicles [ source ] ) then destroyElement ( vehicles [ source ] ) vehicles [ source ] = nil end end ) function showGUIp ( hitPlayer ) if ( source == markerp or source == marker2p or source == marker3p or source == marker4p ) then local theTeam = getPlayerTeam ( hitPlayer ) local theTeamName = getTeamName ( theTeam ) if ( theTeamName == "police" ) or ( theTeamName == "FBI" ) then setElementFrozen ( hitPlayer, true ) triggerClientEvent ( hitPlayer, "showGUI2p", getRootElement(), hitPlayer ) end end end addEventHandler ( "onMarkerHit",root, showGUIp ) thank you very much you the best and i dont know why add setElementFrozen ( hitPlayer, true ) Link to comment
Castillo Posted January 4, 2013 Share Posted January 4, 2013 It was on your code but to freeze the marker, which makes no sense. You're welcome. Link to comment
WASSIm. Posted January 4, 2013 Author Share Posted January 4, 2013 It was on your code but to freeze the marker, which makes no sense.You're welcome. no you add bug i get out in car and my player frozen i delete setElementFrozen ( hitPlayer, true ) and script work 100% Link to comment
Castillo Posted January 4, 2013 Share Posted January 4, 2013 setElementFrozen(source, true) That line was on your script, I though you wanted to freeze the player when hit the marker, so I changed 'source' to 'hitPlayer'. 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