try this:
GUIEditor_Button = {}
GUIEditor_Edit = {}
rotation = 0
addEvent("onVisibleButtons", true)
addEventHandler("onVisibleButtons", getLocalPlayer(),
function()
GUIEditor_Button[1] = guiCreateButton(0.3688,0.84,0.0625,0.055,"<",true)
GUIEditor_Button[2] = guiCreateButton(0.5013,0.84,0.0625,0.055,">",true)
GUIEditor_Button[3] = guiCreateButton(0.4013,0.9067,0.1287,0.065,"Empezar a Jugar",true)
GUIEditor_Edit[1] = guiCreateEdit(0.4412,0.8367,0.05,0.0567,"0",true)
guiEditSetReadOnly(GUIEditor_Edit[1],true)
lsT()
showCursor(true)
bindKey("space", "down", theR)
ped = createPed( 0, 756.03051757813, -1239.4184570313, 13.552116394043 )
setElementData(ped,"City","LS")
end)
numero = 0
addEventHandler("onClientGUIClick", root,function(button,state)
if source == GUIEditor_Button[3] then
local elements ={GUIEditor_Button[1],GUIEditor_Button[2],GUIEditor_Button[3],GUIEditor_Edit[1]}
for i,v in ipairs(elements)do
destroyElement(v)
end
showCursor(false)
setCameraTarget( localPlayer )
destroyElement(ped)
unbindKey("space","down",theR)
local renders = {lsT,lvT,sfT}
for k,b in ipairs(renders)do
removeEventHandler("onClientRender",root,b)
end
setPedSkin(localPlayer,numero)
setElementFrozen(localPlayer,false)
elseif source == GUIEditor_Button[1] then
if (button == "left" and state == "up") then
if(numero == 0) then numero = 288 setElementModel(ped,numero) end
numero = numero - 1
setElementModel(ped,numero)
end
guiSetText(GUIEditor_Edit[1], " "..getElementModel(ped).."")
elseif source == GUIEditor_Button[2] then
if (button == "left" and state == "up") then
if (numero == 289) then numero = 0 setElementModel(ped,numero) end
numero = numero + 1
setElementModel(ped,numero)
end
guiSetText(GUIEditor_Edit[1], " "..getElementModel(ped).."")
end
end,true)
addEventHandler("onClientRender", root,function( )
if isElement ( ped ) then
rotation = rotation + 1
if ( rotation > 359 ) then
rotation = 0
end
setPedRotation ( ped, rotation )
end
end)
function lsT()
addEventHandler("onClientRender", root, lsT)
dxDrawText("Los Santos",433.0,539.0,641.0,585.0,tocolor(255,255,255,255),3.0,"default","left","top",false,false,true)
end
function bLV()
if source == GUIEditor_Button[3] then
setElementPosition( localPlayer, 2137.7775878906, 1480.8577880859, 10.8203125 )
end
end
function bSF()
if source == GUIEditor_Button[3] then
setElementPosition( localPlayer, -1695.2707519531, 950.0751953125, 24.890625 )
end
end
function bLS()
if source == GUIEditor_Button[3] then
setElementPosition( localPlayer, 731.21276855469, -1276.6033935547, 17.6484375 )
end
end
function theR()
if(getElementData(ped,"City")=="LS")then
removeEventHandler("onClientRender", root, lsT)
setTimer(lvT,1000,1)
triggerServerEvent("onCameraLV", getLocalPlayer())
setElementData(ped,"City","LV")
setElementPosition(ped, 2323.7517089844, 1283.2214355469, 97.592704772949 )
addEventHandler("onClientGUIClick", root, bLV)
elseif(getElementData(ped,"City")=="LV")then
removeEventHandler("onClientRender",root,lvT)
setTimer(sfT,1000,1)
triggerServerEvent("onCameraSF", getLocalPlayer())
setElementData(ped,"City","SF")
setElementPosition(ped,-1480.8948974609, 920.17132568359, 71.350372314453)
addEventHandler("onClientGUIClick", root, bSF)
elseif(getElementData(ped,"City")=="SF")then
removeEventHandler("onClientRender",root,sfT)
setTimer(lsT,1000,1)
triggerServerEvent("onCameraLS", getLocalPlayer())
setElementData(ped,"City","LS")
setElementPosition(ped,756.03051757813, -1239.4184570313, 13.552116394043)
addEventHandler("onClientGUIClick", root, bLS)
end
end
function lvT()
addEventHandler("onClientRender", root, lvT)
dxDrawText("Las Venturas",433.0,539.0,641.0,585.0,tocolor(255,255,255,255),3.0,"default","left","top",false,false,true)
end
function sfT()
addEventHandler("onClientRender", root, sfT)
sf = dxDrawText("San Fierro",433.0,539.0,641.0,585.0,tocolor(255,255,255,255),3.0,"default","left","top",false,false,true)
end