iFoReX Posted May 7, 2012 Author Posted May 7, 2012 I done it now I cant put San Fierro in the Text D: cl-side 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") removeEventHandler("onClientRender", root, texto) removeEventHandler("onClientRender", root, theR) local table = {{731.21276855469, -1276.6033935547, 17.6484375}} setElementPosition( localPlayer, 731.21276855469, -1276.6033935547, 17.6484375 ) 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 theR() if(getElementData(ped,"City")=="LS")then removeEventHandler("onClientRender", root, lsT) setTimer(lvT,1000,1) triggerServerEvent("onCameraLV", getLocalPlayer()) setElementData(ped,"City","LV") ped = createPed( 0, 2323.7517089844, 1283.2214355469, 97.592704772949 ) elseif(getElementData(ped,"City")=="LV")then removeEventHandler("onClientRender",root,lvT) setTimer(sfT,1000,1) triggerServerEvent("onCameraSF", getLocalPlayer()) setElementData(ped,"City","SF") ped = createPed( 0, -1480.8948974609, 920.17132568359, 71.350372314453) elseif(getElementData(ped,"City")=="SF")then removeEventHandler("onClientRender",root,sfT) setTimer(lsT,1000,1) triggerServerEvent("onCameraLS", getLocalPlayer()) setElementData(ped,"City","LS") 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 sv-side addEventHandler("onPlayerLogin",root,function() triggerClientEvent(source, "onVisibleButtons", root) setCameraMatrix(source,755.94171142578, -1258.78125, 18.399745941162, 756.03051757813, -1239.4184570313, 13.552116394043) end) addEvent("onCameraLV", true) addEventHandler("onCameraLV", getRootElement(), function() setCameraMatrix( source, 2322.7954101563, 1257.611328125, 102.61512756348, 2323.7517089844, 1283.2214355469, 97.592704772949 ) end ) addEvent("onCameraSF", true) addEventHandler("onCameraSF", getRootElement(), function() setCameraMatrix( source, -1509.7048339844, 921.08612060547, 75.827659606934, -1480.8948974609, 920.17132568359, 71.350372314453 ) end ) addEvent("onCameraLS", true) addEventHandler("onCameraLS", getRootElement(), function() setCameraMatrix( source, 755.94171142578, -1258.78125, 18.399745941162, 756.03051757813, -1239.4184570313, 13.552116394043 ) end )
Jaysds1 Posted May 7, 2012 Posted May 7, 2012 here: 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") removeEventHandler("onClientRender", root, texto) removeEventHandler("onClientRender", root, theR) local table = {{731.21276855469, -1276.6033935547, 17.6484375}} setElementPosition( localPlayer, 731.21276855469, -1276.6033935547, 17.6484375 ) 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 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 ) 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) elseif(getElementData(ped,"City")=="SF")then removeEventHandler("onClientRender",root,sfT) setTimer(lsT,1000,1) triggerServerEvent("onCameraLS", getLocalPlayer()) setElementData(ped,"City","LS") 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 I've changed the createPed to setElementPosition addEventHandler("onPlayerLogin",root,function() triggerClientEvent(source, "onVisibleButtons", root) setCameraMatrix(source,755.94171142578, -1258.78125, 18.399745941162, 756.03051757813, -1239.4184570313, 13.552116394043) end) addEvent("onCameraLV", true) addEventHandler("onCameraLV", root,function() setCameraMatrix( client, 2322.7954101563, 1257.611328125, 102.61512756348, 2323.7517089844, 1283.2214355469, 97.592704772949 ) end) addEvent("onCameraSF", true) addEventHandler("onCameraSF",root, function() setCameraMatrix( client, -1509.7048339844, 921.08612060547, 75.827659606934, -1480.8948974609, 920.17132568359, 71.350372314453 ) end ) addEvent("onCameraLS", true) addEventHandler("onCameraLS", root, function() setCameraMatrix( client, 755.94171142578, -1258.78125, 18.399745941162, 756.03051757813, -1239.4184570313, 13.552116394043 ) end)
iFoReX Posted May 7, 2012 Author Posted May 7, 2012 yeh when I press the button doesnt disappear the text : I done it : 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") removeEventHandler("onClientRender", root, texto) removeEventHandler("onClientRender", root, theR) 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 I add the spawns in 3 citys But the text doesnt disappear
Jaysds1 Posted May 7, 2012 Posted May 7, 2012 (edited) here: 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(elements)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 added table Edited May 7, 2012 by Guest
Jaysds1 Posted May 7, 2012 Posted May 7, 2012 (edited) 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 Edited May 7, 2012 by Guest
Jaysds1 Posted May 7, 2012 Posted May 7, 2012 doesnt disappear D: lol, I found my mistake, copy the code again please and tell me if it works
iFoReX Posted May 7, 2012 Author Posted May 7, 2012 very THAAAAAAAAAAAAANK YOU ! Work 100000000000000000% Now I put giveWeapon and the SpawnGUI will finished When I start it Script all screen in black D:
Michael# Posted May 7, 2012 Posted May 7, 2012 Samething. addEvent ( 'onVisibleButtons', true ) local iRotation = 0 aLocations = { 'Los Santos'; 'San Fierro'; 'Las Venturas'; } aGUI = { guiCreateButton ( 0.3688, 0.84, 0.0625, 0.055, '<', true ) guiCreateButton ( 0.5013, 0.84, 0.0625, 0.055, '>', true ) guiCreateButton ( 0.4013, 0.9067, 0.1287, 0.065, 'Empezar a Jugar', true ) guiCreateEdit ( 0.4412, 0.8367, 0.05, 0.0567, '', true ) } guiEditSetReadOnly ( aGUI[4], true ) for _, guiElement in pairs ( aGUI ) do guiSetVisible ( guiElement, false ) end -- addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) addEventHandler ( 'onClientGUIClick', root, btnSource ) addEventHandler ( 'onClientRender', root, rotatePed ) end ) -- addEventHandler ( 'onVisibleButtons', localPlayer, function ( ) for _, guiElement in pairs ( aGUI ) do guiSetVisible ( guiElement, true ) end showCursor ( true ) addEventHandler ( 'onClientRender', root, drawTextOne ) bindKey ( 'space', 'down', changeLoc ) uPed = createPed ( 0, 756.03051757813, -1239.4184570313, 13.552116394043 ) end ) function drawTextOne ( ) dxDrawText ( tostring ( aLocations[1] ), 433, 539, 641, 585, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left', 'top', false, false, true ) cCity = aLocations[1] end function drawTextTwo ( ) dxDrawText ( tostring ( aLocations[2] ), 433, 539, 641, 585, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left', 'top', false, false, true ) cCity = aLocations[2] end function drawTextThree ( ) dxDrawText ( tostring ( aLocations[3] ), 433, 539, 641, 585, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left','top', false, false, true ) cCity = aLocations[3] end function btnSource ( ) if ( source == aGUI[3] ) then for _, guiElement in pairs ( aGUI ) do guiSetVisible ( guiElement, false ) end showCursor ( false ) setCameraTarget ( localPlayer ) destroyElement ( uPed ) unbindKey ( 'space' ) removeEventHandler ( 'onClientRender', root, drawText ) setElementPosition ( localPlayer, 731.21276855469, -1276.6033935547, 17.6484375 ) elseif ( source == aGUI[1] ) then if ( getElementModel ( uPed ) == 0 ) then setElementModel ( uPed, 288 ) else setElementModel ( uPed, getElementModel ( uPed ) - 1 ) end guiSetText ( aGUI[4], getElementModel ( uPed ) ) elseif ( source == aGUI[2] ) then if ( getElementModel ( uPed ) == 288 ) then setElementModel ( uPed, 0 ) else setElementModel ( uPed, getElementModel ( uPed ) + 1 ) end guiSetText ( aUI[4], getElementModel ( uPed ) end end function rotatePed ( ) if ( not isElement ( uPed ) ) then return end iRotation = iRotation + 1 setPedRotation ( uPed, iRotation ) end function changeLoc ( ) if ( cCity == aLocations[1] ) then removeEventHandler ( 'onClientRender', root, drawTextOne ) addEventHandler ( 'onClientRender', root, drawTextTwo ) elseif ( cCity == aLocations[2] ) then removeEventHandler ( 'onClientRender', root, drawTextTwo ) addEventHandler ( 'onClientRender', root, drawTextThree ) elseif ( cCity == aLocations[3] ) then removeEventHandler ( 'onClientRender', root, drawTextThree ) addEventHandler ( 'onClientRender', root, drawTextOne ) end end Try that. Oh fuck! I forgot commas on table
ben_wright Posted May 7, 2012 Posted May 7, 2012 end the table with ; not the whole thing. (not like it matters, but it is a lot more organized) --example: tTable = { '1', '2', '3'; } addEvent ( 'onVisibleButtons', true ) local iRotation = 0 aLocations = { 'Los Santos', 'San Fierro', 'Las Venturas'; } aGUI = { guiCreateButton ( 0.3688, 0.84, 0.0625, 0.055, '<', true ), guiCreateButton ( 0.5013, 0.84, 0.0625, 0.055, '>', true ), guiCreateButton ( 0.4013, 0.9067, 0.1287, 0.065, 'Empezar a Jugar', true ), guiCreateEdit ( 0.4412, 0.8367, 0.05, 0.0567, '', true ); } guiEditSetReadOnly ( aGUI[4], true ) for _, guiElement in pairs ( aGUI ) do guiSetVisible ( guiElement, false ) end -- addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) addEventHandler ( 'onClientGUIClick', root, btnSource ) addEventHandler ( 'onClientRender', root, rotatePed ) end ) -- addEventHandler ( 'onVisibleButtons', localPlayer, function ( ) for _, guiElement in pairs ( aGUI ) do guiSetVisible ( guiElement, true ) end showCursor ( true ) addEventHandler ( 'onClientRender', root, drawTextOne ) bindKey ( 'space', 'down', changeLoc ) uPed = createPed ( 0, 756.03051757813, -1239.4184570313, 13.552116394043 ) end ) function drawTextOne ( ) dxDrawText ( tostring ( aLocations[1] ), 433, 539, 641, 585, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left', 'top', false, false, true ) cCity = aLocations[1] end function drawTextTwo ( ) dxDrawText ( tostring ( aLocations[2] ), 433, 539, 641, 585, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left', 'top', false, false, true ) cCity = aLocations[2] end function drawTextThree ( ) dxDrawText ( tostring ( aLocations[3] ), 433, 539, 641, 585, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left','top', false, false, true ) cCity = aLocations[3] end function btnSource ( ) if ( source == aGUI[3] ) then for _, guiElement in pairs ( aGUI ) do guiSetVisible ( guiElement, false ) end showCursor ( false ) setCameraTarget ( localPlayer ) destroyElement ( uPed ) unbindKey ( 'space' ) removeEventHandler ( 'onClientRender', root, drawText ) setElementPosition ( localPlayer, 731.21276855469, -1276.6033935547, 17.6484375 ) elseif ( source == aGUI[1] ) then if ( getElementModel ( uPed ) == 0 ) then setElementModel ( uPed, 288 ) else setElementModel ( uPed, getElementModel ( uPed ) - 1 ) end guiSetText ( aGUI[4], getElementModel ( uPed ) ) elseif ( source == aGUI[2] ) then if ( getElementModel ( uPed ) == 288 ) then setElementModel ( uPed, 0 ) else setElementModel ( uPed, getElementModel ( uPed ) + 1 ) end guiSetText ( aUI[4], getElementModel ( uPed ) ) end end function rotatePed ( ) if ( not isElement ( uPed ) ) then return end iRotation = iRotation + 1 setPedRotation ( uPed, iRotation ) end function changeLoc ( ) if ( cCity == aLocations[1] ) then removeEventHandler ( 'onClientRender', root, drawTextOne ) addEventHandler ( 'onClientRender', root, drawTextTwo ) elseif ( cCity == aLocations[2] ) then removeEventHandler ( 'onClientRender', root, drawTextTwo ) addEventHandler ( 'onClientRender', root, drawTextThree ) elseif ( cCity == aLocations[3] ) then removeEventHandler ( 'onClientRender', root, drawTextThree ) addEventHandler ( 'onClientRender', root, drawTextOne ) end end also, take a closer look on line 115.
ben_wright Posted May 7, 2012 Posted May 7, 2012 I'm just trying to help. As I said, it looks more organized. And everyone here complains about tabulating codes & designing it properly. As you said, do as you wish.
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