Jump to content

Drakath

Members
  • Posts

    768
  • Joined

  • Last visited

Everything posted by Drakath

  1. Drakath

    Animation

    I was wrong, toggleControl didn't fix it after all. Even though I disabled the jump, if a player clicks shift, the animation stops.
  2. 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.
  3. I can do that easily but the question is how do you send that table to server when a player leaves the server.
  4. 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.
  5. 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.
  6. How can I trigger a server event via client side when a player leaves?
  7. Drakath

    Effects

    Why aren't effects available to attach? Also, update the wiki page getElementsByType, "effect" is not listed in there. Are developers going to make this available or is there some kind of problem with effects?
  8. 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.
  9. 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.
  10. That's not a picture, it's a textdisplay. https://wiki.multitheftauto.com/wiki/Textdisplay
  11. 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?
  12. 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?
  13. Drakath

    Animation

    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?
  14. Drakath

    Animation

    Is there a way to set an animation that a player can not stop by jumping?
  15. So I can't pass server objects to client either?
  16. 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.
  17. By whom coordinates are you trying to calculate?
  18. Seems to work fine. Thank you
  19. 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?
  20. Lol, it won't work. Didn't you read what CrystalMV posted?
  21. 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
  22. 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.
  23. No, I need to only return players which are near another object I stated.
  24. 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?
×
×
  • Create New...