Jump to content

Renkon

Members
  • Posts

    876
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Renkon

  1. triggerClientEvent has got some undefined number of arguments. First argument is/are the element/s that will take part on the event. Since blood will be added for everybody we set ROOT. Then, second argument, ofc the event. Third argument is the SOURCE of the event. Since it's not important here we just set ROOT. After that, you can pass arguments (x, y, z, etc) F/E if you wanted to trigger a Client Event for only ONE person, you can use as first argument getPlayerFromName(), just as an example. With my code, if you want to create a blood that will be seen for everybody, do serverside: fxAddForAllClientsBlood(x, y, z, dx, dy, dz, c, b)
  2. LoadString loads in the same way, BUT... ¿If you stop the resource, how do you unload the loadstring?
  3. function getRandomMapCompatibleWithGamemode( gamemode, oldestPercentage, minSpawnCount ) -- Get all relevant maps local compatibleMaps = exports.mapmanager:getMapsCompatibleWithGamemode( gamemode ) -- WE CLEAR THE ONES THAT DOESN'T HAVE [DDAS] for i, obj in ipairs (compatibleMaps) do if not string.find(getResourceName(obj), "[DDAS]") then compatibleMaps[i] = false end end if #compatibleMaps == 0 then outputDebugString( 'getRandomMapCompatibleWithGamemode: No maps.', 1 ) return false end -- Sort maps by time since played local sortList = {} for i,map in ipairs(compatibleMaps) do sortList[i] = {} sortList[i].map = map sortList[i].lastTimePlayed = getMapLastTimePlayed( map ) end table.sort( sortList, function(a, b) return a.lastTimePlayed > b.lastTimePlayed end ) -- Use the bottom n% of maps as the initial selection pool local cutoff = #sortList - math.floor( #sortList * oldestPercentage / 100 ) outputDebug( 'RANDMAP', 'getRandomMapCompatibleWithGamemode' ) outputDebug( 'RANDMAP', '' .. ' minSpawns:' .. tostring( minSpawnCount ) .. ' nummaps:' .. tostring( #sortList ) .. ' cutoff:' .. tostring( cutoff ) .. ' poolsize:' .. tostring( #sortList - cutoff + 1 ) ) math.randomseed( getTickCount() % 50000 ) local fallbackMap while #sortList > 0 do -- Get random item from range local idx = math.random( cutoff, #sortList ) local map = sortList[idx].map if not minSpawnCount or minSpawnCount <= getMapSpawnPointCount( map ) then outputDebug( 'RANDMAP', '' .. ' ++ using map:' .. tostring( getResourceName( map ) ) .. ' spawns:' .. tostring( getMapSpawnPointCount( map ) ) .. ' age:' .. tostring( getRealTimeSeconds() - getMapLastTimePlayed( map ) ) ) return map end My last try.
  4. Try this: -- Server function fxAddForAllClientsBlood(x, y, z, dx, dy, dz, c, b) if type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" or type(dx) ~= "number" or type(dy) ~= "number" or type(dz) ~= "number" then outputDebugString("Invalid arguments in fxAddForAllClientsBlood", 1) return end if not c then c = 1 end if not b then b = 1 end triggerClientEvent(root, "onServerRequest_fxAddBlood", root, x, y, z, dx, dy, dz, c, b) end -- Client addEvent("onServerRequest_fxAddBlood", true) addEventHandler("onServerRequest_fxAddBlood", root, function(x, y, z, dx, dy, dz, c, b) fxAddBlood(x, y, z, dx, dy, dz, c, b) end )
  5. Then.. show us: getRandomMapCompatibleWithGamemode() But I don't know then, if that didn't work, let's try modifying that function
  6. function getMap() local name = "Somebody" local map while not string.find(name, "[DDAS]") do map = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) name = getResourceName(map) end return map end function startRandomMap() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get a random map chosen from the 10% of least recently player maps, with enough spawn points for all the players (if required) local map = getMap() if map then g_IgnoreSpawnCountProblems = map -- Uber hack 4000 if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then problemChangingMap() end else outputWarning( 'startRandomMap failed' ) end end
  7. function getMap() local name = "Somebody" while not string.find(name, "[DDAS]") do local map = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) name = getResourceName(map) end return map end function startRandomMap() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get a random map chosen from the 10% of least recently player maps, with enough spawn points for all the players (if required) local map = getMap() if map then g_IgnoreSpawnCountProblems = map -- Uber hack 4000 if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then problemChangingMap() end else outputWarning( 'startRandomMap failed' ) end end May work.
  8. addEventHandler('onClientGUIClick', button, function (b) if b == "left" then setElementPosition ( localPlayer, 1679.3029785156, 1446.3712158203, 11.043098449707 ) end end )
  9. function AntiInfinite() startRandomMap() end function startRandomMap() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get a random map chosen from the 10% of least recently player maps, with enough spawn points for all the players (if required) local map = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) if map then g_IgnoreSpawnCountProblems = map -- Uber hack 4000 if not string.find(getResourceName(map), "[DDAS]") then AntiInfinite() return end if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then problemChangingMap() end else outputWarning( 'startRandomMap failed' ) end end
  10. Yeah, it's not wrong that it freezes after the countdown, but still, any bugs in debugscript?
  11. function startRandomMap() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get a random map chosen from the 10% of least recently player maps, with enough spawn points for all the players (if required) local map = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) if map then g_IgnoreSpawnCountProblems = map -- Uber hack 4000 if not string.find(getResourceName(map), "[DDAS]") then startRandomMap() return end if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then problemChangingMap() end else outputWarning( 'startRandomMap failed' ) end end
  12. Have you downloaded the server from some other place? Check internal.db database, and accounts table, and check if there are any accounts registered meanwhile. If you have downloaded it from somewhere, that cna happen
  13. if g_GameOptions.randommaps then startRandomMap() else search for startRandoMMap (function is in that same resource)
  14. WHAT THE FAP? Is the account registered already?
  15. You can edit the code of the resource and make when the poll starts that if [DDAS] appears on the name, then you show it.
  16. Renkon

    Me retiro.

    No tenés sentido común si te vas por eso campeón...
  17. Check functiona rguments for event onClientGUIClick First argument is the BUTTON. Obviously SOURCE is the GUI element that was clicked. You use localPlayer only and it's fine. function warp ( ) if source == WarpButton then setElementPosition ( localPlayer, 2040, 1478, 10.67 ) outputChatBox ( "You have been warped to the bank", 255, 0, 0 ) end end )
  18. outputChatBox arguments for client are: "text", r, g, b You are using serverside-alike arguments: "text", receiver, r, g, b
  19. I am not sure but, doesn't executeCommandHandler require to have the resource as Admin in ACL?
  20. A map with no deco is not a good map brah, it's like going backwards
  21. Renkon

    User Panel

    https://wiki.multitheftauto.com/wiki/CallServerFunction
  22. Until the problem is fixed, use it client-side, since it will work.
  23. Renkon

    SQL

    usa dbExec, más moderno dbExec(db,"CREATE TABLE IF NOT EXISTS players (columna1 VARCHAR(30), columna2 INT, columna3 CHAR(1))")
×
×
  • Create New...