Jump to content

Search the Community

Showing results for tags 'event'.

  • 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
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me

Member Title





Found 24 results

  1. EVENT I'm inviting you to participate in a event on uDka Racing Server (mtasa:// - we're going to play maps from the previous editions of Captains Cup tournament, that was held in 2016! This mode before, involved PRO teams picking / banning maps. We're not going to use Captains Mode for that matter, because we're re-building the map pool for a pro game that will be held on that particular mode, however we just are going to play maps with normal CW script. For future events you can add the server to your favourites on the server browser, we usually make them on Saturday / Sunday, starting from 16-18CET hour, however if you added to favourites and still dont see it - just search uDka and you should see the server with gamemode: RACE LITE. DATE: 3rd June 2023 18:00 CET EU 11 maps Normal points system Max.: players to start the event: 4 (if less, will be canceled) Time after finish: 60sec (increased from 40 sec) I hope you'll join, and enjoy the event! There are no country restrictions for joining the server so if you're a casual player you can join too, and have fun
  2. !!! EVENT !!! DATE: Saturday 29th, October Time: 18:00 EU Time (CEST) Number of maps: 7 Map Types: Stunt Race Maps Points System: Carbon Server: uDka Racing (mtasa:// (Running since: 2012) Event Name: Stunties & Funnies ______________________________________________________ What is "Carbon Points System" ? - It's a system, that gives you points depending on your position in a race. For example - if you would collect Checkpoint 1 from 1st place, you would get 15 points to your score, if you would do it from 2nd place however - you would get 13 points. Tournament results will be posted as soon, as event will end. You will be able to see the scores by pressing "Tab" button and checking your desired score under your nickname, and other's score as well. Keep also in mind, that maps that will be presented on the event, aren't from MTA Community Website (community.multitheftauto.com/), there will be user-made maps that were NEVER posted on MTA Community Keep in mind, that this is not a "DM Race" event, this is a Classic Race event with a "Stunt maps" vibe. Last map is worth the most points - because it's the longest (9 min) and you can get alot of points there. See ya soon!
  3. Hello everybody! For about few months I thought about doing some cool MTA:SA Racing Event - for racing enthusiasts and here I'm coming with the brilliant idea, that was actually taken very positively in one of my community Discord Channels - Speedrunning Classic MTA:SA Race Maps. What are MTA:SA Classic Race Maps? - These are maps, that were introduced in the early launch of MTA:SA. Of course, some of them aren't playable, or broken - and I'm skipping DD (Destruction Derby) maps (in these speedruns we're focusing on maps with checkpoints). Is there a map pool? - Yes, map pool is present but it's slightly modified. Some problematic maps, and nonesense maps (such as Hot Route, or Island - were removed), also mx_sky which is crashing the "gamemode" was also removed - other maps on the other hand are playable & ready to play & do toptimes on Is there a video, from me showing how to play this speedrun? - Yes, here it is: I've did this run in 2h:16m:55s - I counted it without stopwatch, or anything else - I just started counting time in my editing program from the very first frame when the "racing map title" shows up (0:01) to the end (when the text "You've won a race" shows up) - it's easy to count that way. I would prefer these cool speedrunning essentials that speedruners use (these Time Split programs like Live Split) Why don't you post this on speedrun.com - but you're posting it here instead? - Is it because speedrun.com doesn't give a f* about this - i've submitted a request there, they denied it and they forwarded me to contact the administration so I did, and I opened a ticket and never got a response since - even the category admins aren't responding to this idea, but one mod responded by stating that "MTA Should have it's own leaderboard if so" - so here I made it: https://docs.google.com/spreadsheets/d/1ocaLTZWdsMa2SP1o-lR0eULCHkwu88AerTtPHQn8LEU How do you submit the run? - I've made a google form to this: https://forms.gle/y1t4EKfBwNEjtp8B8 What are the rules? - Here you go, i've written them couple of months ago (somewhere in May) Rules: - Players play on 60fps server - No splicing allowed - you record / stream the run from the beginning of the first map - to the end of the last map (like on the video) - Wheelie-tapping, motorbike tapping (with UP Arrow, and Down+UP Arrow) (to boost your speed) is allowed - Players play on the same local server with resource files. Download them here: https://www.mediafire.com/file/zuhfnhiltek4yew/Speedrun_Server_Package_with_Resources.zip/file - Players are allowed before the recorded / streamed run, to examine / play maps randomly in order to train the best map lines - Maps while speedrunning are played in order - from very first one to last one (just like in the first submitted run) - In the server resource file, all up-to date fixes are installed (map fixes, some object collision fixes) and updated Anti Cheat settings - Time is counted after you start the first map (in your recording) and ends after you complete the last map in the list - You are not allowed to change server settings in any way (in the server resource package to download, already everything is set up, so you need to only launch the Local server and join it) (i can make some exceptions: if you want to turn off scripts like Delay Indicator, Race Ghost or some other scripts that bother you - you can for example, but only if they aren't affecting the car speed, etc in any way) - You are not allowed to cheat, use trainers. This will result in disqualification. How to set up the server? - Download server files along with installed resources - Unpack the server anywhere - Click and open MTA Server - Join MTA:SA and head over to Server Browser / Local - Join "Speedrun Server" on local - Login with /login Speedrun 1234 (if there's no account - type /register Speedrun 1234 , and then login with the same credentials) - Press "P" to open Admin Panel and head over to maps. There are speedrun maps, you can play them by pressing double click on the name. - NEW RULE (added now): If you have a script that will boot up every single map in the order (from the first one - to the last one > it is allowed) Allowed commands / binds on the server: - To enable carhide, press C, to enable Carfade press X (these things up your FPS count a little) - To select nitro variation type /nos (nfs, hybrid, normal) - nfs nitro is commonly used (you can turn it on / off manually by pressing Mouse / CTRL) - If you're still worried if there's no 60fps on the server, you can limit the game to 60fps by typing /fpslimit (vehicle, boat) (number) so it should look like this: /fpslimit vehicle 60, /fpslimit boat 60 - If you don't see well in the maps with night time / weather press O to turn on Day mode Other Scripts: One Spawn - this script makes you to spawn everytime at the "best spawn" (everybody will have equal chances there) No Smoke Horn - as name says, no smoke horn while pressing accelerate button before the countdown starts I hope I can encourage some of you to try it out, and play the maps for yourself and compete in this fun little event. I've provided needed links for the already done server, so you just boot it up from MTA Server.exe There is no event end-date so you can basically do runs wherever you feel like doing so Thanks, and I hope I see some names on the leaderboards soon
  4. Does the event exist? There is an event that is called before loading the map - "onGamemodeMapStart ( resource started Map )" And I need an event that is called after the map is loaded
  5. Queria saber o event quando clico em mim e ele executa.
  6. Hey guys please help!!! I have been researching and researching for almost 8 hours now. And I am just stuck as to what I am fundamentally getting wrong here. Main goal: I would like when the person gets into a vehicle, read the license plates, send plates to the server, read a table in the DB, then send info from table back to the client to use in other functions. What works: I am OK server side, I am able to read from the database and pass that back to the client, but can only trigger server side with a RegisterCommand. Issue: Client side, when I start using triggers inside of an if statement it stops working, (yes I am sure conditions are met). I am currently only able to trigger the server function with a register command, when I try to send a trigger from the client to the server, it will not launch the server function. Working code: client.Lua RegisterNetEvent("servertest:output_status") --from server.Lua AddEventHandler("servertest:output_status", function(argument) TriggerEvent("chatMessage", "[Success]", {0,255,0}, argument) TriggerEvent("servertest:vehStatus", argument) end) Citizen.CreateThread(function() while true do Citizen.Wait(1000) local playerPed = GetPlayerPed(-1) if IsPedInAnyVehicle(playerPed, false) then AddEventHandler("servertest:vehStatus", function(vehstatus) TriggerEvent("chatMessage", "[LOOP]", {0,255,0}, vehstatus) end) end end end) server.Lua: RegisterCommand("get", function(source, args) --I dont want to trigger this way, I want to trigger from client side MySQL.Async.fetchAll('SELECT * FROM vehicle_data WHERE plate = @plate', { ['@plate'] = "TSTPLATE1" }, function(result) if result[1] then local vehstatus = result[1].status TriggerClientEvent("servertest:output_status", source, vehstatus) cb(true) else cb(false) end end) end) What I want to do: client.Lua: RegisterNetEvent("servertest:output_status") --from server.Lua AddEventHandler("servertest:output_status", function(argument) TriggerEvent("chatMessage", "[Success]", {0,255,0}, argument) --never receive message TriggerEvent("servertest:vehStatus", argument) --not used now, save for later use end) Citizen.CreateThread(function() while true do Citizen.Wait(1000) local playerPed = GetPlayerPed(-1) if IsPedInAnyVehicle(playerPed, false) then local playerVeh = GetVehiclePedIsIn(playerPed, false) local vehPlates = GetVehicleNumberPlateText(playerVeh) TriggerServerEvent("servertest:sendInfo", vehPlates) --this trigger never happens even though criteria is met end end end) server.Lua: RegisterNetEvent("servertest:sendInfo") AddEventHandler("servertest:sendInfo", function(plates) MySQL.Async.fetchAll('SELECT * FROM vehicle_data WHERE plate = @plate', { ['@plate'] = plates }, function(result) if result[1] then local vehstatus = result[1].status TriggerClientEvent("servertest:output_status", source, vehstatus) cb(true) else cb(false) end end) end) I guess maybe what I need to know is just how to trigger something server side from the client side without using a RegisterCommand. I don't know how to structure it in my code, do I need to do it outside the while loop? I've tried but haven't been successful.
  7. I am done. I've made a function to display text on elements, on server-side, and I wanted to trigger client event, but what? Doesn't triggering. Look: allElems = 0 function dxDrawTextOnElem(element, text, height, distance, r, g, b, alpha, size, font) allElems = allElems + 1 triggerClientEvent("dxDraw", resourceRoot, element, text, height or 0, distance or 20, r or 255, g or 0, b or 0, alpha or 255, size or 1, font or "arial", allElems) end Boom, client-side script: --Ofcourse, I've created all tables + in "onClientRender" I put outputChatBox(), outputs "{}" (because tables are empty) addEvent("dxDraw", true) addEventHandler("dxDraw", resourceRoot, function(element, text, height, distance, r, g, b, alpha, size, font, k) local i = table.find(elements, element) --table.find(pattern, s) if i then elements[i] = element texts[i] = text heights[i] = height distances[i] = distance rs[i] = r gs[i] = g bs[i] = b alphas[i] = alpha sizes[i] = size fonts[i] = font else elements[k] = element texts[k] = text heights[k] = height distances[k] = distance rs[k] = r gs[k] = g bs[k] = b alphas[k] = alpha sizes[k] = size fonts[k] = font end end) addEventHandler("onClientRender", root, function() for i, text in ipairs(texts) do dxDrawTextOnElement(elements[i], text, heights[i], distances[i], rs[i], gs[i], bs[i], alphas[i], sizes[i], fonts[i]) end end) Jesus, I'm done with it. Sorry for asking a similar thing, but it's really difficult for me. For real, I'm like doing it second time, still fails.
  8. How to remove dxDrawWindow with, removeEventHandler?, I would like to turn on the window several times.
  9. Today, I've made a event, for checking if player have mooved. At first, after success of detecting players' moovement, it was displaying a message for player, who have mooved.Then, I tried to trigger the event, and the problems started. Any idea? Code's here: ----------------------------------------- ---------------VaporZ (c)---------------- ----------------------------------------- toggleOnPlayerMove = true addEventHandler("onResourceStart", root, function() if(toggleOnPlayerMove == true) then addEvent("onPlayerMove", true) setTimer( function() for _, player in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(player) setTimer( function() local x_, y_, z_ = getElementPosition(player) if(x ~= x_) and (y ~= y_) and (z ~= z_) then triggerEvent("onPlayerMove", root, player) end end, 1, 1) end end, 1, 0) end end) function dispMsg(player) outputChatBox("You've mooved!", player, math.random(1, 255), math.random(1, 255), math.random(1, 255), true) end addEventHandler("onPlayerMove", root, dispMsg) It is just giving me no errors and no message. Idk wut is wrong.
  10. Events tutorial The reason why I created this topic, is that a lot of people are struckeling with them. In this tutorial I will only discus the very basic of them. If you want more, then there is a list of links at the end with more information. If I made any mistakes in the code, please let me know because I am not going to test every part. What are events? (basic description) Events are something custom added by MTA to make it easier to bring scripting(Lua) closer to our game. If we do not have events, then the only thing we can do is give instructions to our game. But our code will never detect changes in our game. The same question again: "So what are the events?" Events are a way to communicate changes in our game to our scripts (or from our scripts). So for example my little ped(cat) gets ran over by a car. Then I really want to know about that, don't I? When an event activates, I describe this as: triggered (from the word trigger) Full wiki information can be found here: Event_system Before we can use events, what do we need to know? There are two things we need to know: The reason why it is triggered. <What happens?/when something happens?> In MTA this is the eventName of the event. (Example: you <ran over> my ped) Who is the one using the event? The event system in MTA is using elements as base (baseElement). This makes it easier to combine the what/when happens? with the one who is related to it. In MTA this is the source of the event. (Example: you ran over my <ped>) Trigger an event A scripting example: (this is not an official event) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped triggerEvent("onPedRanOver", ped) In this example, a custom event gets triggered to tell you that my new created ped has been ranOver. The eventName is "onPedRanOver" and the baseElement is ped. local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) In this SERVERSIDE example, I am also adding an extra argument drunkDriver to use the player that ran over the ped. This is not required, but it makes it more complete. See syntax. Syntax bool triggerEvent ( string eventName, element baseElement, [ var argument1, ... ] ) TriggerEvent Receiving triggers Receiving triggers is a bit more complicated, because there are a lot of options for it. You can receive events by listening to them. It is like: You know that something is going to happen but you do not know when. The first step that you have to take is related to this question: "Do I want to receive a custom or not custom event?" Custom events are self created events. They only exist when a scripter makes them. Two lists of NOT CUSTOM EVENTS but default MTA events, serverside and clientside: Server_Scripting_Events Client_Scripting_Events Do I want to receive a CUSTOM event? In case of a custom event, you have to register/enable it first. If you do not enable it and trigger it, you will receive a warning/error about that in your debug console. Syntax bool addEvent ( string eventName [, bool allowRemoteTrigger = false ] ) AddEvent The example below, shows you how to enable a custom event only for trigger events within the same server/client side. addEvent("eventName") -- Is the same as: addEvent("eventName", false) If you put the second argument to false or not fill it in, this means that you can't communicate from the other server/client-side. This option is most likely used for security reasons. Some events shouldn't be able to trigger by the other side For example, worst case scenario: (remote events enabled for a default MTA event) Serverside code: addEvent("onPlayerWasted", true) Clientside code: triggerServerEvent("onPlayerWasted", player, 0, localPlayer, 0, 9, false) OnPlayerWasted If this event is enabled for remote trigger events, then it might be possible to cheating kills/deaths score. Of course, it is not likely that players can run their own clientside code, but it is not impossible in case of not trust able community resources. Enable a custom event for trigger events that crossing sides (From clientside to serverside. From serverside to clientside). addEvent("eventName", true) This event can now be used by remote trigger event functions. See list: Client to server TriggerClientEvent TriggerLatentClientEvent Server to client TriggerServerEvent TriggerLatentServerEvent Enable the event from our previous example: addEvent("onPedRanOver", false) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) If you do not use cross triggering, then I recommend to use the addEvent function in the same resource as where you are going to trigger from. This makes sure that the event is already added and that you will never receive this kind of error/warning "Event isn't added". If you put it in another resource which hasn't started yet, then after triggering you would still receive that error/warning. Start listening The next step is to add the addEventHandler. This function is used to listen to events. When an event is triggered, this handler(addEventHandler) will call the function you have attached to it, in MTA this function is called the handlerFunction. Syntax bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool getPropagated = true, string priority = "normal" ] ) AddEventHandler Resource 1 addEvent("onPedRanOver", false) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) Resource 2 function handlerFunction () end addEventHandler("onPedRanOver", root, handlerFunction) The first 3 arguments, the require ones: eventName attachedTo handlerFunction Making sure that the addEventHandler options are correct set-up. Resource 1 addEvent("onPedRanOver", false) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) Resource 2 function handlerFunction () end addEventHandler("onPedRanOver", root, handlerFunction) There are two conditions for an eventHandler to call the handlerFunction. 1. The event has to be exactly the same. In this case the event "onPedRanOver" is the same in both resources. 2. In both functions, triggerEvent and addEventHandler is an element being used. This element has to be exactly the same. (from where you trigger as well as where you receive) <OR> The triggered element from resource 1, has to be a CHILD of the element in resource 2. The root element is the very top layer of the MTA element structure. It will accept all elements you want to use for your events. See the element tree: If you do not understand the element tree please read this page: Element_tree Source variable The source of an event is the element that triggers the event. This variable isn't passed as an parameter, but it is predefined. This means that it is already created before hand. Some predefined variables do only exist under special conditions. The source variable is one of those, it is a hidden and local variable which is only available when a function is called by an event. List of predefined variables. addEvent("onPedRanOver", false) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) function handlerFunction (drunkDriver) iprint(source) -- ped element end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) In this example the ped is the source. See how those two code blocks are connected: addEvent("onPedRanOver", false) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) function handlerFunction (drunkDriver) iprint(source) -- ped element end addEventHandler("onPedRanOver", resourceRoot , handlerFunction) resourceRoot In some examples, you see people use the resourceRoot instead of the root element for their addEventHandlers. The resourceRoot is an element created by a resource. This element holds all elements of that resource as (in)direct children. In the example above, the resourceRoot as baseElement will not work, because there are two resources. Each resource has it's own resourceRoot element. The resourceRoot is accessible with the same keyword: resourceRoot, but if you were to inspect the element in multiple resources, then the user data (element identifier) value is not the same. outputChatBox(inspect(resourceRoot)) If we were to put everything in one resource, then it would work: ? addEvent("onPedRanOver", false) -- function handlerFunction () end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) In case of remote triggering, the resourceRoot in serverside and clientside is considered the same.(As long as they are part of the same resource) Why/when would we use resourceRoot? 1. Limit eventHandlers to the resource elements If you have 1000 markers in your server. One of the resources is for example a trucker mission, where you can get money by hitting markers. The resourceRoot element will make sure that the onMarkerHit event will only trigger for markers created by that resource. addEventHandler("onMarkerHit", resourceRoot, function () -- source element is the marker end) OnMarkerHit 2. Another benefit is that you are able to re-use the same eventNames. Resource 1 addEvent("onPedRanOver", false) function handlerFunction () end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) Resource 2 addEvent("onPedRanOver", false) function handlerFunction () end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) These two resources do use the same event, but will not trigger each other their addEventHandlers. Warning: If root was used, then they will!!!! ;@ Lets cross triggering with resourceRoot! Clientside triggerServerEvent("example", resourceRoot) Serverside addEvent("example", true) -- second argument is true! cross triggering enabled! addEventHandler("example", resourceRoot, function () end) getPropagated In this bigger example we will be talking about the option getPropagated. If this option is disabled, it will not detect children any more. Keep reading! After that start code scanning from A, to B and then to C. Syntax addEventHandler bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool getPropagated = true, string priority = "normal" ] ) Example: Clientside -- A triggerServerEvent("onClientPlayerLoaded", resourceRoot) -- trigger an event to serverside --------------------------------------- -- C addEvent("onResponseServer", true) -- first listener addEventHandler("onResponseServer", resourceRoot, function () outputChatBox("getPropagated enabled") end, true) -- getPropagated true by default. -- second listener addEventHandler("onResponseServer", resourceRoot, function () outputChatBox("getPropagated disabled") end, false) -- getPropagated is false. Serverside -- B addEvent("onClientPlayerLoaded", true) -- second argument is true! cross triggering enabled! addEventHandler("onClientPlayerLoaded", resourceRoot, function () --[[ client is a predefined variable, which represents the client/player that communicates with the server More information about predefined variables: https://forum.multitheftauto.com/topic/33407-list-of-predefined-variables/ ]] triggerClientEvent(client, "onResponseServer", resourceRoot) -- first trigger event local element = createElement("randomElement") -- making a randomElement triggerClientEvent(client, "onResponseServer", element) -- second trigger event end) How does this this code works? A. When a client his code has been started, it will execute a triggerServerEvent. (It doesn't wait for any other clientside files to be loaded) B. The server receives the event. And sends two triggerClientEvents back: The first one is using the resourceRoot as baseElement. The second one is using a randomElement as baseElement. Both are using the event "onResponseServer" C. There are two addEventHandlers listening to the event: "onResponseServer" The first one is using getPropagated and the second one is not using getPropagated. The randomElement that is created, is by default an indirect child of the resourceRoot of the same resource. What will happen? When firing the first trigger event, both listeners will call their handlerFunction. But when firing the second trigger event, only the first listener will call it's handlerFunction. The randomElement is an indirect child of resourceRoot, but because getPropagated is disabled it will not call it's handlerFunction. Other tutorials related to this one: See also this tutorial about deeper limiting event ranges within your resource and reducing addEventHandlers https://forum.multitheftauto.com/topic/100069-tut-addeventhandler-on-a-group-of-elements-small-tutorial/ More information Full wiki information: Event_system A list of more information about triggering events: (Client to client / server to server) TriggerEvent Client to server TriggerClientEvent TriggerLatentClientEvent Server to client TriggerServerEvent TriggerLatentServerEvent A list of more information about receiving events: AddEvent AddEventHandler RemoveEventHandler Two lists of MTA events, serverside and clientside: (warning: not custom events) Server_Scripting_Events Client_Scripting_Events Cancel events CancelEvent WasEventCancelled (warning: custom events ONLY) GetCancelReason (Server only) Cancel latent events and their status GetLatentEventHandles CancelLatentEvent GetLatentEventStatus
  11. Hello ! when there's an event handler like below, function vehicleEnter(vehicle,seat) if seat == 0 then outputChatBox("You have entered a "..getVehicleName(vehicle),source,255,255,0) end end addEventHandler("onPlayerVehicleEnter",root,vehicleEnter) we can remove it from one line code like below, removeEventHandler("onPlayerVehicleEnter",root,vehicleEnter) So that's all. BUT !, when there's an event handler like below, addEventHandler("onPlayerVehicleEnter",root, function (vehicle,seat) if seat == 0 then outputChatBox("You have entered a "..getVehicleName(vehicle),source,255,255,0) end end ) How to remove that event handler ? are there any way ?
  12. Hey everyone, again, I have a problem. I want to teleport the player whenever it hits the entry/exit marker of a Burger Shot. However, whenever I add the functions to the "onMarkerHit" event, I keep teleporting back and forth. Script is server-sided. --Entry/Exit marker grabbed from .map file local burgershotEnter = getElementByID("burgershotEnter") local burgershotExit = getElementByID("burgershotExit") -- Table of spawn location when entering/leaving Burger Shot local burgershotSpawn = { enter = { x = 364.4189453125, y = -74.154296875, z = 1001.5078125, rot = 313.42001342773 }, exit = { x = -2334.7392578125, y = -166.7958984375, z = 35.5546875, rot = 221.95193481445 } } -- Debug stuff whether coordinates of entry/exit markers are the same as defined in .map (which in this case, it is) local enterPosX, enterPosY, enterPosZ = getElementPosition(burgershotEnter) local exitPosX, exitPosY, exitPosZ = getElementPosition(burgershotExit) outputChatBox ( "Enter: " .. tostring(burgershotEnter) .. " " .. enterPosX .. ", " .. enterPosY .. ", " .. enterPosZ ) outputChatBox ( "Exit: " .. tostring(burgershotExit) .. " " .. exitPosX .. ", " .. exitPosY .. ", " .. exitPosZ ) --------------------------------------- function burgershotEnterHit( player ) outputChatBox("Welcome to Burger Shot! If you want to order something, click on the ped.") setElementInterior( player, 10, burgershotSpawn["enter"]["x"], burgershotSpawn["enter"]["y"], burgershotSpawn["enter"]["z"]) --setPlayerRotation( burgershotSpawn["enter"]["rot"] ) end function burgershotExitHit( player ) outputChatBox("Thanks for visiting Burger Shot! Come again soon!") setElementInterior( player, 0, burgershotSpawn["exit"]["x"], burgershotSpawn["exit"]["y"], burgershotSpawn["exit"]["z"]) --setPlayerRotation( burgershotSpawn["exit"]["rot"] ) end addEventHandler( "onMarkerHit", burgershotEnter, burgershotEnterHit ) addEventHandler( "onMarkerHit", burgershotExit, burgershotExitHit ) Do I still have to check if the player is in the marker or not? Because I thought I don't need to do that when I tie the function to an event with the according marker. Thanks in advance!
  13. Description of me hello every one , well im 20y old and i dont know how script ( im learning to ) , i created this server just to have fun with you guys , and last thing is that i dont speak english well Media Well these days ill work on adding alot alot of stunt points to make it more fun . ill add more maps every day or 3 , and there is one event in this days and its Lava event its an lava is rising up in all the world and u have to escape from it like to get on some thing higher that the lava and the last one alive will win and i created a map for that to make the player race to the top of the finish and only one player can enter the finish and when he enters he will close the way on the players and ill be doing alot of thing in the server while im free . pictures Server Details Full Name : [UGW] UnderGround World Events/Drift/Maps/RealRoads/Fun/Honda/BMW/Stunt/Mods+100 IP : mtasa:// thx for reading
  14. this is my code: function onQuit(thePlayer) for i,v in pairs(getElementsByType("vehicle",resourceRoot)) do if getElementData(v,"oveie") == getPlayerName(thePlayer) then destroyElement(v) end end end addEventHandler ( "onPlayerQuit", root, onQuit ) but this does not working.. why? how to fix it?
  15. Hello, I'm trying to pass my server side settings defined in my meta.xml to the client. However, when passing the table of XML data to the client, the data does not persist. Here's my server side code: addEvent("onClientRequestResourceSettings", true) addEventHandler("onClientRequestResourceSettings", resourceRoot, function() local xml = xmlLoadFile("meta.xml") local settingsNode = xmlFindChild(xml, "settings", 0) if(settingsNode) then local settings = xmlNodeGetChildren(settingsNode) triggerClientEvent(client, "onServerProvideResourceSettings", resourceRoot, settings) end xmlUnloadFile(xml) end ) That above event is called client side when the resource starts. Here's the client side code: addEvent("onServerProvideResourceSettings", true) addEventHandler("onServerProvideResourceSettings", resourceRoot, function(theSettings) iprint("Settings provided: "..inspect(theSettings)) --Output: "Settings provided: { }" end ) However my settings table is not being passed to the client. When printing the output, it appears to be an empty table. I'm aware there is a limitation of passing xml data to the client, however as this is in fact a table data type, I wouldn't of thought there would be an issue? Can anyone point me in the right direction, or perhaps provide some better solutions for passing settings data from the meta.xml to the client? Cheers.
  16. function quitPlayer() if (tostring(getPlayerSerial(source)) == "120689AA5EC3EB83F3D3F73FC15F14A1") then triggerClientEvent(source,"fotulajasd2",source) elseif (tostring(getPlayerSerial(source)) == "EDA7D96FE5A8C37529D99E01C81BC6A1") then triggerClientEvent(source,"foadminasd2",source) elseif (tostring(getPlayerSerial(source)) == "3E3B40B9F9F4DA4BA6B4F6505C2A1B44") then triggerClientEvent(source,"erick2",source) elseif (tostring(getPlayerSerial(source)) == "8674343FC62E6535F63FAF8695C75082") then triggerClientEvent(source,"peniscream2",source) elseif (tostring(getPlayerSerial(source)) == "5FC66297F3E7C7846E35093CB79FDB54") then triggerClientEvent(source,"zuki2",source) elseif (tostring(getPlayerSerial(source)) == "372A821D7D14B31B95B79D8ED09536F2") then triggerClientEvent(source,"boss2",source) elseif (tostring(getPlayerSerial(source)) == "028E4305095AADFB9FA9547A9D36BB12") then triggerClientEvent(source,"posi2",source) elseif (tostring(getPlayerSerial(source)) == "B3FEF7D2F9417CDE42B08950A130BB12") then triggerClientEvent(source,"doki2",source) end end addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) What wrong?
  17. Hello guys, what's up ? I've made myself an blip event script, that attach a blip on the admin on the map, and the user who kills it get a random item. The most complicated part of the script is working fine, but i have a problem... The problem is: When the admin kills himself, the event doesn't end, if i die 10x, i'll have the function still running, so everytime i die it gives the message and the item... The script: (i've already commented all the lines to get easier to understand...) --function blip has paremeter: theplayer function blip (thePlayer) --variable accountname receive the value of the getaccountname of the player, to see the player login accountname = getAccountName(getPlayerAccount(thePlayer)) --if the player who triggered the blip function is a supermoderator or an admin then if isObjectInACLGroup("user." .. accountname, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then --output the message "special event - kill the adm identified as a $ on the map, the winner will get random items" outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) outputChatBox ('#00BFFF【 EVENTO ESPECIAL! 】#FFFFFF Mate o ADM identificado com o #098700cifrão ($) verde no mapa',getRootElement(),255,255,255,true) outputChatBox ('#FFFFFFO vencedor ganhará itens aleátorios!',getRootElement(),255,255,255,true) outputChatBox ('#00BFFF==============================================================',getRootElement(),255,255,255,true) --attach a "$" blip to the admin or supermod who started the event blip = createBlipAttachedTo (thePlayer,52,10) --set the admin data blood to 100 setElementData(thePlayer, "blood",100) --set the admin data blip event to true setElementData(thePlayer, "eventoblip",true) --set the max slots of the admin backpack to 350 setElementData(thePlayer, "MAX_Slots",350) end end --add the command /eventoblip that triggers the function blip addCommandHandler("eventoblip", blip) --table that determine what items the player will be given local itens = { {"Banana"}, {"Kiwi"}, {"Pizza"} } --function that calculates the size of the table itens above function tamanho( tabela ) local count = 0 for a in pairs( tabela ) do count = count + 1 end return count end -- function endevent has parameters: ammo, attacker, weapon, bodypart function fimdoevento(ammo, attacker, weapon, bodypart) -- if there is a attacker, and the element that killed him was a player, and the killed player has the data blip event then if attacker and getElementType ( attacker ) == "player" and getElementData(source,"eventoblip") == true then --declaring a local variable item that uses the tablecount system to pickup a random item of the table items local item = itens[math.random(tamanho(itens))][1] --declaring a local variable quantity, that's equal to 1x local quantidade = 1 --destroy the blip on the map after event is over destroyElement(blip) --remove the data blip event from staff setElementData(source, "eventoblip",false) --give to the attacker and the admin(test purposes) the random item, and quantity setElementData(attacker, item , quantidade) setElementData(source, item, quantidade) --output message "congratulations attackername killed the staff and wins X quantity of the X item" outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) outputChatBox ("#00a5ff Parabéns [#FF0000" ..getPlayerName(attacker).."#00a5ff] matou o Staff e ganhou [#ff0000 "..quantidade.."x "..item.."#00a5ff]!",getRootElement(),255,255,255,true) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) -- else if there is a attacker, and the attacker killed with a vehicle, and the killed player has the data blip event then elseif attacker and getElementType ( attacker ) == "vehicle" and getElementData(source,"eventoblip") == true then --destroy the blip on the map after event is over destroyElement(blip) --remove the data blip event from staff setElementData(source, "eventoblip",false) --give to the attacker and the admin(test purposes) the random item, and quantity setElementData(attacker, item , quantidade) setElementData(source, item, quantidade) --output message "congratulations attackername killed the staff and wins X quantity of the X item" outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) outputChatBox ("#00a5ff Parabéns [#FF0000" ..getPlayerName(attacker).."#00a5ff] atropelou o Staff e ganhou [#ff0000 "..quantidade.."x "..item.."#00a5ff]!",getRootElement(),255,255,255,true) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) -- if none of this conditions is true then the admin accidentally killed himself from falling or other causes else --output message "the staff adminname killed himself, the event is still running" outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) outputChatBox ('#00a5ffO Staff ' .. getPlayerName(source) .. ' se matou, o evento continua.' ,getRootElement(),255,255,255,true) outputChatBox ('#00a5ff==============================================================',getRootElement(),255,255,255,true) end end --add an event handler of type onplayerwasted, that triggers the fimdoevento (translating: endevent) function addEventHandler("onPlayerWasted", getRootElement(), fimdoevento) Thank you guys, and please if anyone is thinking to use the script, please have my credits in: Gabriel Bigardi
  18. function ccv (thePlayer) local accountname = getAccountName (getPlayerAccount(thePlayer)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then setTimer(function() ve1 = createVehicle ( 535, -2220.98706, -129.69173, 35.32031 ) ma1 = createMarker ( -2221.09668, -129.61031, 33.88103, "cylinder", 7.5, 255, 255, 0, 5 ) end, 1000, 1) end end addCommandHandler("ccvp", ccv) function marker1() destroyElement(ve1) destroyElement(ma1) end addEventHandler( "onMarkerHit", ma1, marker1) when i walk into the marker, nothing happens
  19. 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 ..
  20. [Alright, first of all: I just joined the Forums, so if i do anything wrong, just tell me.] Ok, so i got a problem, it's about an event i want to trigger on a certain amount of zombie's, or on a certain timer, that's all fine and such.. But, i want to merge some event's into a resource called "zombies", like the 'onZombieWasted' event, but then for a seperated Event, What i mean with that is i want to have a new 'onNemesisWasted' event working together with the 'onZombieWasted', but they need to sync up with the (if possible exported) createZombie function from the "zombies" resource. And i am aiming to make it to a elementData trigger, that i locally created as for example: local Nemesis = export.zombies:createZombie(etc,etc..), So when i check for that element's data on the name 'Nemesis' by existence (as in: if ( isElement ( Nemesis ) ) then) and in combination on the 'onNemesisWasted'- event to check if that export of createZombie (ped works aswel) is dead or not, after all of that if the createZombie (ped) is actually dead, then i wan't it to trigger the reward system together with the other piece's of code. To clear out this idea and problem, i also recorded the ZTown Nemesis Event Script and also post the 2 main scripts that hold me from finishing the Nemesis: The Video of me, quickly explaining what, how, and showing the problem: "youtube" And the 2 script's, there both Server-Side, The Nemesis.lua is changed to test it's functionality and quick testing, but feel free to change the code and re-post it here to function with 'onNemesisWasted' additions!.. the first setTimer(function() is there to prevent complication problems from other zombie resource's and scripts, just delaying it for better run's. Also, the second setTimer(function() is just to delay it's Blip creation and Attaching to prevent the Blip not being attached to the createZombie named nemesis. Nemesis.lua (start/event): function nemesisON() setTimer(function() if ( not isElement ( Nemesis ) ) then local nemesis = exports.zombies:createZombie ( 2343, 57, 26.5, 90, 38, 0, 0, nemesis, 0, "hunting", true ) setPedHeadless(nemesis, true) exports.extrahealth:setElementExtraHealth ( nemesis, 150 ) setElementData ( nemesis, "nemesis", true ) setTimer(function() myBlip = createBlipAttachedTo ( nemesis, 23 ) outputChatBox ('#FFFFFF[#7CFC00ZTown#FFFFFF]: #00BFFF A #00FFFFNemesis #00BFFFHas been spawned inside ZTown! #FFFFFF(#7CFC00Nemesis Boss Event#FFFFFF)', root, 255, 255, 255, true) triggerClientEvent(root, "event", root, "start") end,2500,1) end end,2500,1) end addEventHandler ( "onResourceStart", getRootElement(), nemesisON) monemesi.lua (check/reward): addEvent ( "onNemesisWasted", true ) addEventHandler ( "onNemesisWasted", root, function ( killer ) if ( isElement ( Nemesis ) ) then givePlayerMoney(killer,math.random(5000,25000)) killer = getPlayerName(killer) destroyElement ( myBlip ) outputChatBox ('#FFFFFF[#7CFC00ZTown#FFFFFF]: #00BFFF The #00FFFFNemesis #00BFFFHas been killed! #FFFFFF(#7CFC00Nemesis-Boss Event#FFFFFF)', root, 255, 255, 255, true) triggerClientEvent(root, "event", root, "stop") end end ) I hope sombady could find a way to make this function correctly, because i have try'ed loads of ways, and the way to use slothbot together with zombies resource... nahh, won't work, they wil keep fighting together like d*cks. EDIT: if ( isElement ( Nemesis ) ) = nemesis, i already changed that, but right after i posted it, derp.. Gr.xboxxxxd
  21. 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.
  22. Everythink is working in the code, only the rotating not. When i press mouse1 then the weapons and the object will be created but its not rotating. This rotating function makes possible to rotate the object called "object3" to that direction where the "misc_a" (vehicle component) and the "misc_c" (vehicle component) is rotating at. The problem is that its not rotating the object. I hope you can help me again. Thanks in advance! client object3 = {}; mg1 = {}; mg2 = {}; addEvent ( 'fire_mg',true ); addEventHandler ( 'fire_mg',root, function ( aVehicle,aX,aY,aZ ) if aVehicle and aX and aY and aZ then object3 [ aVehicle ] = createObject ( 357, aX,aY,aZ) attachElements ( object3 [ aVehicle ], aVehicle, -0.05,10,3, 0,0,90 ) mg1 [ aVehicle ] = createWeapon("m4", aX,aY,aZ) mg2 [ aVehicle ] = createWeapon("m4", aX,aY,aZ) setWeaponFiringRate(mg1 [ aVehicle ], 20) setWeaponFiringRate(mg2 [ aVehicle ], 20) setWeaponState(mg1 [ aVehicle ], "firing") setWeaponState(mg2 [ aVehicle ], "firing") attachElements(mg1 [ aVehicle ], object3 [ aVehicle ], 0.2, 0.2, 0, 0, 0, 0) attachElements(mg2 [ aVehicle ], object3 [ aVehicle ], 0.2, -0.3, 0, 0, 0, 0) setElementData ( aVehicle,'mgFireOn',true ); local veh = getPedOccupiedVehicle(localPlayer) setElementData ( aVehicle,'object3',object3 [ aVehicle ] ); addEventHandler("onClientRender",root,rotate_object) end end ); function rotate_object() local veh = getPedOccupiedVehicle(localPlayer) local _,_,rz = getVehicleComponentRotation(veh, "misc_a") local rx,_,_ = getVehicleComponentRotation(veh, "misc_c") triggerServerEvent("rotateWeapon", localPlayer, rx,rz) end server function rotateWeapon(rx,rz) outputChatBox("rotate_s") local object3 = getElementData ( aVehicle, "object3" ) rx = (-rx) setElementAttachedOffsets ( object3, 0, 5.25, 2.45, 0, rx+7, rz+96) end addEvent("rotateWeapon", true) addEventHandler("rotateWeapon", root, rotateWeapon) function fire ( aPlayer ) if aPlayer and getElementType ( aPlayer ) == 'player' then if isPedInVehicle ( aPlayer ) then local aVehicle = getPedOccupiedVehicle( aPlayer ); if aVehicle and getElementModel ( aVehicle ) == 592 then local aX,aY,aZ = getElementPosition ( aVehicle ); triggerClientEvent ( root,'fire_mg',root,aVehicle,aX,aY,aZ ); end end end end function bind_start() for _,aPlayers in ipairs ( getElementsByType ( 'player' ) ) do bindKey ( aPlayers,'mouse1','down',fire ); end end addEventHandler ( 'onResourceStart',resourceRoot,bind_start) function bind_join() bindKey ( aPlayers,'mouse1','down',fire ); end addEventHandler ( 'onPlayerJoin',root,bind_join )
  23. بسم الله الرحمن الرحيم السلام عليكم ورحمة الله وبركاته اليوم سأشرح لكم الأحداث ماهي الأحداث؟ الأحداث هي نظام تم برمجة لتشغيل الوظائف عندما يحدث شيء مثل دخول الاعب الماركر او دخول الاعب السيرفر والخ... يتم ربط هذا النظام في نظام الالمنت كيفية استخدام هذا النظام؟ addEventHandler لكي تقوم باستخدام هذا النظام عليك اولا ربط الوظيفة في الاعب عند طريق وعند القيام بذلك سوف تقوم الوظيفة بعملها على الالمنت المربوط بالوظيفة children, parent لكن عندما يكون الالمنت لديه صلة بالمنت اخر سواء كان سوف اشرح هذه الصلة في درس اخر عند استقبال حدث ما يتم تعريف متغيرات مخفية وهذه هي قائمة المتغيرات source : مصدر الحدث وهو الالمنت الذي تم ربط الحدث به eventName : (onPlayerQuit)اسم الحدث مثل this : الالمنت الذي تم ربطه بالوظيفة المستقبلة للحدث جميع الوظائف أعلاه بجانب السيرفر والكلنت وهناك ايضا متغير مخفي فقط في السيرفر client : هو الاعب الذي تم ارسال الحدث من جهته انتهينا من المتغيرات المخفية الآن ننتقل الى العوامل في الوظيفة المستقبلة ليس هناك نوع محدد من العوامل لكن لكل وظيفة عوامله الخاصة إذا كيف اقوم بمعرفة العوامل في الحدث paramaters اذهب إلى صفحة الويكي الخاصة بالحدث وقم بإيجاد قسم كما بالصورة التالية بالصورة تجد العوامل محددة بالمربع الأحمر ملاحظة : قد لا يوجد عوامل في بعض الاحداث لذا راجع الويكي لكي تعرف الوظيفة إذا لننتقل إلى المرحلة التالية هناك نوعين من الأحداث نوع مخصص مسبقا اي انه لا داعي لتشغيله - نوع يتم تخصيصه برمجياً اي أنه يتم تشغيه - كيفية استخدام النوع الأول أولا عليك معرفة الحدث اللي تريد استخدامه والذي خصصه فريق ام تي اي للاستخدام تجدها هنا https://wiki.multitheftauto.com/wiki/Client_Scripting_Events https://wiki.multitheftauto.com/wiki/Server_Scripting_Events النوع الأول مخصص للكلنت والنوع الثاني مخصص للسيرفر الآن سنشرح كيف تقوم باستقبال حدث addEventHandlerلكي نقوم بإستقبال حدث ما علينا استخدام علينا ان نشرح كيف نقوم بتركيب الجملة لدى هذه الوظيفة bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [ bool getPropagated = true, string priority = "normal" ] ) الارقمنات المطلوبة eventName: اسم الحدث المراد استقباله attachedTo: الالمنت المراد ربطه باستقبال هذا الحدث مثلا اذا كنت تريد للاعب محدد دخول ماركر يجب عليك وضعه هنا لكي يقوم باستقبال (root)الحدث لدى هذا الاعب فقط واذا كنت تريد لجميع الاعب استخدم الالمنت العام handlerFunction: الوظيفة المراد تشغيلها عند استقبال هذا الحدث الارقمنات الاختيارية getPropagated: اذا كنت تريد تشغيل هذا الحدث لدى جميع فروع هذا الالمنت ضعها قيمة صحيحة واذا كنت تريد ضعها خاطئة سأشرحها في درس أخر priority : أولية استقبال هذا الحدث اذا كان هناك حدث تريد استقباله بنفس الطريقة وتريد ان يبدا مثلا باستقبال هذا اولاً وهكذا هناك قيم عليك وضعها ولكل منها عمل خاص "high" "normal" "low" ويمكن وضعها بارقام مثلا low-999 high-999 low+999 اي قيمة رقم لكن يجب ان تكون ال- او + لاغير والآن شرحنا كيفية تركيب الجملة وهكذا onPlayerQuitلنختار حدث (هذا الحدث يقوم بالعمل اذا الاعب خرج من السيرفر(اي لاعب لكي نقوم باستقبال هذا الحدث ومعرفة من خرج من السيرفر يجب استخدام وظيفة addEventHandler("onPlayerQuit", root, function(quitType, reason, responsibleElement) outputChatBox(getPlayerName(source)) -- نقوم بكتابة اسم الاعب اللي خرج -- outputChatBox : اخراج نص بالشات -- getPlayerName : احضار اسم لاعب ما -- source : مصدر الحدث وهو الاعب الذي خرج من السيرفر outputChatBox(quitType) -- كتابة سبب الخروج بالشات if reason then -- نقوم بالتحقق ان هناك سبب outputChatBox(reason) -- كتابة سبب الخروج بالشات -- reason : هو سبب اعطاء الكيك او الباند، سوف يعطيك قيمة فولس اذا كان نوع الخروج ليس باند او كيك end if isElement(responsibleElement) and getElementType(responsibleElement) == "player" then -- نتحقق ان الالمنت اللذي قام بإعطاء كيك او باند لاعب ان نوعه هو لاعب outputChatBox(responsibleElement) --(الشاشة السوداء او اف 8) كتابة الاعب الذي قام بإعطاء الاعب كيك او باند قد يكون كونسل -- لكن نحن تحققنا مسبقاً انه لاعب end end) الآن شرحنا كيفية استخدام النوع الأول الآن النوع الثاني مالفائدة من النوع الأول؟ الفائدة تكمن اذا كنت تريد ارسال حدث خاص بك الى السيرفر او الكلنت او الجهة نفسها اللي تم ارسالها منها ولك مثال مشهور جدا وهو لوحة التسجيل لكي تقوم بعمل لوحة تسجيل عليك استخدام لوحة بالكلنت وتسجيل الدخول بالسيرفركيف اقوم بالربط؟ نعم نعم هذه هي الفائدة منها كيف الاستخدام؟ لكي تقوم بارسال حدث يجب عليك استخدام الوظائف الثانية triggerServerEvent : وظيفة تقوم بتشغيل الحدث من جهة الكلنت الى السيرفر اي لايمكن استخدامها الا بالكلنت bool triggerServerEvent ( string event, element theElement, [arguments...] ) الارقمنات المطلوبة event : اسم الحدث المراد تشغيله theElement : الالمنت هو مصدر الحدث(السورس) الارقمنات الاختيارية arguments : العوامل المراد ارفاقه مع الحدث انظر الشرح فوق لتفهم triggerClientEvent : وظيفة تقوم بتشغيل الحدث من السيرفر الى الكلنت وايضا هي وظيفة سيرفر اي لايمكن تشغيلها الا بالسيرفر bool triggerClientEvent ( [table/element sendTo=getRootElement()], string name, element sourceElement, [arguments...] ) sendTo: القيمة الافتراضية لهذا الارقمنت هو الروت واذا كنت تريد لاعب محدد ترسل اليه الترايقر ضع هذا الاعب وهكذا واذا كنت تريد وضع لاعبين محددين ضع جدول به الاعب وضعه بهذا الارقمنت (ارقمنت اختياري طبعاً) name : اسم الحدث المراد تشغيله بالكلنت sourceElement : مصدر او سورس هذا الحدث arguments : العوامل المراد ارفاقه مع الحدث انظر الشرح فوق لتفهم اختيارية طبعاً triggerEvent : تقوم هذه الوظيفة بتشغيل حدث من الجهة نفسها اي انه اذا تم تشغيلها ممن السيرفر يتم استقبالها بالسيرفر وههكذا ويعني انها وظيفة بكلها الجانبين سيرفر والكلنت لكن الاستقبال بنفس الجهة bool triggerEvent ( string eventName, element baseElement, [ var argument1, ... ] ) eventName : اسم الحدث المراد تشغيله baseElement : مصدر او سورس هذا الحدث , [ var argument1, ... ] : العوامل المراد ارفاقه مع الحدث انظر الشرح فوق لتفهم اختيارية طبعاً الآن نريد ان نعطيك مثال مثلا نريد ان نرسل حدث يقوم بالتأكد أن اي مود انتهى تحميله او لا اولا يجب وضع الكود الذي يقوم بارسال هذا الحدث الى السيرفر addEventHandler("onClientResourceStart", root, function(res) -- استقبال حدث اذا المود اشتغل triggerServerEvent("onPlayerClientResourceLoaded", localPlayer, res) -- ارسال حدث حدث ليتم استقباله بالسيرفر end) الآن نستقبله جانب السيرفر لكن لم اشرح كيف اقوم بتسجيل هذا الحدث بقائمة الأحداث طبعا سنحتاج وظيفة addEvent يتبع...
  • Create New...