.:HyPeX:. Posted January 9, 2015 Share Posted January 9, 2015 Hey guys, wich is the proper way to remove the race client bootop? I want to create a login panel, but the race kicking in is kinda annoying, how can i delay it properly and then start it back up? (Wich evens i must edit). all my tries ended up in race loading in mode freeroam and bugging... Link to comment
MTA Team botder Posted January 10, 2015 MTA Team Share Posted January 10, 2015 File: _joiner_client.lua (Line 143) triggerServerEvent('onLoadedAtClient', resourceRoot, g_Me ) Add a '--' before the function. When the player is ready (after your stuff) you can trigger the event. triggerServerEvent('onLoadedAtClient', getResourceRootElement(getResourceFromName("race")), localPlayer ) Link to comment
.:HyPeX:. Posted January 10, 2015 Author Share Posted January 10, 2015 i was trying to fire it from the server side, apparently client-side worked. Thanks. Link to comment
.:HyPeX:. Posted January 10, 2015 Author Share Posted January 10, 2015 Well i got a bug, when i enabled it on my custom race it fails to work properly (Thought on default one works like a charm..) The fact is, when i log in the race loads the map, (it does the countdown and then travelling) But race does not load the map properly, the map name stats as N/A, and the map is not started at all. (Event onClientMapStarting isnt fired). Forcing another map doesnt work. Restarting the race fixes the issue. (If you're already logged in it does fire your resource start) The only real difference i noticed is that the default race had the votemanager part. (Selecting the map out of 9). No debug errors. Link to comment
MTA Team botder Posted January 10, 2015 MTA Team Share Posted January 10, 2015 I can't really help because I don't know you custom race. Link to comment
.:HyPeX:. Posted January 10, 2015 Author Share Posted January 10, 2015 I can't really help because I don't know you custom race. What fires onClientMapStarting? so i check what is not being actually fired. (Tracking down the bug) Link to comment
MTA Team botder Posted January 10, 2015 MTA Team Share Posted January 10, 2015 Should be the race resource Link to comment
.:HyPeX:. Posted January 11, 2015 Author Share Posted January 11, 2015 Well, i guess i found some errors.. 2015-01-11 00:11:50] CONNECT: Emp/#0fc366~HyPeX~ connected (IP: 181.31.38.23 Serial: F27CCCFAB293B848763C115C76C09442 Version: 1.4.0-9.06985.0) [2015-01-11 00:11:51] JOIN: Emp/#0fc366~HyPeX~ joined the game (IP: 181.31.38.23) [2015-01-11 00:11:51] WARNING: joinquit/infobox_s.lua:225: Bad argument @ 'setElementData' [Expected bool at argument 4, got string 'AR'] [2015-01-11 00:12:09] LOGIN: Emp/#0fc366~HyPeX~ tried to log in as 'hypex' with an invalid password (IP: 181.31.38.23 Serial: F27CCCFAB293B848763C115C76C09442) [2015-01-11 00:12:13] LOGIN: (CW, Admin, Everyone) Emp/#0fc366~HyPeX~ successfully logged in as 'hypex' (IP: 181.31.38.23 Serial: F27CCCFAB293B848763C115C76C09442) [2015-01-11 00:12:17] restart: Requested by Emp/#0fc366~HyPeX~(hypex) [2015-01-11 00:12:17] Stopping race [2015-01-11 00:12:17] INFO: Resource stopping [2015-01-11 00:12:17] Stopping killmessages [2015-01-11 00:12:17] Stopping [DM]SazukEv6 [2015-01-11 00:12:17] Starting race [2015-01-11 00:12:17] Starting killmessages [2015-01-11 00:12:17] INFO: Race resource starting [2015-01-11 00:12:17] INFO: Race onGamemodeStart [2015-01-11 00:12:17] Gamemode 'Race' started. [2015-01-11 00:12:17] race restarted successfully [2015-01-11 00:12:17] Starting [DM]SazukEv6 [2015-01-11 00:12:17] INFO: onGamemodeMapStart([DM]SazukEv6) [2015-01-11 00:12:18] Map '[DM]SazukE# v6^ Deep in the Dark' started. [2015-01-11 00:12:18] startResource: Resource '[DM]SazukEv6' started [2015-01-11 00:12:18] INFO: Loaded race mode Destruction derby [2015-01-11 00:12:23] SCRIPT: Emp/#0fc366~HyPeX~(hypex) set his script debug mode to 3 [2015-01-11 00:12:33] restart: Requested by Emp/#0fc366~HyPeX~(hypex) [2015-01-11 00:12:33] Stopping race [2015-01-11 00:12:33] INFO: Resource stopping [2015-01-11 00:12:33] Stopping killmessages [2015-01-11 00:12:33] Stopping [DM]SazukEv6 [2015-01-11 00:12:33] Starting race [2015-01-11 00:12:33] Starting killmessages [2015-01-11 00:12:33] INFO: Race resource starting [2015-01-11 00:12:33] INFO: Race onGamemodeStart [2015-01-11 00:12:33] Gamemode 'Race' started. [2015-01-11 00:12:33] race restarted successfully [2015-01-11 00:12:33] Starting [DM]PeiN-Ft-Micra_-_Lethal_Weapon [2015-01-11 00:12:34] INFO: onGamemodeMapStart([DM]PeiN-Ft-Micra_-_Lethal_Weapon) [2015-01-11 00:12:35] Map '[DM] PeiN ft. Micra - Lethal Weapon' started. [2015-01-11 00:12:35] startResource: Resource '[DM]PeiN-Ft-Micra_-_Lethal_Weapon' started [2015-01-11 00:12:35] INFO: Loaded race mode Destruction derby [2015-01-11 00:12:41] start: Requested by Emp/#0fc366~HyPeX~(hypex) [2015-01-11 00:12:41] Starting Login [2015-01-11 00:12:43] LOGOUT: Emp/#0fc366~HyPeX~ logged out as 'hypex' [2015-01-11 00:12:48] LOGIN: (CW, Admin, Everyone) Emp/#0fc366~HyPeX~ successfully logged in as 'hypex' (IP: 181.31.38.23 Serial: F27CCCFAB293B848763C115C76C09442) [2015-01-11 00:12:48] ERROR: [EMP]/[race]/race/modes/base.lua:368: bad argument #2 to 'random' (interval is empty) [2015-01-11 00:12:48] WARNING: [EMP]/[race]/race/race_server.lua:1286: Bad argument @ 'getPedOccupiedVehicle' [Expected ped at argument 1, got resource] -- BIG SPAM OF THIS ERROR -- [2015-01-11 00:13:41] stop: Requested by Emp/#0fc366~HyPeX~(hypex) [2015-01-11 00:13:41] Stopping race [2015-01-11 00:13:41] INFO: Resource stopping [2015-01-11 00:13:41] Stopping killmessages [2015-01-11 00:13:41] Stopping [DM]PeiN-Ft-Micra_-_Lethal_Weapon [2015-01-11 00:13:44] start: Requested by Emp/#0fc366~HyPeX~(hypex) [2015-01-11 00:13:44] Starting race [2015-01-11 00:13:44] Starting killmessages [2015-01-11 00:13:44] INFO: Race resource starting [2015-01-11 00:13:44] INFO: Race onGamemodeStart [2015-01-11 00:13:44] Gamemode 'Race' started. [2015-01-11 00:13:45] Starting KiwiVol7 [2015-01-11 00:13:45] INFO: onGamemodeMapStart(KiwiVol7) [2015-01-11 00:13:45] Map '[DM] Kiwi Vol.7 - Perception' started. [2015-01-11 00:13:46] startResource: Resource 'KiwiVol7' started [2015-01-11 00:13:46] INFO: Loaded race mode Destruction derby [2015-01-11 00:14:11] Stopping KiwiVol7 [2015-01-11 00:14:12] Starting DM-Skaarj-Vol11-Falling-Feathers [2015-01-11 00:14:13] INFO: onGamemodeMapStart(DM-Skaarj-Vol11-Falling-Feathers) [2015-01-11 00:14:14] Map '[DM] Skaarj vol.11 - Falling Feathers' started. [2015-01-11 00:14:14] startResource: Resource 'DM-Skaarj-Vol11-Falling-Feathers' started [2015-01-11 00:14:15] INFO: Loaded race mode Destruction derby [2015-01-11 00:15:07] QUIT: Emp/#0fc366~HyPeX~ left the game [Quit] [2015-01-11 00:15:07] INFO: Stopping map [2015-01-11 00:15:42] CONNECT: Emp/#0fc366~HyPeX~ connected (IP: 181.31.38.23 Serial: F27CCCFAB293B848763C115C76C09442 Version: 1.4.0-9.06985.0) [2015-01-11 00:15:47] JOIN: Emp/#0fc366~HyPeX~ joined the game (IP: 181.31.38.23) [2015-01-11 00:15:47] WARNING: joinquit/infobox_s.lua:225: Bad argument @ 'setElementData' [Expected bool at argument 4, got string 'AR'] [2015-01-11 00:16:01] LOGIN: (CW, Admin, Everyone) Emp/#0fc366~HyPeX~ successfully logged in as 'hypex' (IP: 181.31.38.23 Serial: F27CCCFAB293B848763C115C76C09442) [2015-01-11 00:16:03] INFO: No map loaded; showing votemanager [2015-01-11 00:16:08] Stopping DM-Skaarj-Vol11-Falling-Feathers [2015-01-11 00:16:09] Starting [DM]CooLftCosa_Nostra-New-Island [2015-01-11 00:16:10] INFO: onGamemodeMapStart([DM]CooLftCosa_Nostra-New-Island) [2015-01-11 00:16:10] Map '[DM] CooL ft. Cosa_Nostra - New Island' started. [2015-01-11 00:16:10] startResource: Resource '[DM]CooLftCosa_Nostra-New-Island' started [2015-01-11 00:16:11] INFO: Loaded race mode Destruction derby [2015-01-11 00:16:11] SCRIPT: Emp/#0fc366~HyPeX~(hypex) set his script debug mode to 3 [2015-01-11 00:16:19] restart: Requested by Emp/#0fc366~HyPeX~(hypex) [2015-01-11 00:16:19] Stopping race [2015-01-11 00:16:19] INFO: Resource stopping [2015-01-11 00:16:19] Stopping killmessages [2015-01-11 00:16:20] Stopping [DM]CooLftCosa_Nostra-New-Island [2015-01-11 00:16:20] Starting race [2015-01-11 00:16:20] Starting killmessages Line 1286 from server: (line 18 here) TimerManager.createTimerFor("raceresource","warppeds"):setTimer( function () -- Make sure all players are in a vehicle local maxCheck = 6 -- Max number to check per call local maxWarp = 3 -- Max number to warp per call local warped = 0 for checked = 0, #g_Players - 1 do if checked >= maxCheck or warped >= maxWarp then break end g_checkPedIndex = g_checkPedIndex + 1 if g_checkPedIndex > #g_Players then g_checkPedIndex = 1 end local player = g_Players[g_checkPedIndex] if not getPedOccupiedVehicle(player) then local vehicle = g_Vehicles[player] if vehicle and isElement(vehicle) and not isPlayerRaceDead(player) then outputDebugString( "Warping player into vehicle for " .. tostring(getPlayerName(player)) ) warpPedIntoVehicle( player, vehicle ) warped = warped + 1 end end end end, 50,0 ) Line 368 from Base: (Line 6 here) local g_DoubleUpPos = 0 function RaceMode:pickFreeSpawnpoint(ignore) -- Use the spawnpoints from #1 to #numplayers as a pool to use local numToScan = math.min(getPlayerCount(), #g_Spawnpoints) -- Starting at a random place in the pool... local scanPos = math.random(1,numToScan) -- ...loop through looking for a free spot for i=1,numToScan do local idx = (i + scanPos) % numToScan + 1 if hasSpaceAroundSpawnpoint(ignore,g_Spawnpoints[idx], 1) then return g_Spawnpoints[idx] end end -- If one can't be found, find the spot which has the most space local bestSpace = 0 local bestMatch = 1 for i=1,numToScan do local idx = (i + scanPos) % numToScan + 1 local space = getSpaceAroundSpawnpoint(ignore,g_Spawnpoints[idx]) if space > bestSpace then bestSpace = space bestMatch = idx end end -- If bestSpace is too small, assume all spawnpoints are taken, and start to double up if bestSpace < 0.1 then g_DoubleUpPos = ( g_DoubleUpPos + 1 ) % #g_Spawnpoints bestMatch = g_DoubleUpPos + 1 end return g_Spawnpoints[bestMatch] end When i tried with a friend (Made the race restart and work with me already in) when he logged in, he was still as "Joined". Link to comment
.:HyPeX:. Posted January 15, 2015 Author Share Posted January 15, 2015 File: _joiner_client.lua (Line 143) triggerServerEvent('onLoadedAtClient', resourceRoot, g_Me ) Add a '--' before the function. When the player is ready (after your stuff) you can trigger the event. triggerServerEvent('onLoadedAtClient', getResourceRootElement(getResourceFromName("race")), localPlayer ) Found my issue... -- Race_joiner triggerServerEvent('onLoadedAtClient', g_Me) -- My login triggerServerEvent('onLoadedAtClient', getResourceRootElement(getResourceFromName("race")), localPlayer ) Changed it to this and worked triggerServerEvent('onLoadedAtClient', localPlayer, localPlayer ) 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