-
Posts
768 -
Joined
-
Last visited
Everything posted by Drakath
-
I'm trying to save the remaining duration of some timers. I am working with getTickCount() as you suggested but I have a small problem: if time and client then timers[client][1] = time end ERROR: attempt to index field "?" (a nil value) Which one is nil? I checked that time and client is not nil.
-
I can do that easily but the question is how do you send that table to server when a player leaves the server.
-
Well, I wouldn't like anyone to change it. (If you have XML saving in mind). I just have a drugs system and I just want to save its effects duration. I saw some servers like SAUR and CIT do it. I guess they use server timers.
-
So there is no way to save data via setAccountData that comes from client side script? I have some client timers that I need to save.
-
How can I trigger a server event via client side when a player leaves?
-
Not sure what you mean. Here's the script: addEvent("myEvent", true) function asdf(text) addEventHandler ( "onClientRender", root, draw ) end addEventHandler("myEvent", root, asdf) function draw (text) blablabla... How can I pass text to function draw? Function asdf receives text from server-side script.
-
You should put it in the function but not as a name of the function. Also, textCreateTextItem is server-side which means you can't use onClientResourceStart. Use onResourceStart instead. Look at the other functions of textdisplay and read what each does. textCreateTextItem won't be enough to make a script you want.
-
That's not a picture, it's a textdisplay. https://wiki.multitheftauto.com/wiki/Textdisplay
-
Now I have another problem. I have called a function with a text argument. In that function I addEventHandler for another function but I also need to pass this text to that function. addEventHandler does not allow custom arguments. How can I work around it?
-
If I want to call a client exported function from server-side script, do I always have to make a new server script which does triggerClientEvent in the exported function's resource? Isn't there a simpler way?
-
Thanks but I have one more problem with the animations. Sometimes when I set an animation and then stop it with: setPedAnimation(client,false) the animation stops for client but other players can still see the animation on that player. Am I doing something wrong or is it a bug?
-
So I can't pass server objects to client either?
-
local x, y, z = getElementPosition(localPlayer) local marker = createMarker(x, y, z-1, "cylinder", 1, 0, 255, 0, 80) triggerServerEvent("myEvent", resourceRoot, x, y, z, marker) Why can't it pass marker? This works if I remove marker from extra arguments in triggerServerEvent but with marker it just doesn't trigger the event.
-
By whom coordinates are you trying to calculate?
-
Seems to work fine. Thank you
-
if table.maxn(myTable) > 0 then local keys = generate_key_list(myTable) local random = myTable[keys[math.random(#keys)]] outputChatBox(random) end I'm going to test it now but I have a couple of questions. 1. Is table.maxn okay to see if there are any players in the table? 2. If I use this client-side triggered by server, would every client receive an output of a different player or the same player?
-
Lol, it won't work. Didn't you read what CrystalMV posted?
-
Ahh, I can't get it to work. Getting the total number isn't hard but how can I make it work with table.random function table.random ( theTable ) return theTable[math.random ( #theTable )] end
-
I see but I can't figure out how to make a work around for this. If I use table.maxn, it returns the right number but table.random doesn't work. Any help with the code would be appreciated.
-
No, I need to only return players which are near another object I stated.
-
I have a problem with table indexes. I used: #myTable to check how much players are in the table, however it always outputted 0 even though I did put some players in the table. table.maxn(myTable) showed a number higher than 0, however when I did table.random(myTable), it outputted: bad argument #1 to 'random' (interval is empty) This is how I put players into table (Server-side): local myTable= {} for index,player in ipairs(getElementsByType("player")) do if getDistanceBetweenPoints3D(Px,Py,Pz,x,y,z) < 100 then myTable[index] = player outputChatBox("Success") end end It does output success but #myTable is 0. Can someone explain why?