Carlossg Posted December 8, 2011 Share Posted December 8, 2011 First,Hello I want to know how I need to do to race_ghost works in DM but I search on the script but I don't find how to do.Right my brain is burning because I have been half an hour looking. Thx Link to comment
Castillo Posted December 8, 2011 Share Posted December 8, 2011 https://community.multitheftauto.com/index.php?p= ... ils&id=665 That's for normal races, maybe you can edit it to be on DM too. Link to comment
Carlossg Posted December 8, 2011 Author Share Posted December 8, 2011 Yes I have it but I don't know how to edit Link to comment
Castillo Posted December 8, 2011 Share Posted December 8, 2011 Well, you better start learning how to, right? Link to comment
Carlossg Posted December 8, 2011 Author Share Posted December 8, 2011 Well, you better start learning how to, right? Ok ,well I KNOW how to edit... but I don't know what I need to add on script Link to comment
Cadu12 Posted December 8, 2011 Share Posted December 8, 2011 Edit in race_toptimes, add event (https://wiki.multitheftauto.com/wiki/TriggerEvent), and edit in race_ghost. Link to comment
Carlossg Posted December 8, 2011 Author Share Posted December 8, 2011 (edited) Delete, duplicate Edited December 8, 2011 by Guest Link to comment
Carlossg Posted December 8, 2011 Author Share Posted December 8, 2011 Now returns this error: ERROR: Race_ghost/record_client:149:attemp to compare nil whit number toptimes_server: -- -- toptimes_server.lua -- SToptimesManager = {} SToptimesManager.__index = SToptimesManager SToptimesManager.instances = {} --------------------------------------------------------------------------- -- Server -- Handle events from Race -- -- This is the 'interface' from Race -- --------------------------------------------------------------------------- addEvent('onMapStarting') addEventHandler('onMapStarting', g_Root, function(mapInfo, mapOptions, gameOptions) if g_SToptimesManager then g_SToptimesManager:setModeAndMap( mapInfo.modename, mapInfo.name, gameOptions.statsKey ) end end ) addEvent('onPlayerPickUpRacePickup') addEventHandler('onPlayerPickUpRacePickup', g_Root, function(number, sort, model) if sort == "vehiclechange" then if model == 425 then outputChatBox ( getPlayerName(source).. " #FF0000has got the Hunter", getRootElement(), 255, 255, 255, true ) if g_SToptimesManager then g_SToptimesManager:playerFinished( source, exports.race:getTimePassed()) end end end end ) addEvent('onPlayerFinish') addEventHandler('onPlayerFinish', g_Root, function(rank, time) if g_SToptimesManager then g_SToptimesManager:playerFinished( source, time) end end ) addEventHandler('onResourceStop', g_ResRoot, function() if g_SToptimesManager then g_SToptimesManager:unloadingMap() end end ) addEventHandler('onPlayerQuit', g_Root, function() if g_SToptimesManager then g_SToptimesManager:removePlayerFromUpdateList(source) g_SToptimesManager:unqueueUpdate(source) end end ) addEventHandler('onResourceStart', g_ResRoot, function() local raceInfo = getRaceInfo() if raceInfo and g_SToptimesManager then g_SToptimesManager:setModeAndMap( raceInfo.mapInfo.modename, raceInfo.mapInfo.name, raceInfo.gameOptions.statsKey ) end end ) function getRaceInfo() local raceResRoot = getResourceRootElement( getResourceFromName( "race" ) ) return raceResRoot and getElementData( raceResRoot, "info" ) end --------------------------------------------------------------------------- -- -- Events fired from here -- --------------------------------------------------------------------------- addEvent("onPlayerToptimeImprovement") --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- -- SToptimesManager:create() -- -- Create a SToptimesManager instance -- --------------------------------------------------------------------------- function SToptimesManager:create() local id = #SToptimesManager.instances + 1 SToptimesManager.instances[id] = setmetatable( { id = id, playersWhoWantUpdates = {}, updateQueue = {}, serviceQueueTimer = nil, displayTopCount = 12, -- Top number of times to display mapTimes = nil, -- SMaptimes:create() serverRevision = 0, -- To prevent redundant updating to clients }, self ) SToptimesManager.instances[id]:postCreate() return SToptimesManager.instances[id] end --------------------------------------------------------------------------- -- -- SToptimesManager:destroy() -- -- Destroy a SToptimesManager instance -- --------------------------------------------------------------------------- function SToptimesManager:destroy() SToptimesManager.instances[self.id] = nil self.id = 0 end --------------------------------------------------------------------------- -- -- SToptimesManager:postCreate() -- -- -- --------------------------------------------------------------------------- function SToptimesManager:postCreate() cacheSettings() self.displayTopCount = g_Settings.numtimes end --------------------------------------------------------------------------- -- -- SToptimesManager:setModeAndMap() -- -- Called when a new map has been loaded -- --------------------------------------------------------------------------- function SToptimesManager:setModeAndMap( raceModeName, mapName, statsKey ) outputDebug( 'TOPTIMES', 'SToptimesManager:setModeAndMap ' .. raceModeName .. '<>' .. mapName ) -- Reset updatings from the previous map self.playersWhoWantUpdates = {} self.updateQueue = {} if self.serviceQueueTimer then killTimer(self.serviceQueueTimer) end self.serviceQueueTimer = nil -- Remove old map times if self.mapTimes then self.mapTimes:flush() -- Ensure last stuff is saved self.mapTimes:destroy() end -- Get map times for this map self.mapTimes = SMaptimes:create( raceModeName, mapName, statsKey ) self.mapTimes:load() -- Get the toptimes data ready to send self:updateTopText() end --------------------------------------------------------------------------- -- -- SToptimesManager:unloadingMap() -- -- Called when unloading -- --------------------------------------------------------------------------- function SToptimesManager:unloadingMap() if self.mapTimes then self.mapTimes:flush() -- Ensure last stuff is saved end end --------------------------------------------------------------------------- -- -- SToptimesManager:playerFinished() -- -- If time is good enough, insert into database -- --------------------------------------------------------------------------- function SToptimesManager:playerFinished( player, newTime, dateRecorded ) -- Check if top time recording is disabled for this player if getElementData ( player, "toptimes" ) == "off" then return end if not self.mapTimes then outputDebug( 'TOPTIMES', 'SToptimesManager:playerFinished - self.mapTimes == nil' ) return end dateRecorded = dateRecorded or getRealDateTimeNowString() local oldTime = self.mapTimes:getTimeForPlayer( player ) -- Can be false if no previous time local newPos = self.mapTimes:getPositionForTime( newTime, dateRecorded ) -- See if time is an improvement for this player if not oldTime or newTime < oldTime then local oldPos = self.mapTimes:getIndexForPlayer( player ) triggerEvent("onPlayerToptimeImprovement", player, newPos, newTime, oldPos, oldTime, self.displayTopCount, self.mapTimes:getValidEntryCount() ) -- See if its in the top display if newPos <= self.displayTopCount then outputDebug( 'TOPTIMES', getPlayerName(player) .. ' got toptime position ' .. newPos ) end if oldTime then outputDebug( 'TOPTIMES', getPlayerName(player) .. ' new personal best ' .. newTime .. ' ' .. oldTime - newTime ) end self.mapTimes:setTimeForPlayer( player, newTime, dateRecorded ) -- updateTopText if database was changed if newPos <= self.displayTopCount then self:updateTopText() end end outputDebug( 'TOPTIMES', '++ SToptimesManager:playerFinished ' .. tostring(getPlayerName(player)) .. ' time:' .. tostring(newTime) ) triggerClientEvent( source, "onClientPlayerFinished", source) end --------------------------------------------------------------------------- -- -- SToptimesManager:updateTopText() -- -- Update the toptimes client data for the current map -- --------------------------------------------------------------------------- function SToptimesManager:updateTopText() if not self.mapTimes then return end Link to comment
TwiX! Posted December 9, 2011 Share Posted December 9, 2011 (edited) its eazy.. srry not public, do it from ur self or tell me in pm Edited December 10, 2011 by Guest Link to comment
Carlossg Posted December 10, 2011 Author Share Posted December 10, 2011 Oh, really work but works on last hunter If I get hunter on 6:05 and the best time is 4:01 you see the 6:05 ghost and I want to others wath rhe best top time 4:01 Link to comment
Al3grab Posted December 12, 2011 Share Posted December 12, 2011 you mean Ghost mode for death match ? : https://community.multitheftauto.com/index.php?p= ... ls&id=3028 Link to comment
Castillo Posted December 12, 2011 Share Posted December 12, 2011 No, if you would read the other replies instead of just advertise your resource, you would know what does he want. 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