Jump to content

Crear variable global


CeKiT

Recommended Posts

Hola que tal, tengo un problema con crear una variable global tengo esto:

toptimes_server.lua

function showCountry () 
cCountry = exports.admin:getPlayerCountry(source) 
end 
addEventHandler("onPlayerJoin", g_Root, showCountry) 

toptimes_client.lua

      dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.93)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/".. cCountry ..".png",tocolor(255,255,255,255)) 
             

no entiendo que es lo que estoy haciendo mal que en el debugsript me dice nil value.

Link to comment

Server-side:

  
    function showCountry () 
    setElementData(source, "country", exports.admin:getPlayerCountry(source) ) 
    end 
    addEventHandler("onPlayerJoin", g_Root, showCountry) 
  

Client-side:

  
if not cCountry then cCountry = getElementData(localPlayer, "country" ) end  
          dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.93)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/".. cCountry ..".png",tocolor(255,255,255,255)) 
  

Link to comment
Server-side:
  
    function showCountry () 
    setElementData(source, "country", exports.admin:getPlayerCountry(source) ) 
    end 
    addEventHandler("onPlayerJoin", g_Root, showCountry) 
  

Client-side:

  
if not cCountry then cCountry = getElementData(localPlayer, "country" ) end  
          dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.93)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/".. cCountry ..".png",tocolor(255,255,255,255)) 
  

Gracias capo, me solucionaste la vida varias veces. Al igual que solid

Link to comment
  • Recently Browsing   0 members

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