Jump to content

The_GTA

Helpers
  • Posts

    822
  • Joined

  • Last visited

  • Days Won

    86

Everything posted by The_GTA

  1. Could you name the Antivirus please? This way users who face the same problem will know about it. MTA does not recommend disabling your antivirus. If you are facing such problems it is a good idea to look for an alternative. If you are using Windows 10 or higher then, based on my experience, the protection that is built into the OS itself is pretty good.
  2. Please take a look at the engineApplyShaderToWorldTexture wiki documentation. Are you properly setting the appendLayers parameter to true or leaving it out? It might help to support you if we had insight into your shaders themselves. They could be designed in a way that does not allow layering. Could you share them with us?
  3. Understandable. I am hoping for a modding API a'la plugin-sdk in the new GTA SA version. In some rumors there was talk of a comparison to high fidelity mods in the community. To not confuse the public I have, cautiously in advance, edited the Wiki page on how to buy GTA SA that the new game version on digital markets will not be compatible with MTA. This might of course change but it is unlikely to happen fast. I sure hope so! As vague as our participation in the upcoming game release is, as vague is also the modding capability of it. Due to the recent crossfire between GTA modding community and R* Games/Take-Two especially. But I am hoping for a more stable and capable engine that would not require those ugly assembly hacks anymore to get the game to multiplayer fruition.
  4. It looks like you forgot to adjust the second parameter to outputChatBox which should be the element to send the message to. Did you know that you can simply use the item variable? The reason is that it points to each eligible player exactly one time. If you pass the nearbyPlayers variable which is a list of players then it sends the message in the color 255, 255, 0 to the nearbyPlayers multiplied by (#nearbyPlayers - 1). Do this instead: -- This way the player who sent the message is guarranteed to always receive it independent of any math. outputChatBox ( getPlayerName(source).." says: "..message, source, 255, 255, 255, true ) -- Send to all other nearby players now. for key, item in pairs (nearbyPlayers) do if not (item == source) then outputChatBox ( getPlayerName(source).." says: "..message, item, 255, 255, 0, true ) end end Those small errors happen to the best of us. ?
  5. Maybe something like this? local is_mode_running = false; local kill_last_timer = false; addEventHandler("onGamemodeMapStart", root, function(startedMap) -- Clean up from previous runtime. if (kill_last_timer) then killTimer(kill_last_timer); kill_last_timer = false; end is_mode_running = true; outputChatBox("started mode!"); end ); local function on_mode_end() outputChatBox("end of mode!"); end local function on_last_survivor(survivor) kill_last_timer = setTimer( function() killPed( survivor ); kill_last_timer = false; end, 2000, 1 ); end addEventHandler("onPlayerWasted", root, function() local alivePlayers = getAlivePlayers(); if (is_mode_running) and (#alivePlayers <= 1) then is_mode_running = false; on_mode_end(); if (#alivePlayers == 1) then on_last_survivor(alivePlayers[1]); end end end );
  6. Hello Ice_Cool, do you know about for-loops in Lua? You can loop over all nearbyPlayers and send different colors for every item in nearbyPlayers if the item == source (the sender in onPlayerChat). There are two things that make no sense in your existing code, namely... if (source) == "nearbyPlayers" and not "senderName" then ... does always fail and... end ... is one end-token too many.
  7. Heard the news yet? Official news has broken out about Grand Theft Auto: The Trilogy – The Definitive Edition. Looks like Rockstar Games will begin removing GTA San Andreas classic from the digital stores. You will still be able to play but not purchase new copies anymore. Buy your digital GTA San Andreas copies while you still can! I did find some random news articles about this: Grant Theft Auto: The Trilogy announced — GTA 4 snubbed once again | Tom's Guide (tomsguide.com) Grand Theft Auto: The Trilogy – The Definitive Edition Officially Announced (ign.com) I like to think that MTA is kept alive by nostalgia so that it won't impact us too much, but who knows?
  8. I am afraid this has a lot to do with math. Did you have basic math at school? Did you by chance also attend physics classes? Then you should know what a function with parameter t is, the time. drawing speed = 9 characters divided by 5 seconds (5000ms) elapsed time ms = now - start (obtained by two getTickCount() samples) drawing length in characters = drawing-speed-ms * elapsed-time-ms
  9. It sounds like you want to tie the amount of letters drawn by dxDrawText to a function based on the elapsed time. You can calculate the elapsed time in milliseconds by taking two time samples using getTickCount and subtracting the first one from the second. Then you have a positive number that you can multiply by a factor and then multiply with the amount of character ("John Cena" is 9 characters if you count the space character). Then you use the string.sub function in combination with the calculated character count to get the delimited text for drawing. Good luck!
  10. Hello Sean7456! This looks like a topic that belongs into the Scripting section so I will treat it as one. Please be careful to correctly categorize your topic next time! I think the most modern approach to this is to use serverside mechanics like the onChatMessage event, the cancelEvent function and the outputChatBox function. The idea is to block the raw messages from players and then re-send the message to the chatbox using outputChatBox but with different colors for different visibleTo parameters. Good luck!
  11. Thank you for sharing the script with us! From the script excerpt that you have given us there appears to be no problem. I have several questions to you: Is there another script that does use the givePlayerMoney or takePlayerMoney function running on your server? Why do you pass the parameter "1" to getAliveGuys? Is there a second function definition somewhere that is different? Did you collect debug logs?
  12. Hello Mario222! Nice to see you in our MTA forums scripting section. It looks like your script is connected to other major components of your "race panel" that we have no insight into, especially the variable "playersAlive". Without that insight we cannot give a definite answer about this problem. Did you know that givePlayerMoney does work with non-positive amounts aswell? It looks like a bug in the documentation. I have added a Remarks section with a note about the misbehaviour. Do you know about the useful outputDebugString function? You can put it into your script to see what internal value combinations are occurring inside of it. You can login as admin into your server and use the "/debugscript 3" command to show a debug console with the messages. I suggest you to put the following and see what happens: if not getElementData ( source, "gotMoney" ) then outputDebugString( "pos: " .. tostring(pos) ); local money = math.ceil ( getPlayerCount ( ) * 50 / pos ); outputDebugString( "money: " .. tostring(money) ); givePlayerMoney ( source, money ); outputChatBox ( "* You were #abcdef[#ff0000" .. pos .. posName .. "#abcdef]#ffffff and #abcdefearned #ffffff" .. money .. "#00ff00$!", source, 255, 255, 255, true ); setElementData ( source, "gotMoney", true ); if account then outputDebugString( "player money: " .. tostring(getPlayerMoney(source)) ); setAccountData ( account, "money", tostring ( getPlayerMoney ( source ) ) ); end end If you see any negative values in the debug console then let us know with a screenshot! ?
  13. Glad to hear that you like it! In order to stop the "infinite running script" error, there is this little-known secret to use "debug.sethook(nil)" to allow unbounded execution. Use it wisely because if there really is an infinite loop then you cannot properly terminate it anymore (game hangs, server hangs, data loss, etc).
  14. There is no such thing. You UI will always look different because of screen DPI or different aspect ratios. Relative mode is one way to stretch the UI to factored screen-space dimensions. For example, 0.5 is always the middle of the screen in each dimension if a position coordinate. 0.5 is always half the screen dimension width or height, respectively. Please take a look at the documentation of guiCreateWindow: guiCreateWindow - Multi Theft Auto: Wiki There you will see that you have to set the 6th parameter relative to true if you want to use relative mode. Hence, your script excerpt should look like this: GUIEditor.window[1] = guiCreateWindow(0.4, 0.5, 0.478, 0.216, "Car Control Panel", true) guiWindowSetSizable(GUIEditor.window[1], false) Adjust all the other GUI creation logic with the same principle. --- Like a good teacher, there is always a time he shakes your hand and lets you free into this world. For now I wish you good luck with your scripting career. I think you have learned a lot on this. Your original problem has been solved. Have a nice time inside the MTA community! ?
  15. Seat number 1 is C array index 0 in the game. A technical detail that I wanted to spare you. I told you that I wanted to limit this to players that are joined only. Any players that join after you have opened or closed a window will not see the effect. So there are cases where the logic is not entirely synchronized. You should open a new topic if you want to have help on that.
  16. function changeSeat01 ( ) thePed = client theVehicle = getPedOccupiedVehicle ( thePed ) if ( theVehicle ) then local sitting_ped = getVehicleOccupant( theVehicle, 0 ) warpPedIntoVehicle ( thePed, theVehicle, 0 ) if (sitting_ped) then local free_slot = findFreeVehicleSlot( theVehicle ) if (free_slot) then warpPedIntoVehicle( sitting_ped, theVehicle, free_slot ) end end outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." ) end end Here is the real solution. Why did you change the function I gave you?
  17. Unfortunately, this is not correct. I have told you to change the inside operations of the changeSeat01 function. You have not changed a single line of that function. Could you try to do it? Change this function only: function changeSeat01 ( ) thePed = client theVehicle = getPedOccupiedVehicle ( thePed ) if ( theVehicle ) then -- PUT CODE TO FIND OCCUPANT AT SLOT 0 HERE warpPedIntoVehicle ( thePed, theVehicle, 0 ) -- PUT CODE TO WARP PREVIOUS OCCUPANT INTO FREE SLOT HERE outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." ) end end Maybe my green comment hints will help you solve this task. ?
  18. No. Read again points number two and three: I would like you to change the changeSeat... family of functions yourself. After your attempt, I will help you.
  19. If you are claiming that my function does not work, then I would like to see how my function is being used by you.
  20. Whenever you fire an event inside of MTA it is propagated to its children and parents. This is done by design: you can reach every subscriber by triggering an event on the root element but you can limit yourself to possibly just one subscriber or the root if you trigger it on a specific element. Read up on the MTA event system here. Since there is no good illustration of the event propagation space, which you should always keep in mind, here is a mock-up made by me: As you see, since you clicked on window1, the event was pushed to button1, button2 and root aswell. On each button you have told the event handler by using the implicit parameter propagate = true to the addEventHandler call of the onClientGUIClick event that you want to trigger if even the window told you about it. So how do you prevent listening to clicks on windows? You can use... addEventHandler("onClientGUIClick", button, function() -- YOUR CODE HERE. end , false) to just listen to the click event on the button itself. You can easily adjust your previous code by adding a "false" parameter as fourth parameter to any addEventHandler call done based on your buttons. Hope this helps!
  21. If you use the same old GUIEditor resource to make your GUI, then yes. Your guess is correct, because you want to warp players and players are serverside elements that are synchronized with clients. You have already put the seat change code on the serverside which was correct. So why not extend it?
  22. Whenever you use warpPedIntoVehicle to set the occupant slot inside of a vehicle, you force the player who would be otherwise on that slot out of the vehicle. This is not a bug but intended behavior. You have to tell the MTA server to find another slot for any player whose slot should be removed from the vehicle. You need the following building blocks for this: a function to find a free vehicle slot inside of a vehicle (provided by me) the getVehicleOccupant function to see if there is a player sitting on a vehicle slot prior to calling warpPedIntoVehicle adjusting the seat change event handler logic to connect the building blocks: find a free vehicle slot after calling warpPedIntoVehicle and warp the ped whose slot was replaced into that free slot. Here is the function to find a free vehicle slot: function findFreeVehicleSlot(vehicle) local seat_count = 1 + getVehicleMaxPassengers( vehicle ) for slot_off=1,seat_count do local sitting_ped = getVehicleOccupant( vehicle, slot_off - 1 ) if (sitting_ped == false) then -- is no ped sitting on that slot? return slot_off - 1 -- return the free slot index end end -- There is no free slot so return false. return false end Hope this helps!
  23. I was confused for a second because in a previous post you have said... which made me assume that you have a login system. Sorry, it was a mistake on my part. Here is the solution. By default if you create windows using guiCreateWindow they are visible. You need to set them to invisible after creation to prevent that. GUIEditor.window[1] = guiCreateWindow(400, 500, 478, 216, "Car Control Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) ... GUIEditor.button[15] = guiCreateButton(54, 27, 41, 39, "Shutter 02", false, GUIEditor.window[3]) GUIEditor.button[16] = guiCreateButton(10, 71, 40, 39, "Shutter 03", false, GUIEditor.window[3]) -- INSERT THIS CODE AFTER GUI CREATION for m,n in ipairs(GUIEditor.window) do guiSetVisible(n, false) end
  24. Please look at the following quote from me in a previous post. Use the hint I gave you. If there is any event that your login system is firing when it shows the UI, like an "onClientShowLoginUI" event, then you can use an event handler and call the guiackapa function inside of it (recommended solution). Now tell me, is there a mechanism in your login system for that? ?
×
×
  • Create New...