Plate Posted August 9, 2012 Share Posted August 9, 2012 function dxsetText() local UP = exports ["exp_system"]:getPlayerLevel(source) if UP >= 1 then dxDrawText("110" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 2 then dxDrawText("160" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 3 then dxDrawText("240" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 4 then dxDrawText("500" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 5 then dxDrawText("2000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 6 then dxDrawText("4000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 7 then dxDrawText("8000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 8 then dxDrawText("12000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 9 then dxDrawText("16000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 10 then dxDrawText("20000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) end end addEventHandler("onChangeLevel",getRootElement(),dxsetText) addEventHandler("onClientRender",getRootElement(),dxsetText) Link to comment
Castillo Posted August 9, 2012 Share Posted August 9, 2012 No, la funcion getPlayerLevel es solo server side. function dxsetText ( ) local UP = tonumber ( getElementData ( localPlayer, "level" ) ) or 0 if UP >= 1 then dxDrawText("110" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 2 then dxDrawText("160" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 3 then dxDrawText("240" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 4 then dxDrawText("500" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 5 then dxDrawText("2000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 6 then dxDrawText("4000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 7 then dxDrawText("8000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 8 then dxDrawText("12000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 9 then dxDrawText("16000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) elseif UP >= 10 then dxDrawText("20000" ,676.0,193.0,721.0,203.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) end end addEventHandler("onClientRender",getRootElement(),dxsetText) Link to comment
Plate Posted August 9, 2012 Author Share Posted August 9, 2012 Fuciona pero no se cambia el texto tampoco se dibuja otro Link to comment
Castillo Posted August 9, 2012 Share Posted August 9, 2012 function dxsetText ( ) local text = "" local UP = tonumber ( getElementData ( localPlayer, "level" ) ) or 0 if ( UP == 1 ) then text = "110" elseif ( UP == 2 ) then text = "160" elseif ( UP == 3 ) then text = "240" elseif ( UP == 4 ) then text = "500" elseif ( UP == 5 ) then text = "2000" elseif ( UP == 6 ) then text = "4000" elseif ( UP == 7 ) then text = "8000" elseif ( UP == 8 ) then text = "12000" elseif ( UP == 9 ) then text = "16000" elseif ( UP == 10 ) then text = "20000" end dxDrawText ( text, 676, 193, 721, 203, tocolor ( 255, 255, 255, 255 ), 1.0, "default", "left", "top", false, false, false ) end addEventHandler ( "onClientRender", root, dxsetText ) Eso funciona. Link to comment
Plate Posted August 9, 2012 Author Share Posted August 9, 2012 Loading script failed:levelup/main_c.lua:29:"("expected near dxsetText Link to comment
Castillo Posted August 9, 2012 Share Posted August 9, 2012 No es de este script, ya que lo probe antes de postearlo. Link to comment
Plate Posted August 9, 2012 Author Share Posted August 9, 2012 No me funciono me sigue diciendo 110 Link to comment
Castillo Posted August 9, 2012 Share Posted August 9, 2012 Ya encontre el error, lo que pasa es que vos estabas comparando si el nivel era: mayor o igual que 1, pero como 2 es mayor que 1, entonces iva a seguir poniendo "110", asi que tenias que comparar si era igual a 1, 2, 3, 4, etc... Copia el ultimo codigo. Link to comment
Plate Posted August 9, 2012 Author Share Posted August 9, 2012 Nose si lo respondistes esto ya o no me quedo grabado pero se le puede poner una bazoka a un bot como lo puedo hacer y si no se puede por lo menos puedo finjir dandole una bazoka y luego ceando el projectil Link to comment
Recommended Posts