xXNemesiSXx Posted April 19, 2011 Share Posted April 19, 2011 How can i set that you download a resource before the other resources? and can also somebody tell me how can i make a resource that set the camera of the player moving around a point? Link to comment
Castillo Posted April 19, 2011 Share Posted April 19, 2011 About the resources part, i have no idea, i think it is impossible. Link to comment
xXNemesiSXx Posted April 19, 2011 Author Share Posted April 19, 2011 I saw in some freeroam servers that for first you do a little download and after you download other resources... like this server: GTA IV cars/freeroam/drift/race/stunt Link to comment
xXNemesiSXx Posted April 19, 2011 Author Share Posted April 19, 2011 Sorry for triple post, but it is better than open a new thread...! Uff now i've another problem... how can i create a script that start a resource in a prestabilited game hour? for example it starts hay when the game hour is 21:00 and stops it at 00:00... Link to comment
proracer Posted April 19, 2011 Share Posted April 19, 2011 Try this, but I didn't tested and I think it won't work.. try to fix somehow if you can, I'm just too lazy to test. -- USEFUL FUNCTION: // [url=https://wiki.multitheftauto.com/wiki/GetTimestamp]https://wiki.multitheftauto.com/wiki/GetTimestamp[/url] // Big thanks to author! -- function getTimestamp(year, month, day, hour, minute, second) -- initiate variables local monthseconds = { 2678400, 2419200, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, 2678400 } local timestamp = 0 local datetime = getRealTime() year, month, day = year or datetime.year + 1900, month or datetime.month + 1, day or datetime.monthday hour, minute, second = hour or datetime.hour, minute or datetime.minute, second or datetime.second -- calculate timestamp for i=1970, year-1 do timestamp = timestamp + (isLeapYear(i) and 31622400 or 31536000) end for i=1, month-1 do timestamp = timestamp + ((isLeapYear(year) and i == 2) and 2505600 or monthseconds[i]) end timestamp = timestamp + 86400 * (day - 1) + 3600 * hour + 60 * minute + second timestamp = timestamp - 3600 --GMT+1 compensation if datetime.isdst then timestamp = timestamp - 3600 end return timestamp end function startAndStopTheResource ( ) local theResource = getResourceFromName ( 'editor_main' ) local start = startResource ( theResource ) local stop = stopResource ( theResource ) local startAt = getTimeStamp ( year, month, day, hour, minute, second ) if ( startAt ( hour ) ) == 12 then start else return end if ( startAt ( hour ) ) == 0 then stop else return end end addEventHandler ( 'onResourceStart', resourceRoot, startTheResource ) Link to comment
Gungneer Posted April 20, 2011 Share Posted April 20, 2011 xXNemesiSXx said: Sorry for triple post, but it is better than open a new thread...! Uff now i've another problem... how can i create a script that start a resource in a prestabilited game hour? for example it starts hay when the game hour is 21:00 and stops it at 00:00... As far as I'm aware, the game time in MTA isn't synced across players in MTA 1.05, however, this is planned to be fixed for MTA 1.1, but regardless of this fact, stopping and starting a resource in game based on time? I would personally advise against this. I'm not sure what you're trying to create, but I would suggest looking into the "getTime()" function and for example if you wanna make a Fast-food place open between certain hours, you make the marker then when they hit that marker, you check the time, and then if the player has tried to go into it when the time is say midnight, and the store is only open 6am-10pm, then you pop up a message saying they cna't enter yet and stop processing the function for the marker by "return"ing the function. If I've misunderstood you and just typed a load of random bullshit then please, feel free to ignore and tell me that I was wrong. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now