Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. You could use onMapStarting (https://wiki.multitheftauto.com/wiki/Resource:Race) and check if player is logged in.
  2. I'm pretty sure your coords are all wrong. I tested the 2 sets of coords and they both work just fine (pyramid in LV and by LSPD). No problems whatsoever.
  3. 50p

    Dead mechanics

    How do you want your script to work?
  4. Your x and x2 are the same (so width = x2 - x = 0)
  5. The reason why admin panel doesn't work it's because the key is bound to a command. F1 panel in freeroam is not disabled because it's bound to a function (you don't disable functions, you disable commands). If you want to disable F1 from freeroam then you'll have to use: unbindKey( player, "f1" ); I haven't tried this and I don't know if this will unbind functions bound to a key in a different resource but it should.
  6. That's all you need. Just replace the x, y, x2 and y2 with coords of other areas but remember to follow the rules I showed you on the picture previously and it should always create the area correctly. I think your coords are little messed up and that's the reason it fails or you have some more calculations which are not necessary.
  7. 50p

    Dead mechanics

    In what way didn't setElementAlpha solve the problem? Maybe your code is bugged and you have errors which you haven't told us about. Check your debug window.
  8. This is all you need: width = math.abs( x2 - x ) height = math.abs( y2 - y ) You don't need to swap coords. Try this (just copy'n'pase in onResourceStart): x = 1440.0651855469; y = -1725.3817138672; x2 = 1524.0031738281; y2 = -1600.7269287109; width = math.abs( x2 - x ); -- width = 1524 - 1440 = 84 height = math.abs( y2 - y ); -- height = -1600 - (-1725) = -1600 + 1725 = 125 createRadarArea( x, y, width, height );
  9. I don't know where you come up with such function names as getElementTree(), getElementRoot(); You are confusing because I don't know what you mean so I can't tell if you're right or wrong. The element tree page explains everything clearly and I don't want to explain it just with rephrased sentences. Eg. events are triggered on elements, look at this: -- lets tell everyone that player entered a marker function printMessage( ) outputChatBox( "Player: " .. getPlayerName( source ) .." entered a marker!" ); end addEventHandler( "onPlayerMarkerHit", root, printMessage ); -- #1 addEventHandler( "onPlayerMarkerHit", PLAYER_ELEMENT, printMessage ); -- #2 addEventHandler( "onPlayerMarkerHit", PLAYER_ELEMENT, printMessage, false ); -- #3 #1 - function printMessage will be called every time players who are children of root will hit a marker (by default all players are children of root) #2 - function printMessage will be called only when specific PLAYER_ELEMENT (and its children) hits a marker #3 - function printMessage will be called only when specific PLAYER_ELEMENT only hits a marker
  10. 50p

    Dead mechanics

    You can use setElementAlpha to hide elements (but shadow is still visible if it's vehicle or ped). What's the point having 2 peds anyway? Doesn't onElementClick work with dead player?
  11. Your coords are wrong. They should be as swapped. Area 1: x = 1440.0651855469; y = -1725.3817138672; x2 = 1524.0031738281; y2 = -1600.7269287109; Area 2: x = 2256.5837402344; y = 1219.8205566406; x2 = 2389.6433105469; y2 = 1347.0687255859; Width and height: width = math.abs( x2 - x ); height = math.abs( y2 - y ); createRadarArea( x, y, width, height ); You should get coords in the following manner:
  12. I'm not sure if I understand you (your last sentence) but you're right in your first paragraph.
  13. Why both of your X values (x and x2) are the same? (Probably your mistake copy'n'pasting). If you use these coords to calculate width: x2 - x = 0; same if you do x - x2 = 0;
  14. Give an example of 2 areas you use: x, x2, y, y2 (from different quadrants, follow the link from previous post if you don't know what I mean by quadrants). I'm not sure if the coords you use are what I think they are. It's simple maths but if you get the coords wrong the result will be wrong.
  15. You want to handle any gamemode so you need to use root or getRootElement(). If you attach the handler to your own resource for onGamemodeMapStart it will never be triggered because when maps starts (this is another resource) which is at the same level as your gamemode resource in the element tree the event will not be triggered. Event is triggered for an element or its children in the element tree. Many people here on the forums seem to need to learn one of the most important things in MTA which is in fact element tree.
  16. Why use math.abs to compare values? Doesn't matter where you are, if you get bottomX and bottomY values, they will always be smaller then topX and topY (since topX and topY are equal to bottomX + width and bottomY + height). Use math.abs only to calculate width and height only. Lets say you are in the x < 0 and y < 0 quadrant (which is quadrant III -> http://en.wikipedia.org/wiki/Quadrant_(plane_geometry)) x = -1245 y = -130 topX = -1200 topY = -10 x < topX and y < topY -- this is true if you do math.abs for these, it will be false because then: x > topX and y > bottomY Your last screenshot shows that you need to add height or radar area to bottomY coord.
  17. What about after you get x coord take away the width of the area to get correct x? x = x - width; -- or whichever x you use as the first argument in createRadarArea TIP: You can swap values in Lua as following: x, x2 = x2, x;
  18. 50p

    Problem

    Check if the hit element is "you". Since you seem to do it client-side then check if the hit element is localPlayer.
  19. Seems like you're trying to make a lib with DX functions? Why don't you have a "global" onClientRender in your class for all its objects? local renderObjects = { }; table.insert( renderObjects, yourObject ); -- when new object is created, add it to the list of objects to render addEventHandler( "onClientRender", root, function( ) for k, v in pairs( renderObjects ) do if v:Visible() then -- i guess you have a method to check if object is visible v:__window( ); end end end );
  20. setRadioChannel is a little bugged. I haven't tested it deeply but I know for a fact that if you want to use setRadioChannel you first have to enter a vehicle but I presume you are in a vehicle if you're saying radio station 0 fails. What does setRadioChannel return?
  21. 50p

    Disable grass

    You might replace grass texture with completely transparent pixel, but this way you'd have to replace all other growing grass textures, as you know there are different types of grass. Shader would help here.
  22. 50p

    Banned Message

    AFAIR, using "reason" parameter in banPlayer function is the reason player will also see in the message box. https://wiki.multitheftauto.com/wiki/BanPlayer
  23. Enough of that pointless chat. Locked.
  24. You can't make peds larger than peds. Well, you could but then you'd have to have custom animations/skeleton (but it's not supported by MYA) for larger models. To give zombies more health you can use setElementHealth to set their health to high value.
  25. 50p

    Setting ACL file

    Simply remove the button. Find the line where it's created and comment the line or remove the line completely.
×
×
  • Create New...