Jump to content

dn83

Members
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dn83

  • Rank
    Square
  1. dn83

    Lua functions

    Ok, thanks Hmm, didn't think of comparing them individually. That of course needs more fields wherever they are saved..
  2. dn83

    Lua functions

    Ok, millisecond accuracy isn't needed, I just wrote (milli)seconds because thats what getTickCount returns.. Perhaps I can even do without seconds. Anyway, what I wanted is something like this: currentTime = os.time() futureTime = currentTime + 60*60*24*3 (to set the futureTime 3 days later if we are dealing with seconds) storeTimeSomewhere(futureTime) and then later I can check if we are past the set time or not simply using currentTime = os.time() theTime = getTheStoredTimeFromSomewhere(futureTime) if( currentTime > theTime ) then something else keep waitin end... Get it?
  3. Hmm, how about this function? function spawnProtectEnd (player) setElementData ( player, "spawnprotected", false ) local elements = getAttachedElements(player) -- get all elements attached to the player as a table (shouldn't be any others, but hey, you never know.. : ) ) for k,v in ipairs(elements) do -- search the table... if(getElementType(v) == "marker") then -- ... and when a marker-element is found -- detachElementFromElement(v, player) -- try with and without this line destroyElement(v) -- delete it. end end
  4. I was thinking, how about making a custom clock: remove the ingame-clock (showPlayerHudComponent() ), and make a new clock (createTextDisplay() ), and update it once a minute along with setting a new game-time with setTime().. Anybody understand what I mean? I'm not surprised if you don't That would probably stop the flickering, as the time is set only once a minute. The sun/moon might skip slightly backwards when the new time is set, but is it noticeable? Don't know. Now I really need to sleep, I might try and do this some other day when I have time. If someone else hasn't made it already
  5. is that right? and also, how would i go about running this on the server to test, like, is that the only stuff to go in the .lua file? or is more code neded or what? Not quite, it's setTimer( function , delay , iterations ) -- 0 iterations are infinite, a loop so it would be setTimer( syncTime , 500 , 0 )
  6. 83, not 68.. Hmm, try naming the function something else than setTime(), as it's already reserved.. Now I also noticed what was written further down on the page. But on the top of the wiki-page it still clearly says: "This function gets the real server time and returns it in a table."
  7. dn83

    Lua functions

    This native lua-function doesn't seem to work: os.time() - (http://www.lua.org/manual/5.1/manual.html#pdf-os.time) getRealTime() won't help in this case, since I need to have the time in (milli)seconds since some predefined time (1-1-1970_00-00 ?) getTickCount() won't do it either, it only returns milliseconds from when the server was started..? I need to easily be able to compare two times ( < or > ) even though the server has been shut down between these two events. Any ideas? (besides calculating these seconds from getRealtime() -.year -.month etc. as that wouldn't be completely
  8. replace the eventhandler with a setTimer() The wiki says getRealTime() returns the servertime, also when run as a client script. Don't know if it's true (and don't know why it wouldn't be ), but if it is true then all players will have the same time on their screen (server-time)
  9. I think I saw a discussion about this exact same thing somewhere, but I can't remember where.. (some other thread probably) Try this one: (client-side) function syncTime() local realTime = getRealTime() local hour = realTime.hour local minute = realTime.minute setTime( hour , minute ) end addEventHandler( "onClientRender" , rootElement , syncTime ) I tried it and it works, but I think sky flickering is increased and fps decreased.. Could be my imagination.. Might work better serverside, with a timer instead of the onClientRender (there has to be something to
  10. Try detaching the marker from the player before destroying it.
  11. Exactly. The developers have probably tried anything they can think of to find bugs, so what's left to do is try the unthinkable!
  12. Yes I noticed your script, Rabbit. My script was never intended for an actual release, I don't even have a public server.. I'm just trying to learn scripting on my own So don't feel threatened that I'm trying to take over your business My real question however was why the vehicles aren't always completely removed.. Seems like you have also encountered this (quoted from your help.xml): "-During our last tests it seemed that sometimes a vehicle really gets destroyed, but the model doesn't get despawned. We think however this is an external issue from another resource probably, but just to
  13. Especially freeroam spawnpoints can get pretty chaotic after a while when players create vehicles near the spawn, and those vehicles later respawn after being destroyed somewhere else. And some players just create alot of vehicles they never intend to use.. I thought, isn't there an easy way for admins to get rid of them vehicles? Oh wait, this is mta:dm, I can script that myself! Now, this is not a release, but rather a problem! You see, most of the time this script works perfectly! Sometimes though it might just say that the vehicle is removed, but it is still visible.. Thing is, I canno
  14. I totally agree with you, Sovetskeey. But remember, this is only a preview release, released one week ago. Most servers are probably running on default settings, with the included demo-gamemodes. I think, and hope, that we in the near future will see more servers dedicated to a specific gamemode, once the community gets their own scripts written.
×
×
  • Create New...