-
Posts
6,063 -
Joined
-
Last visited
-
Days Won
209
Everything posted by IIYAMA
-
Anyway, I will install this weekend 1.6, so I can release full project train directly after 1.6 comes out. (If there will be another beta, it will be in 1.6 too.) Another thing, the name of the resource(project train) sounds a little bit standard. So I might change it in something more creative. If you guys have any idea's for a better name, let me know.
- 28 replies
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
Possible, yet you will use more bandwidth and server power.Two things you don't want. And the most critical part of moveObject is that it isn't using lightweight_sync when those objects aren't streamed out. The reason why I know this, is because I once created serverside projectiles with moveObject.
- 28 replies
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
Because it is stupid to give clients rights for editing their score. This is what serverside and serverside only should do.
-
Yea, I have to calculate a lot. But that isn't really a problem, because I know how to do it. About spawning trains at the nearest spawnpoint, I don't have to spawn them at a spawnpoint. When you take the railroad, which is ... long, you splits it up in the amount of trains. You calculate the progress and you keep moving them on the correct location. Full version: Al thought there are no elements when the trains are streamed out. You still have to calculate where they are in order to keep it perfect synced. About timers, did you ever used the resource missiontimer? Well the thing about timers is that MTA is handling those. But somehow if I use too much of them they are starting to lagg. So if you have too much timers, you can also choose for lua to handle them. And in my opinion it works pretty well. Edit it as you want. (I just wrote it, it is NOT checked if everything is correct) local globalTimer = false local globalTimerContainer = {} local globalTimerFunction = function () local timeNow = getTickCount() for i=#globalTimerContainer,1,-1 do -- inverse the loop, important for table.remove. local timerData = globalTimerContainer[i] if timeNow > timerData["endTime"] then timerData["callbackFunction"](unpack(timerData["arguments"])) table.remove(globalTimerContainer,i) end end if #globalTimerContainer == 0 then killTimer(globalTimer) globalTimer = false end end local addTimer = function (...) local timerData = {...} local endTime = timerData[1] table.remove(timerData,1) local callbackFunction = timerData[1] table.remove(timerData,1) globalTimerContainer[#globalTimerContainer+1] = {["endTime"]=endTime,["callbackFunction"]=callbackFunction,["arguments"]=timerData} if not globalTimer or not isTimer(globalTimer) then globalTimer = setTimer(globalTimerFunction,100,0) end end --addTimer(endTime,callbackFunction,argument1,argument2,argument3, etc.) -------------------------------- function callThisFunctionBack(argument) outputChatBox(argument) end --addTimer(endTime,callbackFunction,argument1,argument2,argument3, etc.) addTimer(getTickCount()+1300,callThisFunctionBack,"IIYAMA")
- 28 replies
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
Yea, about that competition I probably misunderstood. Since you mentioned it, it was bugging me. About the onClientRender > onClientPreRender part. (onClientRender is too slow) If players have different fps, they both see the same train-speed. Yet, the one with the highest fps will see a smoother animation. When players their fps are not the same, the collision detection is not the same. Not only with onClientPreRender but the same with setControlState, because this is something from gta. To prevent misunderstandings, I am not setting any trainspeed but it's position. Why position instead of trainspeed? You can predict it's next position(per frame) when you know how long the railroad is + how fast the custom trainspeed is. That is the big secret behind it... getTickCount() Which gives me the problem with stopping the train at stations. Why not using peds? There are too many players with bad internet, circa 70% of players that visit my stealth server. I just want stable trains controlled by serverside and executed by clientside. That's main reason why I build it this way. Anyway your script can also use some optimisation. You don't need a sync timer for all trains. Serverside can only execute every(all timers from the whole server) timer once in the circa 65 ms. Within those circa 65 ms no timer can get executed. You might think those timers are accurate, but they are far from it. 1 timer executing a loop would be enough. You can test it yourself with:(serverside) local lastExecution = 0 local executionFunction function (timerName) local timeNow = getTickCount() outputDebugString(timerName .. " " .. timeNow-lastExecution .. " delay (ms)") lastExecution = timeNow end addEventHandler("onResourceStart",resourceRoot, function () local startNextTimer = function () -- prepare the code of the second timer, so it has no delay when creating. setTimer(executionFunction,50,0,"timer2") end lastExecution = getTickCount() setTimer(executionFunction,50,0,"timer1") setTimer(startNextTimer,75,0) -- add an extra delay of 25 ms. end)
- 28 replies
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
I took a look at it. But my inspiration came from gta itself. GTWtrain also took it's inspiration from GTA san, so... Or well I can better say you did... About the usage. As I said on top, client side isn't optimised. (far from it) - Trains are never be destroyed and they are clientside. - Yes, onClientPreRender. In order to keep it perfect synced without lagg. And no, I am not changing the speed. If I do this by changing the speed, the result would be a desync. You might say that rendering a position uses too much memory, I disagree with that. Your info about performance is based on 15* trains, which will be in the full release the streamed in trains(1). - I didn't disable the streamed in/out functionality and it doesn't have to be. When the trains are created they can't change track. *Depends how many you enable. AND a both all, this IS A BETA. What matters is that it works, optimisation comes with the full release. Go record these performance statics with the full release. Using them on a beta resource vs full resource is just... You might see this as a competition, but I am not busy with that part. I just want to build a perfect project which I like and doing it my way. If you want a competition, then I will decline it. /me not interested in that kind of childish stuff.
- 28 replies
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
Aren't you listening? You have to prevent that the account gets bugged, not work around.
-
Nice! For 1.6 I assume? Because setTrainTrack+getTrainTrack will be released in 1.6 too.
-
http://www.steve-m.com/downloads/tools/colleditor2/ Afaik I got this software from this site, to split a castle mod.
-
True, but since there is no "onPlayerTeamChange" event, he has to search the whole dayz script to find places where the team has been set. And after that(+ adding exports), he can only use it for the dayz gamemode. That's why I suggested it that way. Woow, 2750 posts I am now a Foot Soldier O_o"
-
Why don't you fix the problem instead of solving it after it went wrong?
-
You have to check the players their team with an: infinity timer + player loop + table with their last team/teamcolor.
-
Btw. The beta resource is only available here. (not on the resource page) When the time comes, I will add full release on both. In my opinion beta resources are not meant for the resource page. Also if you find any more bugs next to misplaced trains or missing traincarts. Let me know, the more feedback I get the more I can fix.
- 28 replies
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
@xXMADEXx Tip: Creating a gui to add child's to xml file. + - Checks if files exist. - Checks the info. (allowed characters etc.) Because if inexperience people make a typo, the whole xml file will be corrupted.
-
You can center the text inside it's boundingbox. No need for extreme calculations.
-
The root element, which is the result of the function getRootElement() (root = getRootElement()), is a dynamic element. Which can be anything and everything. While resourceRoot can't. If I pass down resourceRoot through my triggerEvent, it will be the source of next the eventHandler which is attached to that event. And now coming back to your question. When I define root in an addEventHandler, it will trigger at any element I am passing down. Which can be a player, a marker, a ped, a vehicle. But when I define the element I am passing down from the triggerEvent to the eventHandler, it can only be that element. The reason why I am using resourceRoot, is because I don't want to have conflicts with custom triggerEvents. Yet, it is not very important since that doesn't happen very often. Normally people write longer and complexer event names(like I did in this code). When you take a close look at your code now: Client triggerServerEvent([color=#0000FF]"onPlayerRequestingMusicData"[/color],[color=#FF0000]resourceRoot[/color]) Server addEvent([color=#0000FF]"onPlayerRequestingMusicData"[/color],true) addEventHandler([color=#0000FF]"onPlayerRequestingMusicData"[/color],[color=#FF0000]resourceRoot[/color], function () [color=#FF0000] -- source [/color] if isElement(client) then triggerClientEvent(client,[color=#00FF00]"onClientPlayerReceiveMusicData"[/color],[color=#FF0000]resourceRoot[/color],Music) end end) Client addEvent([color=#00FF00]"onClientPlayerReceiveMusicData"[/color],true) addEventHandler([color=#00FF00]"onClientPlayerReceiveMusicData"[/color],[color=#FF0000]resourceRoot[/color], function (Music) [color=#FF0000] -- source [/color] local row,col = guiGridListGetSelectedItem( grid ) if Music[row+1] and Music[row+1][2] then local sound = playSound3D (Music [row+1][2], x,y,z,true) if sound then setSoundVolume ( sound , 1 ) end end end)
-
@Markeloff Yea, that's because of that railroad track problem. I can't wait for those getTrainTrack() and setTrainTrack() features in 1.6, so I can fix it. But I have no idea how long it will last until the release. The trains are never been destroyed, they travel around the map like remote players do. But I chance this when those features in 1.6 come out, for now I keep it like this because when a train is created, it picks it's track. Once that happens, it can never be another track. So the script has to recreate trains until they pick the right one. Which will be checked by comparing the distance between the rail-road and the train itself. Thank you for your feedback!
- 28 replies
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
Project trains This resource creates multiple trains driving around the map and make them drive automatic. It makes San Andreas a little bit more alive. You can set-up how much trains are created, how fast they go, minimal/maximal amount of trainscarts they are pulling and some more. Versions Version 1.0.0 Serverside time synced trains for multiplayer Admin panel settings Version 2.0.0 Uncompiled Better optimised than previous versions. CPU (3,5-3,9 GHz) 4 trains +/- 1.22% usage 40 trains +/- 7.05% usage Overkill Cleaned up a lot of the old code (I wrote this in 2015.. , never the less it is still ugly :C) Added some custom train-cart designs. Fixed all known bugs. Trains won't stop, even in this version. But you can try to make that yourself... Improved bandwidth You can design your own traincarts in the map editor, see documentation after clicking on the lazy download link Bugs: GTA spawn bug: Incorrect train spawn, see documentation. Repository Lazy <you> transport Armed to the teeth Admin panel settings Building your own traincarts with the map editor Download here - project trains 2.0.0
- 28 replies
-
- 9
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
Something like this should do the job. Now memorize it, because I am not for requesting. Server local Music = { { "Hip Hop Radio", "http://mp3uplink.duplexfx.com:8054/listen.pls" }, { "Electo", "http://stream.electroradio.ch:26630/" }, { "Reggae", "http://184.107.197.154:8002" }, { "Rap", "http://173.245.71.186:80" }, } addEvent("onPlayerRequestingMusicData",true) addEventHandler("onPlayerRequestingMusicData",resourceRoot, function () if isElement(client) then triggerClientEvent(client,"onClientPlayerReceiveMusicData",resourceRoot,Music) end end) Client addEvent("onClientPlayerReceiveMusicData",true) addEventHandler("onClientPlayerReceiveMusicData",resourceRoot, function (Music) local row,col = guiGridListGetSelectedItem( grid ) if Music[row+1] and Music[row+1][2] then local sound = playSound3D (Music [row+1][2], x,y,z,true) if sound then setSoundVolume ( sound , 1 ) end end end) addEventHandler("onClientResourceStart",resourceRoot, function () triggerServerEvent("onPlayerRequestingMusicData",resourceRoot) end)
-
Just for the info. With the normal code on wiki, you will get problems with helicopters and planes that don't stop exploding.
-
https://wiki.multitheftauto.com/wiki/SetPedStat
-
No. Only an overwrite in lua might make it possible. Which is far from real bullets and afaik not even close to your lua skills.
-
Did you checked your debug? Because there were warnings, knowing just by looking at your code. local respawnTimers = {} function testRespawn(vehicle) respawnTimers[vehicle] = nil respawnVehicle(vehicle) end function getElementsOnExplode() if not respawnTimers[source] then respawnTimers[source] = setTimer ( testRespawn, 1000, 1,source ) end end addEventHandler("onVehicleExplode", root, getElementsOnExplode)
-
quality crappy if because he uses low resolution, but that effects if u make/or add crappy looking resources, too. I am talking about the code(dayz), not his screenshot. I am not that stupid... Quality code doesn't show errors or warnings.
-
So much work on a gamemode like that and such a crappy quality.