Leaderboard
Popular Content
Showing content with the highest reputation on 14/10/21 in all areas
-
1 point
-
ok my mistake try this code local DELAY_TELEPORT = 5000 -- millisecond delay local IntervalTeleport = 0 local hitsCount = 0 local teleportX, teleportY, teleportZ = 106.99030, 1924.18860, 18.52914 local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255) addEventHandler("onMarkerHit", teleportMarker, function(hitElement) if(getElementType(hitElement) == "player") then if(hitsCount < 5) then setElementPosition(hitElement, teleportX, teleportY, teleportZ) hitsCount = hitsCount + 1 if(hitsCount == 5) then IntervalTeleport = getTickCount() end else if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second setElementPosition(hitElement, teleportX, teleportY, teleportZ) IntervalTeleport = getTickCount() else outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false) end end end end )1 point
-
Welcome to the forums @макс4 MTA bans can be appealed in the Global Bans subforum by creating a new thread. I'm closing this thread to prevent any gravebumps.1 point
-
No lugar de setElementFrozen(targetPlayer, true) coloque setElementFrozen(targetPlayer, not isElementFrozen(targetPlayer)) Obs: pode ter ficado meio bagunçado pq opção <code> do fórum não está funcionando pra mim1 point
-
Olá! Você está armazenando o jogador-alvo na variável targetPlayer, então use-a. setElementFrozen(targetPlayer, true) local playerVehicle = getPedOccupiedVehicle(targetPlayer)1 point
-
----THIS HAS BEEN RELEASED! CHECK PAGE 12!!---- And his lame pictures™ Short answer: its continuation of original vice city map done by Rockstar games which works on san andreas engine. Whole map concept is to do a stable VC Map including more objects. As an official idea i will be adding GTA V things such as: Radar , Skins , Weapons , Vehicles (but with custom liveries/textures like VCPD Cruiser) etc. Some GTA IV Vehicles or Skins are there too (For example Police Merit or Lycan Bike , its just to add better atmosphere and make it more realistic.) Note: More Screens availible in Other posts1 point
-
MTA-Communication-Enhancement This is an enhancement 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 enhancement. Which means it is just an layer on top of the basic functionalities of MTA. And most enhancements 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 -- https://wiki.multitheftauto.com/wiki/GetPlayerFromPartialName -- -- --------------------------------------- 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 here1 point
-
1 point
-
N++ is highly customizable, you can add your own languages with syntax highlighting and auto completion. I had some free time last night so I decided to make it. I wrote a script that retrieves a list of all the available functions then exclude the deprecated ones, then made the language file with those functions. I also made a script to retrieve all the functions, get their wiki page content (fetchRemote) and extract the function signature from the page, then parse it into the MTA-Lua.xml file which adds auto completion. I might release the scripts later. I've created a repo for it on GitHub, it has 2 files for the users: mtalua-lang-import.xml > The file to import in the user defined language page to get the syntax highlighting MTA-Lua.xml > The auto completion file The repo contains the resource used to generate the function list and the node app used to retrieve the functions' syntax from the wiki. Repo: https://github.com/JR10/mta-npp THIS IS WHAT YOU WANT: Download the user files (MTA-Lua.xml and mtalua-lang-import.xml): https://github.com/JR10/mta-npp/release ... ta-npp.zip Steps: 1. Open Notepad++ > Language > Define your language... 2. Import > Select mtalua-lang-import.xml (Make sure from now on that the MTA-Lua language is always selected for Lua files) 3. Copy MTA-Lua.xml to your Notepad++ directory "Notepad++/plugins/APIs" (Usually in C:/Program Files) For questions, bug reports, suggestions or anything, just post here. Download: https://github.com/JR10/mta-npp/archive/master.zip1 point
-
Download MTA SE from here: https://mega.nz/#!Aw4wjAxL!75tSMz1CTenosiKBXi2ka9NTMvKDpkecAa3WyHobgl81 point
-
1 point
-
What you are requesting is known as synchronization, when a client executes a client-side function and you want to share that state across every other player, you must notify the server of the action so that it can tell all players of the change too. This can be achieved with events using triggerServerEvent and triggerClientEvent. For instance, the example below displays how a client executing /trunk will run the function setVehicleDoorState and then share it across to to the server which in turn makes it visible for all other players. Client addCommandHandler("trunk", function() local theVehicle = getPedOccupiedVehicle(localPlayer) if not theVehicle then -- If the player is not in a vehicle. outputChatBox("You must be in a vehicle to toggle the trunk!", 255, 0, 0) return end local newState = (getVehicleDoorState(theVehicle, 1) == 0) and 1 or 0 -- If the trunk is closed, set it to 1 (open) otherwise it must be open, so close it. (state 1) setVehicleDoorState(theVehicle, 1, newState) -- Set the trunk state for this client. triggerServerEvent("syncVehicleTrunkChange", theVehicle, newState) -- Notify the server to set the newState for every player. end) -- This function is called whenever another player toggles a vehicle trunk, it executes the function on this client to update the trunk state -- to the same as what the source player set it to. function updateDoorStateFromOtherPlayer(newState) setVehicleDoorState(source, 1, newState) end addEvent("updateVehicleDoorState", true) addEventHandler("updateVehicleDoorState", root, updateDoorStateFromOtherPlayer) Server function handleVehicleDoorSync(newState) for i, thePlayer in ipairs(getElementsByType("player") do -- For every online player. triggerClientEvent(thePlayer, "updateVehicleDoorState", thePlayer, source, newState) -- Trigger the event to set the vehicle door state to the newState provided. end end addEvent("syncVehicleTrunkChange", true) addEventHandler("syncVehicleTrunkChange", root, handleVehicleDoorSync) Alternatively to save yourself this hassle, if the function is shared as such is the case with setVehicleDoorState, then you can just execute it on the server-side in which case it will automatically be synced to every client.0 points