Search the Community

Showing results for tags 'clientside'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
  • Archive
  • Private Bugtracker

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me





Found 7 results

  1. Map loader This is a map loader, which can let specific players download a map of choice. Maps will be generated clientside and the resource is capable of loading extreme large maps. Loading the map will be done with a speed the pc can handle. The code execution time will be reduced to circa 10 ms. Which is the frame time of a player with 100 fps. So technically when you have 100 fps you still have 98/100 fps when this resource is loading a map. But this is based on running only this resource and based on predictions/knowledge. Which you can't trust... The .map files are unloaded afterwards reading them. But the resource will keep a buffer of the processed data until no more players are using that map. This will speed up the resource when it is used for multiply players. The resource can be managed with the following functions (serverside): loadMapForTarget() Require: element player/root, string mapName Returns: boolean success, string message unloadMapForTarget() Require: element player/root, string mapName Returns: boolean success, string message getPlayerDownloadProgress() Require: element player Returns: int percentages or boolean false Version 1.0.1 or higher getPlayerMapStatus() Require: element player, string mapName Returns: string status or boolean false Status list: string "DOWNLOADING" -- Player is downloading the map. string "LOADING" -- Player is generating/loading the map string "LOADED" -- Player has loaded the map. boolean false -- Player variable is invalid or the player hasn't started downloading this map. Events(serverside): "onPlayerLoadedMap" Source: element player Parameters: string mapName int loadTime "onPlayerUnloadedMap" Source: element player Arguments: string mapName Version 1.0.1 or higher "onPlayerCancelMapDownload" Source: element player Arguments: string mapName Events(clientside): "onClientPlayerLoadedMap" Source: element localPlayer Arguments: string mapName, int loadTime "onClientPlayerUnloadedMap" Source: element localPlayer Arguments: string mapName The same information about the functions and the events can be found inside the meta.xml Element types that are supported: objects, peds, vehicles, markers and pickups If you found any bugs, which might be in there. Don't be shy and let me know, I will exterminate them. And don't forget, this resource require some rights in order to read map files from other resources: DOWNLOAD 1.0.2 For developers a quick source code preview: Server Client
  2. MTA-Communication-Enchantment This is an enchantment that allows you to communicate between clientside and serverside a bit easier. If you know how to work with events, then you probably do not need this, but it has some nice features which allows you to sit back and write less code + achieve some nice results. Note: It is important to keep in mind that this is an enchantment. Which means it is just an layer on top of the basic functionalities of MTA. And most enchantments come with a cost, in this case that is bit of performance. I will keep the information of topic to the minimal, as I have written most of the information already on the repository. You can find the repository here. Examples Syntax Installation What can you do with it? Calling from clientside to serverside Client callServer("hello") Server function hello () outputChatBox("Hello client!") end Calling from serverside to clientside Server addCommandHandler("callclient", function (player) -- An addCommandHandler is needed, because the client hasn't loaded it's scripts yet. callClient(player, "hello") end, false, false) Client function hello () outputChatBox("Hello server!") end Ok, ok, that was boring. The next one this is a bit nicer! Hello are you there? Just Call-me-back... I miss(ed) you too Callback Client callServer( "callbackMe", "argument", function (argument) -- < This is the callback function outputChatBox(argument) end ) Server function callbackMe (argument) return argument .. " < I looked at it :)" end Callback + internal arguments Sometimes you have arguments that you simply can't send over. > functions Or arguments that shouldn't be send over. > LARGE quantities of database data Internal arguments can be used to pass information to a callback without exposing it to the other side(client/server). Client callServer( "callbackMe", -------------------------------- -- arguments that are send over "argument", -- -------------------------------- function (internalArgument, argument) -- < This is the callback function. outputChatBox(internalArgument) outputChatBox(argument) end, -------------------------------- -- arguments that are not send over "internalArgument" -- < internal argument -- -------------------------------- ) Server function callbackMe (argument) return argument .. " < I looked at it :D" end Ha! Serverside what is that? No need for complicated things! Communicate between clients without writing a single line of serverside. Magic! Note: There is serverside used behind the scenes, you just don't have to write it. Client function smile (player) outputChatBox((isElement(player) and getPlayerName(player) or "[unknown]") .. " has send you a: :)") local x, y, z = getElementPosition(localPlayer) setElementPosition(localPlayer, x, y, z + 100) end addRemoteClientAccessPoint(smile) -- < This function allows other clients to call this function. --------------------------------------- -- -- function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end -- Author: TAPL -- -- -- --------------------------------------- addCommandHandler("smile", function (cmd, playerName) local player = getPlayerFromPartialName(playerName) if player then outputChatBox("Sending smile!") callRemoteClient(player, "smile", player) else outputChatBox("Can't find player!") end end) Turtle, I will wait for you to catch up. So don't worry, you are still cute. Await functions When a player has joined the server, he or she doesn't have download + loaded his scripts yet. This means that you can't deliver your love letter yet and all your work will be for nothing. But what if you don't have to worry about that? You can just wait now! Server addEventHandler("onPlayerJoin", root, function () callClientAwait(source, "testCallClientAwait") end) Client function testCallClientAwait () outputChatBox("Yes this works!") end Security Worried about security issues? Remote calls for C++/MTA functions have been blocked. There is a whitelist feature included, if enabled your code can only remote-call whitelisted functions. (this is disabled by default) Read the docs for that. Here and here
  3. Clipper_

    Effect fix

    I got a problem with created effects. In normal dimension I created an effect that is attached to the player's vehicle. The problem is that players from other dimensions can see it too moving around. Any idea how I can restrict the effects only for dimension 0? local attachedEffects = {} function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end function attachEffect(effect, element, pos) attachedEffects[effect] = { effect = effect, element = element, pos = pos } addEventHandler("onClientElementDestroy", effect, function() attachedEffects[effect] = nil end) addEventHandler("onClientElementDestroy", element, function() attachedEffects[effect] = nil end) return true end addEventHandler("onClientPreRender", root, function() for fx, info in pairs(attachedEffects) do local x, y, z = getPositionFromElementOffset(info.element, info.pos.x, info.pos.y, info.pos.z) setElementPosition(fx, x, y, z) end end ) local fire = {} function createCustomEffect(player, vehicle, value) if value then local x, y, z = getElementPosition(vehicle) if not fire[player] then fire[player] = createEffect("fire_bike", x, y, z, 0, 0, 0, 0, true) attachEffect(fire[player], vehicle, Vector3(0, 0, 0)) setElementDimension(fire[player], 0) end else if fire[player] then attachedEffects[fire[player]] = nil destroyElement(fire[player]) fire[player] = nil end end end addEvent("triggerCustomEffect", true) addEventHandler("triggerCustomEffect", root, createCustomEffect) The event is triggered in server when a player enters a vehicle, motorcycle in this case. Attaching functions are taken from 'MTA Wiki > Suggested functions function onPlayerVehicleEnter(vehicle, seat, jacked) if getElementModel(vehicle) == 463 then if seat == 0 then triggerClientEvent("triggerCustomEffect", source, source, vehicle, false) end end end addEventHandler("onPlayerVehicleExit", root, onPlayerVehicleEnter)
  4. Hi I'm getting a error on debugscript each time I start the resource, could anyone explain to me the cause of this error ? Thanks for any help ..
  5. I saw a server that shows me custom hud on my screen such as pictures and texts, I opened my files and I saw that only the pictures of this server have downloaded without even a one clientside script, how they have done that? thanks for helpers
  6. Estou criando um script de eventos, nesse script o admin pode criar 1 evento de cada vez e os jogadores podem participar caso queiram. O que estou com dificuldade seria para eventos de corrida, pois como a maioria deve saber, os mapas de corrida simplesmente não funcionam se não estiver no gamemode race. Só que se eu alterar o gamemode do server, vai mudar para todo mundo, inclusive pra quem não está participando do evento. Eu gostaria de saber se é possível alterar o gamemode para somente alguns jogadores ou então algum jeito de ativar um mapa de corrida específico sem alterar o gamemode atual do servidor. O mapa é escolhido no script de evento pelo admin. Eu estava dando uma olhada no resource 'race' e vi que ele ativa uma série de outros resources junto, como por exemplo o votemanager dos mapas, placares, contagem regressiva, tempo de corrida, etc...No meu script a maioria deles não será necessário. No gamemode race, ele carrega outro mapa de corrida automaticamente após terminar a corrida atual, mas no meu script o evento deve terminar e os jogadores voltam para a posição que estavam antes de participar.
  7. Hello there, I could never figure out myself proper way to make markers bouncing like in vanilla gta sa. I have tried moveObject in clientside but doesn't seem to work well. Anyone having ideas, what functions I should use in order to create bouncing arrow marker?