Wojak
Members-
Posts
321 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Wojak
-
I'm using onClientPlayerWeaponFire and onClientExplosion events. This id not giving me any informations about HP loss, but the informations i need: "Who used the weapon" and "witch vehicle was hit" thats bad... now i will have to use the backup plan involving checking the control state and processing the line of sight- and that will not work perfect
-
let my try to explain once more: I want to know a point in time and space when PlayerA that is in VehicleA (hunter, rustler or seasparrow) is hitting a VehicleB (not necessary occupied by any player) using vehicle weapons (hunter minigun, rustler gun and seasparrow gun). i am able to detect weapons such ak-47 or uzi, i even find a way to detect projectile based weapons (hunter and hydra rockets or rihno canon), so there must be some way to detect the 3 last weapons i need... any ideas?
-
i need a way to detect vehicle weapons hitting a nother vehicle (hunter minigun, rustler gun and seasparrow gun). i've tried using the onClientPlayerWeaponFire event, but the weapons i need are not supported... any ideas?
-
and wtat is wrong with this: https://wiki.multitheftauto.com/wiki/GetElementMatrix ?
-
what is this? x, y, z = getElementPosition ( thePlayer) setElementVelocity ( thePlayer, x, y, z + 5.0 ) Velocity is a vector and you used coordinates as argument... you should make the attackHandler function clientside (players are always synced, so don't worry) and use the getElementMatrix (https://wiki.multitheftauto.com/wiki/GetElementMatrix) function to calculate the vector x, y, z = getElementPosition ( thePlayer) local matrix = getElementMatrix ( theplayer ) local offX = 0 * matrix[1][1] - 2 * matrix[2][1] + 2 * matrix[3][1] + matrix[4][1] local offY = 0 * matrix[1][2] - 2 * matrix[2][2] + 2 * matrix[3][2] + matrix[4][2] local offZ = 0 * matrix[1][3] - 2 * matrix[2][3] + 2 * matrix[3][3] + matrix[4][3] setElementVelocity ( thePlayer, offX - x, offY -y ,offZ -z) my code may not be correct, but experiment with it
-
i was bored in the work one day and i read the lua manual... this expresion function a() return a() end is a "Proper Tail Cal" and lua interpreter treats it like "GoTo" and do not use any stack space. No stack -> no stack overflow http://www.lua.org/pil/6.3.html of course every scripter should know how to prevent Infinite loops using conditions and i think this exemple may result in FPS drop.
-
there are at lest two ways to prevent this: 1) Proper Tail Call function a() return a() end 2) setTimer function function a() setTimer (a,50,1) end i always use "setTimer" method myself, ofcourse the interval may be difrent than 50 (50 is minimum)
-
ok lets asume that you made a valid edf file and you added the costum spawnpoints using the editor lets say you edf spawnpoint name is "myspawnpoint" and the editor names the spawnpoints in map file as "myspawnpoint (1)", "myspawnpoint (2)" ect. to get a position of specyfic spawnpoint: local x,y,z = getElementPosition(getElementById("myspawnpoint (1)")) spawnPlayer (someplayer,x,y,z) to get a radnom spawnpoint: local spawntable = getElementsByType("myspawnpoint") local randomspawn = math.random ( 1, table.getn ( spawntable ) ) local x,y,z = getElementPosition( spawntable[randomspawn]) spawnPlayer (someplayer,x,y,z)
-
Dear scripters, please help me with anti command flood
Wojak replied to GuyFromPast's topic in Scripting
Global Variables http://www.lua.org/pil/1.2.html Local Variables http://www.lua.org/pil/4.2.html Tables http://www.lua.org/pil/2.5.html but you should read everything... (at least to part 3 ) http://www.lua.org/pil/index.html -
yes we do... viewtopic.php?p=321948#p321948 @MiniGoveya if you want to dyspley "target player name" you should use "who" instead of "getPlayerName (playerSource)" function wb ( playerSource, command, who ) outputChatBox ("# 808080 <# 00FFFF" .. getPlayerName (playerSource).."# 808080> Welcome Back, "..who.." ! ",getRootElement (), 255, 255, 255, true) end addCommandHandler ( "wb", wb )
-
i belive this rank shold be get by: rank = getElementData(source, "race rank") more info: https://wiki.multitheftauto.com/wiki/Resource:Race https://wiki.multitheftauto.com/wiki/Element_data
-
function sf (source) this is the wrong line, you should reed the whole topic once more, learn something and try to fix it yourself...
-
setElementVelocity(vehicle,0,0,0) should go after setElementPosition (vehicle, 384.0750,2541.4612,16.5391) or: function aa (playerSource) local vehicle = getPedOccupiedVehicle(playerSource) if vehicle then setVehicleFrozen(vehicle,true) setElementPosition (vehicle, 384.0750,2541.4612,16.5391) setTimer(setVehicleFrozen,50,1,vehicle,false) else setElementPosition (playerSource, 384.0750,2541.4612,16.5391) end outputChatBox ("You Have Been Teleported To The Old Airport!!", playerSource, 0, 255, 0) end addCommandHandler ( "aa", aa ) if there is no syntax error
-
maybe try: addEventHandler( "onClientPlayerWasted", getLocalPlayer( ), function( ) if source == getLocalPlayer( ) guiSetVisible (spawnmenugrid, true ) guiSetVisible(spawnmenumemo,true) showCursor ( true ) showPlayerHudComponent("radar",false) showChat(false) end end)
-
Ok, so I added the mirror Note that this is not the version from the community, see the first post for more info.
-
ok i edited the first post and added the video, as you can see the video sux, so i recommend to experience this script in game
-
INFO This resource adds a Hunter helicopter that will fallow the race lieder trying to kill him (but it may accidentally kill other players too). There were some race maps where some players started as racers, and rest as hunrers, and now every one can race, and the bot will do the hunting IMPORTANT NOTES this script works only with the race gamemode, it will work with any race map. the helicopter has the ability to fly through objects, but I'm not planning to fix it, i want to keep this script simple, as it is USE iff you want it on all maps just start it iff you want it on a specyfic maps add: <include resource="race_huntbot" /> to map's meta.xml file New in version 1.1: - added the x rotation support depending on the bot speed, this makes the bot look more natural (no more things like in the video on 1:45). - bot will only shoot when in first player sync range. - fixed some annoying bugs. - added the settings system including: - unit - non; accepted value >= 0; default – 20; this value is used to predict the passable player position, the larger this value, the longer will be the distance between the player and the calculated position (proportional to the player speed) - unit – ; ; accepted value >= 0.5; default – 5.2; this is the ai loop refresh rate, the lower this value, the more actual information’s about the player (in not recommend to set this to low though, creating a instant killing machine is not to fun for the racers). Note that messing with above values may improve or screw up the bot ai, when you change one of them you should change the other ass well (if you increase one and decrease the other, you will screw up for shore). - unit – [km/h]; value >= 10; default – 5.2; bot will not go faster then that. - unit – ; value >= o; default – 25; how many seconds bot should wait after the map starts (race countdown displays “GO”). - unit – ; value >= 5; default – 30; how many seconds bot should wait after detecting the first player death (bot may not detect first player death, if map respawn time is lower than bot aispeed). Bot will search for the settings in maps meta.xml (you don’t need to add all the settings there, just the ones you want to change), if there are no settings there, it will search them in his own meta.xml (you may use the resource meta.xml ass global settings), if this settings are somehow wrong, it will use the default from the lua file. - other changes (this version is using functions from the fallowing resources: mapmanager; missiontimer) Known problems: When a new player joins while bot is waiting, recourse missiontimer will post warnings… What next?: - no hunting zones that may be added using map editor - ability to change the helicopter model (Police Maverick, Cargobob) - improved aiming - voting “do you want to play with huntbot?” on map starting - DD/DM (race maps with no checkpoints) support - Maybe something else But I’m not promising nothing feel free to comment, report bugs, ask questions and post ideas. http://img340.imageshack.us/i/mtascreen ... 12935.jpg/ http://img840.imageshack.us/i/mtascreen ... 11200.jpg/ http://img820.imageshack.us/i/mtascreen ... 11134.jpg/ VIDEO DOWNLOAD https://community.multitheftauto.com/index.php?p= ... ils&id=985 race_huntbot.zip 1.1, size: 3.85 KB
-
no, there is no way, as I discovered long time ago https://forum.multitheftauto.com/viewtop ... 68#p301568 i reccomend to move this script client side and check the distance betwen andromada and the local player, as for: setElementPosition ( hitPlayer, andromada ) -- Places the Player just behind the Andromada -- needs working not finished use this client side function: https://wiki.multitheftauto.com/wiki/GetElementMatrix
-
select/click the bin than tap the F3 key...
-
you can try to getElementHealth https://wiki.multitheftauto.com/wiki/GetElementHealth when the player hit the marker, than setElementHealth https://wiki.multitheftauto.com/wiki/SetElementHealth on client render https://wiki.multitheftauto.com/wiki/OnClientRenderwhile while the player is within marker https://wiki.multitheftauto.com/wiki/IsE ... thinMarker (this must be client side)
-
You are using an old Admin resource (it looks like the DP version) dont download the version from the community... instal/reinstal MTA 1.0.3 and it should be ok
-
i think it is posible only if player used a gun (impasible for melle and projectiles based weapons) --client onClientPlayerWeaponFire(function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) local name = getPlayerName(source) if getElementType(hitElement) == "Vehicle" then setElementData(hitElement, responisblePlayer, name) end end) --server onVehicleExplode(function() outputChatBox(getElementData(source, responisblePlayer).. " caused car explode") end) 1) i written it in the browser, it may not work at all 2) if it wil work, it will often lie... 3) i want parameters like in onPlayerWasted in onVehicleExplode to
-
check if the player element pased do client side functions is a LocalPlayer: if player is the source of an event replace getRootElement() to getLocalPlayer() if player is a parameter of the function use: if thePlayer == getLocalPlayer() then end
-
why? function vehiclelights (player ) -- The player who triggered the command local aName = getPlayerName(player) if ( getVehicleOverrideLights ( playervehicle ) == 1) then setVehicleOverrideLights ( playervehicle, 2 ) outputChatBox ( "Vehicle Lights On" ) outputChatBox (aName.. " turns his vehicles lights on",getRootElement(), 194, 103, 181) -- = /me turns his vehicles lights on. else setVehicleOverrideLights ( playervehicle, 1 ) outputChatBox ( "Vehicle Lights Off" ) outputChatBox (aName.. " turns his vehicles lights off",getRootElement(), 194, 103, 181) -- = /me turns his vehicles lights off. end end addCommandHandler( "lights", vehiclelights )