-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
Thanks. Bare in mind that it may seem basic now and some features not working properly if at all but I'm doing all I can do make it as bug free as possible. My first approach was wrong when I kept adding new things and fixed a few bugs now and then. Currently, I wait for people to report bug or give requests for new features before I start working on a new version so that I can fix the bugs first. Anyway, this is going off topic. If you want you can post in MTASE topic or PM with requests. I will also need a tester.
-
Check my signature "MTA Script Editor". I'm planning to release an update this weekend if things will follow the way I expect.
-
And in the MTA:SE syntax checker.
-
Yes, you can. Skip the entire loop and use source instead of vehicle.
-
As far as I know, when you target at a vehicle getPedTarget will return vehicle (target = vehicle) so there is no point "getting occupied vehicle of vehicle".
-
All the above scripts are wrong. It will work but will throw errors after vehicles explode. Also, why keep creating new timer every second for the same vehicles? Think people. Create a table of timers and before you set new timer check if the timer is already set for this vehicle. local vehTimers = { }; setTimer( function ( ) for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if getElementHealth(vehicle) < 260 then setElementHealth( vehicle, 250 ); -- set vehicle health to "fire" health which is ~250 if not vehTimers[ vehicle ] then -- if we haven't set the timer 1 second earlier then: setVehicleDamageProof( vehicle, true) -- it only need to be called once so set the bulletproof property vehTimers[ vehicle ] = setTimer( blowVehicle, 300000, 1, vehicle); -- 5mins = 5 * 60sec = 300sec = 300000ms! It's NOT 500000ms end elseif vehTimers[ vehicle ] and isTimer( vehTimers[ vehicle ] ) then -- if we set a timer earlier but the vehicle was repaired within the 5mins then: setVehicleDamageProof( vehicle, false) -- disable bulletproof property killTimer( vehTimers[ vehicle ] ); -- kill the timer vehTimers[ vehicle ] = nil; -- remove the variable from the memory since we killed the timer and it's no longer timer variable end end end,1000, 0 ) Haven't tested but from "rubber duck" debugging it should work just fine without any error/warning messages.
-
It is no longer available. It was basic web based meta.xml generator. Currently I'm working on MTA:SE which will generate meta.xml files for you. viewtopic.php?t=24834
-
Background image? You will need to find a line that draws background rectangle and simply replace it with dxDrawImage which will draw an image instead of a black rectangle.
-
SKIPPER, it looks like you mixed up team name with element data. Look at the scoreboard and check if the team name is correct, then check what data is held on "Occupation" of the player. It's just simple debugging that will lead you to the success. If you said: the second if statement works that means player is in "Delivery" team. Debug, debug, debug.
-
https://wiki.multitheftauto.com/wiki/Set ... undEnabled
-
Why do you expect people to post if you haven't asked a single question? Read my signature.
-
You can only do it with attachments. It's not that hard to do but if you want some advanced system then you'd have to spend some more time. I've seen this video on youtube some time ago: Keep getting the message;"You need to pickup the supplies first!" addEventHandler("onClientMarkerLeave", root, function ( hitElement ) local v = getPedOccupiedVehicle ( hitElement ) local element = getElementAttachedTo ( v ) local object = getAttachedElements ( element ) if object then outputChatBox("ok!") else outputChatBox("You need to pickup the supplies first!") end end ) ... local v = userdata local element = false -- reason is you're getting what element your vehicle is attached to, your vehicle is not attached to anything so it returns false local object = false -- this is obvious, if element is false then getAttachedElements will return false too
-
Follow the steps again. Restart the server if it's running. If I were you I would stop the server before editing the confing file.
-
If you have downloaded a resource which uses the module then you will have to install it. Follow this page to find out how: https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL
-
You don't need the module. Just use native MTA MySQL functions. https://wiki.multitheftauto.com/wiki/Ser ... _functions
-
No problem. Play around with different values to suit your needs. I just used 2 as an example.
-
https://wiki.multitheftauto.com/wiki/GetElementMatrix 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 setCamera() local theCar = getPedOccupiedVehicle(localPlayer) if theCar then local cx, cy, cz = getPositionFromElementOffset( theCar, 2, -2, 0 ); -- camera position at the left read side of the car (2 units to the left and 2 units to the back) local lx, ly, lz = getPositionFromElementOffset( theCar, 2, 2, 0 ); -- get the position where the camera will look (2 units to the left and 2 units to the front) setCameraMatrix( cx, cy, cz, lx, ly, lz ); end end addEventHandler("onClientPreRender", root, setCamera) addEventHandler("onClientResourceStart", resourceRoot, setCamera) addCommandHandler("setcamera", setCamera)
-
Client-side script to give/take money of remote players? Sounds silly to me. Do it server-side.
-
It's much more helpful and easier to find the problem when you say what doesn't work.
-
getElementVelocity returns 3 values. You need to use Pythagoras theorem to calculate actual speed since the velocity is returned in x, y and z format so you need to calculate the length of these values (x*x + y*y + z*z) * 100 (or 160). Calling function like that (line 12) will work but the multiplication would only multiply z (the last value returned from getElementVelocity function). Also, is it possible to target yourself? (line 8 seems pointless).
-
You can try this: https://wiki.multitheftauto.com/wiki/SetWeaponProperty but if that's not what you're looking for then I'm sure it's not possible.
-
@arezu, Yours is worse, why? Because you have to loop through all the players and create a table of the players. Imagine 30 players online, you have to loop through them all. The chances of my loop to repeat 30 times is very low since getRandomPlayer would have to get the same player 30 times which is unlikely to happen. If the script needs to be client-side script then there is no other way than using the loop that you showed.
-
Server-side: local rndPlayer; -- variable holding random player while( player == rndPlayer ) do rndPlayer = getRandomPlayer(); end
-
for k, v in ipairs( getAttachedElements( player ) ) do destroyElement( v ); -- it will destroy all elements attached to player end
-
Why create anonymous function if you can pass arguments to setTimer? setTimer ( removeEventHandler, 5000, 1, "onClientRender", root, drawErrorMsg )