Renkon
Members-
Posts
876 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Renkon
-
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)
-
LoadString loads in the same way, BUT... ¿If you stop the resource, how do you unload the loadstring?
-
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.
-
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 )
-
What was the problem?
-
Then.. show us: getRandomMapCompatibleWithGamemode() But I don't know then, if that didn't work, let's try modifying that function
-
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
-
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.
-
addEventHandler('onClientGUIClick', button, function (b) if b == "left" then setElementPosition ( localPlayer, 1679.3029785156, 1446.3712158203, 11.043098449707 ) end end )
-
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
-
Yeah, it's not wrong that it freezes after the countdown, but still, any bugs in debugscript?
-
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
-
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
-
if g_GameOptions.randommaps then startRandomMap() else search for startRandoMMap (function is in that same resource)
-
Show us startRandomMap()
-
WHAT THE FAP? Is the account registered already?
-
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.
-
No tenés sentido común si te vas por eso campeón...
-
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 )
-
outputChatBox arguments for client are: "text", r, g, b You are using serverside-alike arguments: "text", receiver, r, g, b
-
I am not sure but, doesn't executeCommandHandler require to have the resource as Admin in ACL?
-
A map with no deco is not a good map brah, it's like going backwards
-
https://wiki.multitheftauto.com/wiki/CallServerFunction
-
Until the problem is fixed, use it client-side, since it will work.
