Jump to content

Problem with ..


kuba90pl

Recommended Posts

I have problem with triggetServerEvent function, here's the code:

client:

otwarte=0 
function guie() 
if otwarte == 0 then 
showCursor(true) 
otwarte=1 
window = guiCreateWindow(500,169,271,360,"World Properties by Kuba ",false) 
label = guiCreateLabel(93,42,117,25,"Sky color",false,window) 
  
memo1= guiCreateMemo(9,70,59,32,"R",false,window) 
memo2 = guiCreateMemo(68,70,59,32,"G",false,window) 
memo3 = guiCreateMemo(127,70,59,32,"B",false,window) 
but1 = guiCreateButton(188,70,75,33,"Do it!",false,window) 
label2 = guiCreateLabel(86,112,88,26,"Water color",false,window) 
  
memo4 = guiCreateMemo(11,134,58,36,"R",false,window) 
memo5 = guiCreateMemo(69,134,58,36,"G",false,window) 
memo6 = guiCreateMemo(127,134,58,36,"B",false,window) 
but2 = guiCreateButton(190,137,70,33,"Do it!",false,window) 
label3 = guiCreateLabel(72,182,91,28,"Set time",false,window) 
  
memo7 = guiCreateMemo(40,200,58,36,"hours",false,window) 
memo8 = guiCreateMemo(98,200,58,36,"mins",false,window) 
but3 = guiCreateButton(190,207,70,33,"Do it!",false,window) 
but4 = guiCreateButton(12,260,82,32,"Allow car fly like airplanes",false,window) 
but5 = guiCreateButton(101,261,82,32,"Allow car drive on water",false,window) 
but6 = guiCreateButton(188,261,82,32,"Close window",false,window) 
but7 = guiCreateButton(12,310,82,32,"Disable flying cars",false,window) 
but8 = guiCreateButton(101,310,82,32,"Disable driving on water cars",false,window) 
but9 = guiCreateButton(188,310,82,32,"Save",false,window) 
addEventHandler("onClientGUIClick" ,but6, zamknij) 
addEventHandler("onClientGUIClick" ,but1, kolorn) 
addEventHandler("onClientGUIClick" ,but2, kolorw) 
addEventHandler("onClientGUIClick" ,but3, czas) 
addEventHandler("onClientGUIClick" ,but4, carf) 
addEventHandler("onClientGUIClick" ,but5, carw) 
addEventHandler("onClientGUIClick" ,but7, carfd) 
addEventHandler("onClientGUIClick" ,but8, carwd) 
addEventHandler("onClientGUIClick" ,but9, send) 
  
else outputChatBox("You opened already one window") 
end 
end 
bindKey("o","up",guie) 
  
function zamknij() 
otwarte=0 
destroyElement(window) 
showCursor(false) 
end 
  
function kolorn() 
r=guiGetText(memo1) 
g=guiGetText(memo2) 
b=guiGetText(memo3) 
if r and g and b then 
setSkyGradient(r,g,b,r,g,b) 
else outputChatBox("Error creating sky color- try check r,g,b values") 
end 
end 
  
function kolorw() 
r1=guiGetText(memo4) 
g1=guiGetText(memo5) 
b1=guiGetText(memo6) 
if r1 and g1 and b1 then 
setWaterColor(r1,g1,b1) 
else outputChatBox("Error creating water color- try check r,g,b values") 
end 
end 
  
function czas() 
godz=guiGetText(memo7) 
minuta=guiGetText(memo8) 
if godz and minuta then 
setTime(godz,minuta) 
else outputChatBox("Error changing time") 
end 
end 
  
function carf() 
setWorldSpecialPropertyEnabled("aircars",true) 
end 
function carw() 
setWorldSpecialPropertyEnabled("hovercars",true) 
end 
  
function carfd() 
setWorldSpecialPropertyEnabled("aircars",false) 
end 
function carwd() 
setWorldSpecialPropertyEnabled("hovercars",false) 
end 
  
function send() 
rsky=tonumber(r) 
gsky=tonumber(g) 
bsky=tonumber(b) 
rwat=tonumber(r1) 
gwat=tonumber(g1) 
bwat=tonumber(b1) 
h1,m1=getTime() 
outputChatBox(""..rsky.."") 
triggerServerEvent ( "mojevent", getRootElement(), getLocalPlayer(), rsky,gsky,bsky,rwat,gwat,bwat,h1,m1) 
end 
  

server:

function pobieranie(rsky,gsky,bsky,rwat,bwat,gwat,h1,m1) 
r3=rsky 
  
outputChatBox(" "..r3.." ") 
end 
addEvent ( "mojevent", true ) 
addEventHandler ( "mojevent", getRootElement(), pobieranie ) 

so when i click save in my gui script show me in client side rsky(R-color of skycolor)but in server show me error :

" attempt to concatenate global 'r3' (a userdata value)".

How to fix that? I want to get rsky value from client to server.

Link to comment

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