mint3d Posted April 13, 2013 Share Posted April 13, 2013 i need help with my script i want to make it so you pick the car. Instead of it randomly giving you one Client Client][ Color = {255,0,0} currentPosition = {} local Key = "z" local render = false GUIEditor = { combobox = {}, button = {}, edit = {}, label = {}, } System = {} itemTextCombobox = {"Arabic|العربية","English","Italiano","Français","Español"} local X, Y = guiGetScreenSize() System.wnd = guiCreateWindow(X-343, Y/2-269/2, 333, 269, ".:: [ Vehicle Marker Creator System ] ::.", false) guiSetVisible(System.wnd, not guiGetVisible(System.wnd)) guiWindowSetMovable(System.wnd, false) guiWindowSetSizable(System.wnd, false) guiSetAlpha(System.wnd, 1.00) guiSetProperty(System.wnd, "CaptionColour", "FF00D2F8") GUIEditor.label[1] = guiCreateLabel(7, 27, 415, 25, "Welcome To Vehicle Marker System ( =", false, System.wnd) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 248, 0, 0) GUIEditor.label[2] = guiCreateLabel(11, 59, 111, 25, "Position :", false, System.wnd) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetColor(GUIEditor.label[2], 240, 237, 7) GUIEditor.label[3] = guiCreateLabel(11, 92, 118, 21, "x", false, System.wnd) guiSetFont(GUIEditor.label[3], "default-bold-small") guiLabelSetColor(GUIEditor.label[3], 99, 244, 2) GUIEditor.edit[1] = guiCreateEdit(9, 115, 130, 19, "", false, System.wnd) GUIEditor.label[4] = guiCreateLabel(10, 140, 118, 21, "y", false, System.wnd) guiSetFont(GUIEditor.label[4], "default-bold-small") guiLabelSetColor(GUIEditor.label[4], 99, 244, 2) GUIEditor.edit[2] = guiCreateEdit(10, 167, 130, 19, "", false, System.wnd) GUIEditor.label[5] = guiCreateLabel(10, 192, 118, 21, "z", false, System.wnd) guiSetFont(GUIEditor.label[5], "default-bold-small") guiLabelSetColor(GUIEditor.label[5], 99, 244, 2) GUIEditor.edit[3] = guiCreateEdit(10, 213, 130, 17, "", false, System.wnd) GUIEditor.label[6] = guiCreateLabel(148, 59, 125, 23, "Language :", false, System.wnd) guiSetFont(GUIEditor.label[6], "default-bold-small") guiLabelSetColor(GUIEditor.label[6], 241, 232, 4) GUIEditor.combobox[1] = guiCreateComboBox(148, 92, 171, 100, "", false, System.wnd) for i = 1, #itemTextCombobox do guiComboBoxAddItem(GUIEditor.combobox[1], itemTextCombobox[i]) end GUIEditor.button[1] = guiCreateButton(146, 129, 175, 22, "Get Position", false, System.wnd) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF5CF202") GUIEditor.button[2] = guiCreateButton(148, 161, 175, 22, "Set Marker Color", false, System.wnd) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF00ACF4") GUIEditor.button[3] = guiCreateButton(150, 202, 173, 22, "Create Marker", false, System.wnd) guiSetFont(GUIEditor.button[3], "default-bold-small") guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFF40000") GUIEditor.button[4] = guiCreateButton(298, 21, 26, 29, "X", false, System.wnd) guiSetFont(GUIEditor.button[4], "default-bold-small") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFF40000") GUIEditor.label[7] = guiCreateLabel(9, 242, 322, 21, "Vehicle Marker Creator System v.2", false, System.wnd) guiSetFont(GUIEditor.label[7], "default-bold-small") guiLabelSetColor(GUIEditor.label[7], 30, 213, 207) for k, v in pairs( GUIEditor.edit ) do guiEditSetReadOnly( v, true ) end addEventHandler("onClientGUIClick",root, function () if ( source == GUIEditor.button[2] ) then openColorPicker() elseif ( source == GUIEditor.button[1] ) then local x,y,z = getElementPosition(localPlayer) guiSetText (GUIEditor.edit[1], x ) guiSetText (GUIEditor.edit[2], y ) guiSetText (GUIEditor.edit[3], z ) currentPosition = {x,y,z} elseif ( source == GUIEditor.button[3] ) then if #currentPosition == 0 then return end local send = { [1] = currentPosition[1], [2] = currentPosition[2], [3] = currentPosition[3], [4] = Color[1], [5] = Color[2], [6] = Color[3], } newPos = {} triggerServerEvent("CreateMarker", localPlayer, unpack(send)) elseif ( source == GUIEditor.button[4] ) then guiSetVisible(System.wnd, not guiGetVisible(System.wnd)) showCursor(guiGetVisible(System.wnd)) if render then openColorPicker() end end end ) addEventHandler ( "onClientGUIComboBoxAccepted", guiRoot, function ( combo ) if ( combo == GUIEditor.combobox[1] ) then local text = tostring ( guiComboBoxGetItemText ( combo, guiComboBoxGetSelected ( combo ) ) ) if ( text ) then local lang = AddLanguage( text ) for k, v in pairs ( lang ) do guiSetText( v.element, v.id) end end end end ) bindKey (Key, "down", function() if getElementData( localPlayer, 'OpenMakerPanel') ~= nil then guiSetVisible(System.wnd, not guiGetVisible(System.wnd)) showCursor(guiGetVisible(System.wnd)) if render then openColorPicker() end end end ) addEvent( 'LogOutSetVisible', true ) addEventHandler( 'LogOutSetVisible', root, function() if guiGetVisible(System.Wnd) then guiSetVisible( System.Wnd, false ) showCursor( false ) end end) function openColorPicker() if render then colorPicker.closeSelect() removeEventHandler("onClientRender", root, updateColor) else colorPicker.openSelect() addEventHandler("onClientRender", root, updateColor) end render = not render end function updateColor() if (not colorPicker.isSelectOpen) then return end local r, g, b = colorPicker.updateTempColors() Color = {r,g,b} end Server rRoot = getResourceRootElement(getThisResource()) Cars = {} antiFloodMarker = {} local cmd = 'RemoveMarker' --- Delete Marker Command local allowedGroup = 'Admin' local vehicleIDS = { -- Vehicle ID 415,561,587,541,527,480,603 } addEventHandler( 'onResourceStart', rRoot, function( ) executeSQLQuery( 'CREATE TABLE IF NOT EXISTS Marker_System ( posX, posY, posZ, r, g, b, ID)' ) for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( allowedGroup ) ) then setElementData( player, 'OpenMakerPanel', true) else setElementData( player, 'OpenMakerPanel', nil) end end creatMarkerSystem() end ) function creatMarkerSystem() local GetAllMarker = executeSQLQuery( "SELECT * FROM Marker_System" ) if ( type ( GetAllMarker ) == "table" and #GetAllMarker > 0 ) then for i = 1, #GetAllMarker do local n = {GetAllMarker[i]["posX"], GetAllMarker[i]["posY"], GetAllMarker[i]["posZ"], GetAllMarker[i]["r"], GetAllMarker[i]["g"],GetAllMarker[i]["b"]} for ii = 1, #n do n[ ii ] = tonumber( n[ ii ] ) end local marker = createMarker( n[1], n[2], n[3], 'cylinder', 1.25, n[4], n[5], n[6], 255 ) setElementData( marker, 'id', i ) setElementData( marker, 'giveCarSystem', true ) end end end addEventHandler( 'onMarkerHit', rRoot, function( player ) if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then if getElementData( source, 'giveCarSystem' ) then randomCarID = tonumber(vehicleIDS[math.random(#vehicleIDS)]) if Cars[player] and getElementType(Cars[player]) == "vehicle" then destroyElement(Cars[player]) end x,y,z = getElementPosition(player) Cars[player] = createVehicle(randomCarID, x+1,y,z) if Cars[player] then warpPedIntoVehicle(player,Cars[player]) end end end end) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'OpenMakerPanel', nil) end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( allowedGroup ) ) then setElementData( source, 'OpenMakerPanel', true) else setElementData( source, 'OpenMakerPanel', nil) end end ) addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source, 'LogOutSetVisible', root) setElementData( source, 'OpenMakerPanel', nil) end ) addEvent( 'CreateMarker', true ) addEventHandler( 'CreateMarker', root, function( X, Y, Z, r, g, b) if antiFloodMarker[source] then return outputChatBox( "Please wait 6 seconds before creating new marker", source, 255, 255, 0 ) end antiFloodMarker[source] = true if getPedOccupiedVehicle( source ) then Z = Z else Z = Z - 1 end local AllMarker = executeSQLQuery( "SELECT * FROM Marker_System" ) id = #AllMarker + 1 executeSQLQuery( "INSERT INTO Marker_System ( posX, posY, posZ, r, g, b, ID ) VALUES ( "..X..", "..Y..", "..Z..", "..r..", "..g..", "..b..", "..id..")" ) local marker = createMarker( X, Y, Z, 'cylinder', 1.25, r, g, b, 255 ) setElementData( marker, 'giveCarSystem', true ) setElementData( marker, 'id', id ) outputChatBox( "Marker Was Created", source, 255, 255, 0 ) setTimer(removeFlood, 6000, 1, source) end ) function removeFlood(plr) if antiFloodMarker[plr] then antiFloodMarker[plr] = false end end addEventHandler("onPlayerQuit",root,function() if Cars[source] then destroyElement(Cars[source]) Cars[source] = nil end end) addEventHandler("onVehicleExplode",root,function() setTimer(destroyElement,2000,1,source) end) addCommandHandler( cmd, function(player, Command) if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( allowedGroup ) ) then local mrker = getMarkerByHit( player ) if mrker then local id = tonumber ( getElementData( mrker, 'id') or 0 ) if id == 0 then return end if executeSQLQuery("DELETE FROM `Marker_System` WHERE `ID`=?", id) then destroyElement( mrker ) outputChatBox( "Marker Was Deleted", player, 255, 255, 0 ) else outputChatBox( "error", player, 255, 255, 0 ) end end else outputChatBox( "Access denied", player, 255, 255, 0 ) end end ) function getMarkerByHit( plr ) for i, v in ipairs( getElementsByType( 'marker', rRoot ) ) do if isElementWithinMarker(plr, v) then return v end end return false,outputChatBox( "Error: Please enter the marker", plr, 255, 255, 0 ) end Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 This is my script change server.lua to rRoot = getResourceRootElement(getThisResource()) Cars = {} antiFloodMarker = {} local cmd = 'RemoveMarker' --- Delete Marker Command local allowedGroup = 'Admin' local VehicleID = 411 addEventHandler( 'onResourceStart', rRoot, function( ) executeSQLQuery( 'CREATE TABLE IF NOT EXISTS Marker_System ( posX, posY, posZ, r, g, b, ID)' ) for i, player in ipairs( getElementsByType( 'player' ) ) do if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( allowedGroup ) ) then setElementData( player, 'OpenMakerPanel', true) else setElementData( player, 'OpenMakerPanel', nil) end end creatMarkerSystem() end ) function creatMarkerSystem() local GetAllMarker = executeSQLQuery( "SELECT * FROM Marker_System" ) if ( type ( GetAllMarker ) == "table" and #GetAllMarker > 0 ) then for i = 1, #GetAllMarker do local n = {GetAllMarker[i]["posX"], GetAllMarker[i]["posY"], GetAllMarker[i]["posZ"], GetAllMarker[i]["r"], GetAllMarker[i]["g"],GetAllMarker[i]["b"]} for ii = 1, #n do n[ ii ] = tonumber( n[ ii ] ) end local marker = createMarker( n[1], n[2], n[3], 'cylinder', 1.25, n[4], n[5], n[6], 255 ) setElementData( marker, 'id', i ) setElementData( marker, 'giveCarSystem', true ) end end end addEventHandler( 'onMarkerHit', rRoot, function( player ) if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then if getElementData( source, 'giveCarSystem' ) then randomCarID = tonumber(vehicleIDS[math.random(#vehicleIDS)]) if Cars[player] and getElementType(Cars[player]) == "vehicle" then destroyElement(Cars[player]) end x,y,z = getElementPosition(player) Cars[player] = createVehicle(VehicleID, x+1,y,z) if Cars[player] then warpPedIntoVehicle(player,Cars[player]) end end end end) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'OpenMakerPanel', nil) end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( allowedGroup ) ) then setElementData( source, 'OpenMakerPanel', true) else setElementData( source, 'OpenMakerPanel', nil) end end ) addEventHandler( 'onPlayerLogout', root, function( _, acc ) triggerClientEvent( source, 'LogOutSetVisible', root) setElementData( source, 'OpenMakerPanel', nil) end ) addEvent( 'CreateMarker', true ) addEventHandler( 'CreateMarker', root, function( X, Y, Z, r, g, b) if antiFloodMarker[source] then return outputChatBox( "Please wait 6 seconds before creating new marker", source, 255, 255, 0 ) end antiFloodMarker[source] = true if getPedOccupiedVehicle( source ) then Z = Z else Z = Z - 1 end local AllMarker = executeSQLQuery( "SELECT * FROM Marker_System" ) id = #AllMarker + 1 executeSQLQuery( "INSERT INTO Marker_System ( posX, posY, posZ, r, g, b, ID ) VALUES ( "..X..", "..Y..", "..Z..", "..r..", "..g..", "..b..", "..id..")" ) local marker = createMarker( X, Y, Z, 'cylinder', 1.25, r, g, b, 255 ) setElementData( marker, 'giveCarSystem', true ) setElementData( marker, 'id', id ) outputChatBox( "Marker Was Created", source, 255, 255, 0 ) setTimer(removeFlood, 6000, 1, source) end ) function removeFlood(plr) if antiFloodMarker[plr] then antiFloodMarker[plr] = false end end addEventHandler("onPlayerQuit",root,function() if Cars[source] then destroyElement(Cars[source]) Cars[source] = nil end end) addEventHandler("onVehicleExplode",root,function() setTimer(destroyElement,2000,1,source) end) addCommandHandler( cmd, function(player, Command) if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( allowedGroup ) ) then local mrker = getMarkerByHit( player ) if mrker then local id = tonumber ( getElementData( mrker, 'id') or 0 ) if id == 0 then return end if executeSQLQuery("DELETE FROM `Marker_System` WHERE `ID`=?", id) then destroyElement( mrker ) outputChatBox( "Marker Was Deleted", player, 255, 255, 0 ) else outputChatBox( "error", player, 255, 255, 0 ) end end else outputChatBox( "Access denied", player, 255, 255, 0 ) end end ) function getMarkerByHit( plr ) for i, v in ipairs( getElementsByType( 'marker', rRoot ) ) do if isElementWithinMarker(plr, v) then return v end end return false,outputChatBox( "Error: Please enter the marker", plr, 255, 255, 0 ) end The is here you can see it in the first file ; local VehicleID = 411 Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 What? u said u want it one vehicle id not random that what i did . Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 no i mean open a gui so i can pick the car Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 First You Have To Press Get Position Button And Set Marker Color Then Create It And When You Hit It You Will Have A Vehicle And U Must Be With Out Vehicle When U Hit It And To Show The GUI Press "Z" . Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 how do i pick the car i want with a gui Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 No this give u the car when u hit the marker u create it . Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 how can i make it so i can pick a car with a gui Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 Hmm... You Want script when u press button get car? Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 Did you check my script? https://community.multitheftauto.com/index.php?p=resources&s=details&id=6621 Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 no i didn't does it create a marker so like a gang can use it Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 You have to script it ; create the gui and use ; client ; "onClientMarkerHit" "onClientGUIClick" guiSetVisible showCursor triggerServerEvent server ; addEvent addEventHandler createVehicle Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 i am not a scripter i know some stuff Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 that is not what i am looking for what i want is like CSG and CIT like the Car spawner were you pick the car you want Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 https://community.multitheftauto.com/index.php?p=resources&s=details&id=2604 Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 whats that i want like so a gang has a marker in there base and they walk in opens a gui and the pick between some cars then the pick it spawns them in it Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 So u have to learn scripting . Link to comment
mint3d Posted April 13, 2013 Author Share Posted April 13, 2013 can you help me do you have skype Link to comment
Max+ Posted April 13, 2013 Share Posted April 13, 2013 You Can't see it ? Skype : Mr.PresTege Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 I'm sorry I don't like to teach people but u can pay . 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