Jump to content

how to


Best-Killer

Recommended Posts

elseif ( source == GUIEditor.button [4] ) then 
-----Add vehicle -------
local vehicletext = guiComboBoxGetSelected(GUIEditor.combobox[1])
local vehicle = guiComboBoxGetItemText(GUIEditor.combobox[1], vehicletext)
local vehicleid = getVehicleModelFromName(vehicle)
local row = guiGridListAddRow(GUIEditor.gridlist[2])
guiGridListSetItemText(GUIEditor.gridlist[2],row,1,vehicleid,false,false)
end

look i add vehicleids in the row fine but now how i can get them ?

Link to comment

You can use:

 

guiGridListGetSelectedItem -- get Selected
guiGridListGetItemText -- get text on that selected

 

so it will be:

local vehicleid = guiGridListGetItemText ( GUIEditor.gridlist[2], guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ), 1 )

 

for more safety you can use 'if' :

local vehicleid = guiGridListGetItemText ( GUIEditor.gridlist[2], guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ), 1 )
if vehicleid == "" then return end

 

Edited by 3NAD
Link to comment
function ()
if ( source == GUIEditor.button[6] ) then
    guiSetVisible(GUIEditor.window[1],false)         
    showCursor(false) 
elseif ( source == GUIEditor.button[5] ) then
local name = guiGetText(GUIEditor.edit[1])
local x,y,z = getElementPosition (getLocalPlayer())
local r, g, b = getColorFromString ( guiGetText (GUIEditor.edit[6] ))
local v = guiGridListGetItemData ( GUIEditor.gridlist[2], row, mod )
local coloredit = guiGetText (GUIEditor.edit[6])
local rot = getPlayerRotation (getLocalPlayer())
if name == "" then 
exports.SAEGMessages:sendClientMessage("Please Enter Clan Name", getLocalPlayer(), 255, 140, 40 )
end
if not guiRadioButtonGetSelected(GUIEditor.radiobutton[1]) then
if not guiRadioButtonGetSelected(GUIEditor.radiobutton[2]) then
return exports.SAEGMessages:sendClientMessage("Please Select Type of marker Clan/Job", getLocalPlayer(), 255, 140, 40 ) 
end 
end
if coloredit == "" then 
return exports.SAEGMessages:sendClientMessage("Please Enter Color Marker", getLocalPlayer(), 255, 140, 40 )
end

warning : bad argument @ 'guiGridListGetItemData' Expected number at argument 2 , go nill

what is the problem! 

Link to comment

nvm ^^ i fixed it ahahah :D 

rRoot = getResourceRootElement(getThisResource())
addEventHandler( 'onResourceStart', rRoot,
	function( )
		exports.NGSQL:db_exec ( "CREATE TABLE IF NOT EXISTS vehicle_marker ( name VARCHAR(20) ,posX VARCHAR(40), posY VARCHAR(40), posZ VARCHAR(40), r VARCHAR(40), g VARCHAR(40), b VARCHAR(40), vehicles VARCHAR(40), rotation VARCHAR(40), ID VARCHAR(40))" )
		creatMarkerSystem()		
	end
)

function creatMarkerSystem()
	local GetAllMarker = exports.NGSQL:db_exec( "SELECT * FROM vehicle_marker" )
	if ( type ( GetAllMarker ) == "table" and #GetAllMarker > 0 ) then
		for i = 1, #GetAllMarker do
		    local n = {GetAllMarker[i]["name"],GetAllMarker[i]["posX"], GetAllMarker[i]["posY"], GetAllMarker[i]["posZ"], GetAllMarker[i]["r"], GetAllMarker[i]["g"],GetAllMarker[i]["b"],GetAllMarker[i]["v"],GetAllMarker[i]["rot"],GetAllMarker[i]["id"]}
            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 )
			markers[marker] = {n[8], n[9]}
			setElementData( marker, 'id', i )
            setElementData( marker, 'giveCarSystem', true )			
  		end
	end
end


addEvent( 'CreateMarker', true )
addEventHandler( 'CreateMarker', root, 
function( name, X, Y, Z, r, g, b, v, rot)
if getPedOccupiedVehicle( source ) then Z = Z else Z = Z - 1 end
local AllMarker = exports.NGSQL:db_exec( "SELECT * FROM vehicle_marker" )
id = AllMarker + 1
exports.NGSQL:db_exec( "INSERT INTO vehicle_marker ( name ,posX, posY, posZ, r, g, b, vehicles, rot, ID ) VALUES ( "..name..""..X..", "..Y..", "..Z..", "..r..", "..g..", "..b..","..v..""..rot.." "..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 )
end
)

addEventHandler( 'onMarkerHit', rRoot, function( player )
    if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then

    end
end)

line 29 : attempt to perform arithmetic on local'AllMarker(a boolean value) any help !! 

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