Jump to content

Call


Axel

Recommended Posts

Posted

The ressource is running, there is no errors in the script (/debugscript 3),the script works alone, but calling/exports does not work..

Posted

Why didn't you said that the script is not working at all? you named 3 labels with numbers, that's not possible, and that causes errors.

P.S. dxDrawText also has errors.

Edit: In general, your script is a total mess, full of bugs, is not the exported function the problem.

Edit2: I've fixed all the errors shown in the debugscript, but I don't know what is this, so you'll have to fix the rest.

x,y = guiGetScreenSize() 
l1 = guiCreateLabel(x,0,0,0,"",false) 
l2 = guiCreateLabel(x,0,0,0,"",false) 
l3 = guiCreateLabel(x,0,0,0,"",false) 
guiSetVisible(l1,false) 
guiSetVisible(l2,false) 
guiSetVisible(l3,false) 
gc1 = guiCreateLabel(x,0,0,0,"-65536",false) 
gc2 = guiCreateLabel(x,0,0,0,"-65536",false) 
gc3 = guiCreateLabel(x,0,0,0,"-65536",false) 
guiSetVisible(gc1,false) 
guiSetVisible(gc2,false) 
guiSetVisible(gc3,false) 
  
function deseneaza() 
x,y = guiGetScreenSize() 
t1 = guiGetText(l1) 
t2 = guiGetText(l2) 
t3 = guiGetText(l3) 
a = 0.02 
dxDrawText(t1,a*x,0.685*y,1,1,tocolor(255,255,255,255),1.2,"arial") 
dxDrawText(t2,a*x,0.655*y,1,1,tocolor(255,255,255,255),1.2,"arial") 
dxDrawText(t3,a*x,0.625*y,1,1,tocolor(255,255,255,255),1.2,"arial") 
end 
addEventHandler("onClientRender",root,deseneaza) 
  
setTimer( 
function() 
removeEventHandler("onClientRender", getRootElement(),deseneaza) 
end, 1300,0) 
  
function opGT(text,c1,c2,c3) 
local time = getRealTime() 
local hours = time.hour 
local minutes = time.minute 
local secs = time.second 
if hours < 10 then hours = "0"..hours end 
if minutes < 10 then minutes = "0"..minutes end 
if secs < 10 then secs = "0"..secs end 
theTime = hours..":"..minutes..":"..secs 
t1 = guiGetText(l1) 
t2 = guiGetText(l2) 
t3 = guiGetText(l3) 
guiSetText(l2,t1) 
guiSetText(l3,t2) 
tc1 = guiGetText(gc1) 
tc2 = guiGetText(gc2) 
tc3 = guiGetText(gc3) 
guiSetText(gc2,tc1) 
guiSetText(gc3,tc2) 
guiSetText(gc1,"["..theTime.."] "..text) 
c1,c2,c3 = tonumber(c1),tonumber(c2),tonumber(c3) 
color = tocolor(c1,c2,c3) 
return "true: added text '"..text.."'" 
end 
  
setTimer(opGT,500,299,"Hello world",255,0,70) 
  
addEvent("callOpGT",true) 
addEventHandler("callOpGT",root, 
function(text,c1,c2,c3) 
opSGT(text,c1,c2,c3) 
end) 
  
function opSGT(text,c1,c2,c3) 
t1 = guiGetText(l1) 
t2 = guiGetText(l2) 
t3 = guiGetText(l3) 
guiSetText(l2,t1) 
guiSetText(l3,t2) 
tc1 = guiGetText(gc1) 
tc2 = guiGetText(gc2) 
tc3 = guiGetText(gc3) 
guiSetText(gc2,tc1) 
guiSetText(gc3,tc2) 
guiSetText(l1,text) 
c1,c2,c3 = tonumber(c1),tonumber(c2),tonumber(c3) 
color = tocolor(c1,c2,c3) 
end 

Posted

Lua is case-seisitive, so are function names. If you export "opgt" but the actual function name is "opGT" then that function will never be called.

Posted

I'm pretty sure it is all right now, but still it does not output when i call it. It does when i start the ressource

(

setTimer(opGT,500,299,"Hello world",255,0,70)  

) but not when i call it..

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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