Jump to content

esto esta bien?


Plate

Recommended Posts

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

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...