Death Posted July 16, 2013 Share Posted July 16, 2013 My race gamemode is giving an error looks can help me fix code function RaceMode:onPlayerWasted(player) if not self.checkpointBackups[player] then return end TimerManager.destroyTimersFor("checkpointBackup",player) if RaceMode.getMapOption('respawn') == 'timelimit' and not RaceMode.isPlayerFinished(source) then -- See if its worth doing a respawn local respawnTime = RaceMode.getMapOption('respawntime') if self:getTimeRemaining() - respawnTime > 3000 then -------line 317 error Countdown.create(respawnTime/1000, restorePlayer, 'You will respawn in:', 255, 255, 255, 0.25, 2.5, true, self.id, player):start(player) end if RaceMode.getMapOption('respawntime') >= 5000 then TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end if g_MapOptions.respawn == 'none' then removeActivePlayer( player ) if getActivePlayerCount() < 1 and g_CurrentRaceMode.running then RaceMode.endMap() end end end Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 Write the codes at the line 317 Link to comment
Death Posted July 16, 2013 Author Share Posted July 16, 2013 if self:getTimeRemaining() - respawnTime > 3000 then -------line 317 error Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 if self:getTimeRemaining() = respawnTime > 3000 then -------replace that with this Link to comment
Death Posted July 16, 2013 Author Share Posted July 16, 2013 gave another error in gamemode ss race_server.lua g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) allowRPC('setElementPosition') g_MotorBikeIDs = table.create({ 448, 461, 462, 463, 468, 471, 521, 522, 523, 581, 586 }, true) g_ArmedVehicleIDs = table.create({ 425, 447, 520, 430, 464, 432 }, true) g_AircraftIDs = table.create({ 592, 577, 511, 548, 512, 593, 425, 520, 417, 487, 553, 488, 497, 563, 476, 447, 519, 460, 469, 513 }, true) g_RCVehicleIDs = table.create({ 441, 464, 465, 501, 564, 594 }, true) g_VehicleClothes = { [{ 490, 523, 598, 596, 597, 599}] = { [16] = false, [17] = 4 } } g_CurrentRaceMode = nil g_Spawnpoints = {} -- { i = { position={x, y, z}, rotation=rotation, vehicle=vehicleID, paintjob=paintjob, upgrades={...} } } g_Checkpoints = {} -- { i = { position={x, y, z}, size=size, color={r, g, b}, type=type, vehicle=vehicleID, paintjob=paintjob, upgrades={...} } } g_Objects = {} -- { i = { position={x, y, z}, rotation={x, y, z}, model=modelID } } g_Pickups = {} -- { i = { position={x, y, z}, type=type, vehicle=vehicleID, paintjob=paintjob, upgrades={...} } g_Players = {} -- { i = player } g_Vehicles = {} -- { player = vehicle } local unloadedPickups = {} addEventHandler('onPlayerJoin', g_Root, -- On player Join... function() outputConsole ( 'Race version ' .. getBuildString(), source, 255, 127, 0 ) for _,line in ipairs(Addons.report) do outputConsole ( 'Race addon: ' .. line, source ) end end ) addEventHandler('onGamemodeMapStart', g_Root, -- On gamemode map stars ... function(mapres) -- the map resource that we are talking about (mapres) outputDebugString('onGamemodeMapStart(' .. getResourceName(mapres) .. ')') if getTotalPlayerCount() == 0 then -- if theres no player... --playSound("audio/loadingmap.wav") --g_RaceStartCountdown:addClientHook(0, 'playSound','audio/countgo.wav', 44) outputDebugString('Stopping map') triggerEvent('onGamemodeMapStop', g_Root) -- just stop the map. return end gotoState('LoadingMap') -- set up all players as not ready for i,player in ipairs(getElementsByType('player')) do setPlayerNotReady(player) end -- tell clients new map is loading clientCall(g_Root, 'notifyLoadingMap', getResourceInfo(mapres, "name") or getResourceName(mapres), g_GameOptions.showauthorname and getResourceInfo( mapres , "author") ) -- send to clients information of new map that is loading. if g_CurrentRaceMode then -- If has somemap playing... outputDebugString('Unloading previous map') unloadAll() -- Unload all map stuff. end TimerManager.createTimerFor("raceresource","loadmap"):setTimer( doLoadMap, 50, 1 ,mapres ) end ) -- continue loading map after onGamemodeMapStart has completed function doLoadMap(mapres) if not loadMap(mapres) then -- if the mapresource dosent exists anymore... -- Select another map on load error problemChangingMap() return end g_CurrentRaceMode = RaceMode.getApplicableMode():create() g_MapInfo.modename = g_CurrentRaceMode:getName() outputDebugString('Loaded race mode ' .. g_MapInfo.modename) startRace() end -- Called from the admin panel when a setting is changed there addEvent ( "onSettingChange" ) addEventHandler('onSettingChange', g_ResRoot, -- if some map settings change... just update it for server and all clients. function(name, oldvalue, value, player) outputDebug( 'MISC', 'Setting changed: ' .. tostring(name) .. ' value:' .. tostring(value) .. ' value:' .. tostring(oldvalue).. ' by:' .. tostring(player and getPlayerName(player) or 'n/a') ) cacheGameOptions() if g_SavedMapSettings then cacheMapOptions(g_SavedMapSettings) clientCall(g_Root,'updateOptions', g_GameOptions, g_MapOptions) updateGhostmode() end end ) function cacheGameOptions() g_GameOptions = {} g_GameOptions.timeafterfirstfinish = getNumber('race.timeafterfirstfinish',30) * 1000 g_GameOptions.hurrytime = getNumber('race.hurrytime',15) * 1000 g_GameOptions.defaultrespawnmode = getString('race.respawnmode','none') g_GameOptions.defaultrespawntime = getNumber('race.respawntime',5) * 1000 g_GameOptions.defaultduration = getNumber('race.duration',6000) * 1000 g_GameOptions.ghostmode = getBool('race.ghostmode',false) g_GameOptions.ghostalpha = getBool('race.ghostalpha',false) g_GameOptions.randommaps = getBool('race.randommaps',false) g_GameOptions.statskey = getString('race.statskey','name') g_GameOptions.vehiclecolors = getString('race.vehiclecolors','file') g_GameOptions.skins = getString('race.skins','cj') g_GameOptions.autopimp = getBool('race.autopimp',true) g_GameOptions.vehicleweapons = getBool('race.vehicleweapons',true) g_GameOptions.firewater = getBool('race.firewater',false) g_GameOptions.classicchangez = getBool('race.classicchangez',false) g_GameOptions.admingroup = getString('race.admingroup','Admin') g_GameOptions.blurlevel = getNumber('race.blur',36) g_GameOptions.cloudsenable = getBool('race.clouds',true) g_GameOptions.joinspectating = getBool('race.joinspectating',true) g_GameOptions.stealthspectate = getBool('race.stealthspectate',true) g_GameOptions.countdowneffect = getBool('race.countdowneffect',true) g_GameOptions.showmapname = getBool('race.showmapname',true) g_GameOptions.hunterminigun = getBool('race.hunterminigun',true) g_GameOptions.securitylevel = getNumber('race.securitylevel',2) g_GameOptions.anyonecanspec = getBool('race.anyonecanspec',true) g_GameOptions.norsadminspectate = getBool('race.norsadminspectate',false) g_GameOptions.racerespawn = getBool('race.racerespawn',true) g_GameOptions.joinrandomvote = getBool('race.joinrandomvote',true) g_GameOptions.asyncloading = getBool('race.asyncloading',true) g_GameOptions.showauthorname = getBool('race.showauthorname',true) g_GameOptions.ghostmode_map_can_override = getBool('race.ghostmode_map_can_override',true) g_GameOptions.skins_map_can_override = getBool('race.skins_map_can_override',true) g_GameOptions.vehicleweapons_map_can_override = getBool('race.vehicleweapons_map_can_override',true) g_GameOptions.autopimp_map_can_override = getBool('race.autopimp_map_can_override',true) g_GameOptions.firewater_map_can_override = getBool('race.firewater_map_can_override',true) g_GameOptions.classicchangez_map_can_override = getBool('race.classicchangez_map_can_override',true) g_GameOptions.ghostmode_warning_if_map_override = getBool('race.ghostmode_warning_if_map_override',true) g_GameOptions.vehicleweapons_warning_if_map_override = getBool('race.vehicleweapons_warning_if_map_override',true) g_GameOptions.hunterminigun_map_can_override = getBool('race.hunterminigun_map_can_override',true) if g_GameOptions.statskey ~= 'name' and g_GameOptions.statskey ~= 'serial' then outputWarning( "statskey is not set to 'name' or 'serial'" ) g_GameOptions.statskey = 'name' end end function cacheMapOptions(map) g_MapOptions = {} g_MapOptions.duration = map.duration and tonumber(map.duration) > 0 and map.duration*1000 or g_GameOptions.defaultduration if g_MapOptions.duration > 86400000 then g_MapOptions.duration = 86400000 end g_MapOptions.respawn = map.respawn or g_GameOptions.defaultrespawnmode if g_MapOptions.respawn ~= 'timelimit' and g_MapOptions.respawn ~= 'none' then g_MapOptions.respawn = 'timelimit' end g_MapOptions.respawntime = g_MapOptions.respawn == 'tt' and (map.respawntime and map.respawntime*1000 or g_GameOptions.defaultrespawntime) g_MapOptions.time = map.time or '12:00' g_MapOptions.weather = map.weather or 0 g_MapOptions.skins = map.skins or 'cj' g_MapOptions.vehicleweapons = map.vehicleweapons == 'true' g_MapOptions.ghostmode = map.ghostmode == 'true' g_MapOptions.autopimp = map.autopimp == 'true' g_MapOptions.firewater = map.firewater == 'true' g_MapOptions.classicchangez = map.classicchangez == 'true' g_MapOptions.hunterminigun = map.hunterminigun == 'true' outputDebug("MISC", "duration = "..g_MapOptions.duration.." respawn = "..g_MapOptions.respawn.." respawntime = "..tostring(g_MapOptions.respawntime).." time = "..g_MapOptions.time.." weather = "..g_MapOptions.weather) if g_MapOptions.time then setTime(g_MapOptions.time:match('(%d+)%d+)')) end if g_MapOptions.weather then setWeather(g_MapOptions.weather) end -- Set ghostmode from g_GameOptions if not defined in the map, or map override not allowed if not map.ghostmode or not g_GameOptions.ghostmode_map_can_override then g_MapOptions.ghostmode = g_GameOptions.ghostmode elseif g_GameOptions.ghostmode_warning_if_map_override and g_MapOptions.ghostmode ~= g_GameOptions.ghostmode then if g_MapOptions.ghostmode then --outputChatBox( 'Not: Ghost Mode aktif degil' ) else --outputChatBox( 'Not: Ghost mode aktif edilmistir' ) end end -- Set skins from g_GameOptions if not defined in the map, or map override not allowed if not map.skins or not g_GameOptions.skins_map_can_override then g_MapOptions.skins = g_GameOptions.skins end -- Set vehicleweapons from g_GameOptions if not defined in the map, or map override not allowed if not map.vehicleweapons or not g_GameOptions.vehicleweapons_map_can_override then g_MapOptions.vehicleweapons = g_GameOptions.vehicleweapons elseif g_GameOptions.vehicleweapons_warning_if_map_override and g_MapOptions.vehicleweapons ~= g_GameOptions.vehicleweapons then if g_MapOptions.vehicleweapons then --outputChatBox( 'Notice: Silahlar Aktif' ) else --outputChatBox( 'Not: Silahlar kapali' ) end end -- Set autopimp from g_GameOptions if not defined in the map, or map override not allowed if not map.autopimp or not g_GameOptions.autopimp_map_can_override then g_MapOptions.autopimp = g_GameOptions.autopimp end -- Set firewater from g_GameOptions if not defined in the map, or map override not allowed if not map.firewater or not g_GameOptions.firewater_map_can_override then g_MapOptions.firewater = g_GameOptions.firewater end -- Set classicchangez from g_GameOptions if not defined in the map, or map override not allowed if not map.classicchangez or not g_GameOptions.classicchangez_map_can_override then g_MapOptions.classicchangez = g_GameOptions.classicchangez end -- Set hunterminigun from g_GameOptions if not defined in the map, or map override not allowed if not map.hunterminigun or not g_GameOptions.hunterminigun_map_can_override then g_MapOptions.hunterminigun = g_GameOptions.hunterminigun end end -- Called from: -- onGamemodeMapStart function loadMap(res) local map = RaceMap.load(res) if not map then outputDebugString( 'Error loading map ' .. tostring(getResourceName(res)) ) outputChatBox( 'Error loading map ' .. tostring(getResourceName(res)) ) return false end -- set options g_MapInfo = getMapInfo(res) g_MapInfo.name = map.info['name'] or 'unnamed' g_MapInfo.author = map.info['author'] g_MapInfo.resname = map.info['resname'] or getResourceName(res) g_SavedMapSettings = {} g_SavedMapSettings.duration = map.duration g_SavedMapSettings.respawn = map.respawn g_SavedMapSettings.respawntime = map.respawntime g_SavedMapSettings.time = map.time g_SavedMapSettings.weather = map.weather g_SavedMapSettings.skins = map.skins g_SavedMapSettings.vehicleweapons = map.vehicleweapons g_SavedMapSettings.ghostmode = map.ghostmode g_SavedMapSettings.autopimp = map.autopimp g_SavedMapSettings.firewater = map.firewater g_SavedMapSettings.classicchangez = map.classicchangez g_SavedMapSettings.firewater = map.firewater g_SavedMapSettings.hunterminigun = map.hunterminigun cacheMapOptions(g_SavedMapSettings) -- If no checkpoints and ghostmode no defined in the map, turn ghostmode off for this map if #map:getAll('checkpoint') == 0 and not map.ghostmode and g_MapOptions.ghostmode then g_MapOptions.ghostmode = Link to comment
Cadu12 Posted July 16, 2013 Share Posted July 16, 2013 iMr.3a[Z]eF, don't post when you don't have any idea to fix. Ontopic: Sorry, i don't know whats time default. if self:getTimeRemaining() - (respawnTime or 10000) > 3000 then Link to comment
Death Posted July 16, 2013 Author Share Posted July 16, 2013 gave error on line 318 also if self:getTimeRemaining() - (respawnTime or 10000) > 3000 then Countdown.create(respawnTime/1000, restorePlayer, 'You will respawn in:', 255, 255, 255, 0.25, 2.5, true, self.id, player):start(player)---------- error line =/ [2013-07-16 14:19:05] ERROR: [gamemodes]\[race]\race\modes\base.lua:318: attempt to perform arithmetic on local 'respawnTime' (a boolean value) Link to comment
Cadu12 Posted July 16, 2013 Share Posted July 16, 2013 Write full error, saying "error on line 318" is not useful. Edited: Ok you edited it, here is: function RaceMode:onPlayerWasted(player) if not self.checkpointBackups[player] then return end TimerManager.destroyTimersFor("checkpointBackup",player) if RaceMode.getMapOption('respawn') == 'timelimit' and not RaceMode.isPlayerFinished(source) then -- See if its worth doing a respawn local respawnTime = RaceMode.getMapOption('respawntime') or 10000 if (type(respawnTime) ~= "number") then respawnTime = 10000 end if self:getTimeRemaining() - respawnTime > 3000 then -------line 317 error Countdown.create(respawnTime/1000, restorePlayer, 'You will respawn in:', 255, 255, 255, 0.25, 2.5, true, self.id, player):start(player) end if RaceMode.getMapOption('respawntime') >= 5000 then TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end if g_MapOptions.respawn == 'none' then removeActivePlayer( player ) if getActivePlayerCount() < 1 and g_CurrentRaceMode.running then RaceMode.endMap() end end end 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