-
Posts
1,060 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Addlibs
-
addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging",root, function (new) if (new == "Running") then startomg_movement() end end) This is my best guess on how to do that, and you already have that in your code. The state "GridCountdown" is apparently the countdown state. The very next state is "Running". Thus, state change from "GridCountdown", or any state tbh, to "Running" should only occur once the countdown is finished. Hence, onRaceStateChanging with new state being "Running" should be triggered just after the countdown ends. Are you sure the code you tested was the one you posted? Perhaps it didn't save and you kept testing some old code?
-
I think you need to read https://wiki.multitheftauto.com/wiki/Scripting_Introduction first, before you can get around trying to "stick" objects to player.
-
Coroutines are used to pause execution of a routine (a section of the code) whilst waiting for a callback, for example. They aren't a replacement for timers, but rather an addition. If you want to pause and then resume coroutines after some time elapses, you'd be using setTimer as well. If you want temporary vips and bans you'd be best using traditional data storage (XML files, JSON files, SQL, etc. -- preferably SQL) with timestamps to mark end-time and setTimer to trigger the function that removes the vip status or ban. That way you can restart timers when your resource restarts for any reason, since you know the current timestamp and end-timestamp, you can calculate how long setTimer you need.
-
If you want to get a listing of existing tables, you need to query the hidden sqlite_master table: SELECT name FROM sqlite_master WHERE type='table' If you want to know if a specific table exists: SELECT name FROM sqlite_master WHERE type='table' AND name=? LIMIT 1 sending the table name as a parameter. The no. of returned rows will be 1 if the table exists.
-
It's HLSL (High Level Shading Language), used for DirectX shaders. https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl There are only a handful of people on MTA who know how to write shaders, which is why its difficult to find any tutorials.
-
The if checks are unnecessarily complicated. All you need to test for is z position. if (gZ >= 14.39999961853) then -- if it's up at or above Z=14.4 moveObject(gate, 5000, 1588.6999511719, -1638.5, 10, 0, 0, 0) -- move it down to z=10 elseif (gZ <= 10) then -- if it's down at or below Z=10 moveObject(gate, 5000, 1588.6999511719, -1638.5, 14.39999961853, 0, 0, 0) -- move it to Z=14.4 end
-
Please also post the code that caused this error to occur. The error message includes resource name, file name and line number. Post other relevant lines as well, such as variable definitions and scopes (if, while, do blocks, etc.) that surround the line.
-
Please. Format the code correctly (code tags--they add line numbers and are much more readable) and give more information. Just saying "giving interference" and posting a :~load of code isn't helping anyone find the issue. Tell us what you intended, what you got, why that is an issue and what have you tried already.
- 1 reply
-
- interference
- panel
-
(and 5 more)
Tagged with:
-
defaults.luac = get 'luac', defaults.prep = get 'prep', defaults.prepa = get 'prepa', defaults.prepcache = get 'prepcache', defaults.luaccache = get 'luaccache', defaults.suffix = get 'suffix', defaults.extension = get 'extension', defaults.naming = get 'naming',--order is important, e=strip extension, s=add suffix, t=replace with target if target exists defaults.tgt = '', There shouldn't be commas at the end of each line, as each line here is a separate statement (optionally, you can end it with a semicolon though). For a code this advanced it's kinda suspicious that you can't read error messages. Presumably this isn't your code?
-
Most animations are driven by an easing function - the simplest of which is Linear, but you could write your own easing equation - for example, y = x+math.sin(6.29x) if you want to, but most likely you won't need it. If you want something to appear smoothinly, use the return of an easing function as the alpha parameter; if you want it to slide onto the screen, use it for x or y position.
-
Inspecting the source code, the server event onPlayerDamage only checks for a difference in last known health value and new health value from sync packets, and calculates a loss from that. Perhaps the client version, onClientPlayerDamage provides a more accurate damage HP but I haven't tested that, and the client side source is a little too complicated for me to trace what is exactly happening.
-
The resource which calls addAccount needs to have the correct permissions set up in ACL. Perhaps the easiest but also the most dangerous way to fix this issue is to add resource.[your resource name] object in the admin ACL group (but this grants way more permissions than just addAccount, so make sure you trust the code)
-
It appears your login panel spawns players in skin 0 (CJ) which is what DayZ uses to detect if an account is glitched. You should let DayZ handle the spawning while your login panel only logs the player in and sets his element data "logedin" (sic) to true
-
<?php $file_name = "my_script"; // filename without .Lua extension $body = file_get_contents($file_name.".Lua"); // Create a stream $opts = array( 'http'=>array( 'method'=>"POST", 'content' => $body // send the Lua code as body of the request ) ); $context = stream_context_create($opts); $compiled = file_get_contents('https://luac.multitheftauto.com/?compile=1&debug=0&obfuscate=3', false, $context); file_put_contents($file_name.".luac", $compiled); // save to same name but .luac ?>
-
With ipairs it will stop looping as soon as it encounters a non-existent index. I.e. for 1,2,8 will only execute for 1 and 2, and because 3 does not exist it will break out of the loop. You'll need to use an auto-indexed table with the layer priority as a part of the layer data table, and table.sort after every addition
-
I don't understand what you mean, however, I'd like to point out your code will trigger on any marker instead of only on tp1, because of propagation of events. You need to add a false right aft er the function in the event handler to only bind it on the specified element and not its parents. In other words, you should be using addEventHandler("onMarkerHit", tp1, msg, false) Also, please, use a proper, more helpful, topic title next time. Just putting in [HELP] doesn't inform us what the problem is, and therefore people are unlikely to click your topic if they don't know the problem relates to their expertise.
-
Depends on what game mode you're running. If you have no game mode (and player's don't spawn automatically at all), all you have to do is call spawnPlayer on onPlayerJoin If you're using a game mode that comes preinstalled on MTA servers (such as play, race, dm, etc.), you can get help here. If you're using a third party game mode, it would be best if you contact the author, or post a section of the code that deals with spawning (provided it is not a leaked game mode, we will help you modify the original spawn code, but only if you provide it to us)
-
? https://forum.multitheftauto.com/forum/97-portuguese-português/
-
local IFP_FILE = "custom_ped_file.ifp" local CUSTOM_PED_BLOCK_NAME = "ped_custom" local pedAnims = {"abseil", "arrestgun", "atm", "bike_elbowl", "bike_elbowr", "bike_fallr", "bike_fall_off", "bike_pickupl", "bike_pickupr", "bike_pullupl", "bike_pullupr", "bomber", "car_alignhi_lhs", "car_alignhi_rhs", "car_align_lhs", "car_align_rhs", "car_closedoorl_lhs", "car_closedoorl_rhs", "car_closedoor_lhs", "car_closedoor_rhs", "car_close_lhs", "car_close_rhs", "car_crawloutrhs", "car_dead_lhs", "car_dead_rhs", "car_doorlocked_lhs", "car_doorlocked_rhs", "car_fallout_lhs", "car_fallout_rhs", "car_getinl_lhs", "car_getinl_rhs", "car_getin_lhs", "car_getin_rhs", "car_getoutl_lhs", "car_getoutl_rhs", "car_getout_lhs", "car_getout_rhs", "car_hookertalk", "car_jackedlhs", "car_jackedrhs", "car_jumpin_lhs", "car_lb", "car_lb_pro", "car_lb_weak", "car_ljackedlhs", "car_ljackedrhs", "car_lshuffle_rhs", "car_lsit", "car_open_lhs", "car_open_rhs", "car_pulloutl_lhs", "car_pulloutl_rhs", "car_pullout_lhs", "car_pullout_rhs", "car_qjacked", "car_rolldoor", "car_rolldoorlo", "car_rollout_lhs", "car_rollout_rhs", "car_shuffle_rhs", "car_sit", "car_sitp", "car_sitplo", "car_sit_pro", "car_sit_weak", "car_tune_radio", "climb_idle", "climb_jump", "climb_jump2fall", "climb_jump_b", "climb_pull", "climb_stand", "climb_stand_finish", "cower", "crouch_roll_l", "crouch_roll_r", "dam_arml_frmbk", "dam_arml_frmft", "dam_arml_frmlt", "dam_armr_frmbk", "dam_armr_frmft", "dam_armr_frmrt", "dam_legl_frmbk", "dam_legl_frmft", "dam_legl_frmlt", "dam_legr_frmbk", "dam_legr_frmft", "dam_legr_frmrt", "dam_stomach_frmbk", "dam_stomach_frmft", "dam_stomach_frmlt", "dam_stomach_frmrt", "door_lhinge_o", "door_rhinge_o", "drivebyl_l", "drivebyl_r", "driveby_l", "driveby_r", "drive_boat", "drive_boat_back", "drive_boat_l", "drive_boat_r", "drive_l", "drive_lo_l", "drive_lo_r", "drive_l_pro", "drive_l_pro_slow", "drive_l_slow", "drive_l_weak", "drive_l_weak_slow", "drive_r", "drive_r_pro", "drive_r_pro_slow", "drive_r_slow", "drive_r_weak", "drive_r_weak_slow", "drive_truck", "drive_truck_back", "drive_truck_l", "drive_truck_r", "drown", "duck_cower", "endchat_01", "endchat_02", "endchat_03", "ev_dive", "ev_step", "facanger", "facgum", "facsurp", "facsurpm", "factalk", "facurios", "fall_back", "fall_collapse", "fall_fall", "fall_front", "fall_glide", "fall_land", "fall_skydive", "fight2idle", "fighta_1", "fighta_2", "fighta_3", "fighta_block", "fighta_g", "fighta_m", "fightidle", "fightshb", "fightshf", "fightsh_bwd", "fightsh_fwd", "fightsh_left", "fightsh_right", "flee_lkaround_01", "floor_hit", "floor_hit_f", ":Ou", "gang_gunstand", "gas_cwr", "getup", "getup_front", "gum_eat", "guncrouchbwd", "guncrouchfwd", "gunmove_bwd", "gunmove_fwd", "gunmove_l", "gunmove_r", "gun_2_idle", "gun_butt", "gun_butt_crouch", "gun_stand", "handscower", "handsup", "hita_1", "hita_2", "hita_3", "hit_back", "hit_behind", "hit_front", "hit_gun_butt", "hit_l", "hit_r", "hit_walk", "hit_wall", "idlestance_fat", "idlestance_old", "idle_armed", "idle_chat", "idle_csaw", "idle_gang1", "idle_hbhb", "idle_rocket", "idle_stance", "idle_taxi", "idle_tired", "jetpack_idle", "jog_femalea", "jog_malea", "jump_glide", "jump_land", "jump_launch", "jump_launch_r", "kart_drive", "kart_l", "kart_lb", "kart_r", "kd_left", "kd_right", "ko_shot_face", "ko_shot_front", "ko_shot_stom", "ko_skid_back", "ko_skid_front", "ko_spin_l", "ko_spin_r", "pass_smoke_in_car", "phone_in", "phone_out", "phone_talk", "player_sneak", "player_sneak_walkstart", "roadcross", "roadcross_female", "roadcross_gang", "roadcross_old", "run_1armed", "run_armed", "run_civi", "run_csaw", "run_fat", "run_fatold", "run_gang1", "run_left", "run_old", "run_player", "run_right", "run_rocket", "run_stop", "run_stopr", "run_wuzi", "seat_down", "seat_idle", "seat_up", "shot_leftp", "shot_partial", "shot_partial_b", "shot_rightp", "shove_partial", "smoke_in_car", "sprint_civi", "sprint_panic", "sprint_wuzi", "swat_run", "swim_tread", "tap_hand", "tap_handp", "turn_180", "turn_l", "turn_r", "walk_armed", "walk_civi", "walk_csaw", "walk_doorpartial", "walk_drunk", "walk_fat", "walk_fatold", "walk_gang1", "walk_gang2", "walk_old", "walk_player", "walk_rocket", "walk_shuffle", "walk_start", "walk_start_armed", "walk_start_csaw", "walk_start_rocket", "walk_wuzi", "weapon_crouch", "woman_idlestance", "woman_run", "woman_runbusy", "woman_runfatold", "woman_runpanic", "woman_runsexy", "woman_walkbusy", "woman_walkfatold", "woman_walknorm", "woman_walkold", "woman_walkpro", "woman_walksexy", "woman_walkshop", "xpressscratch"} -- load the IFP file local IFP = engineLoadIFP(IFP_FILE, CUSTOM_PED_BLOCK_NAME) if not IFP then outputChatBox("Failed to load '" .. IFP_FILE .. "'") end function replacePedAnims(ped) for i, animName in pairs(pedAnims) do -- loop the anims table above engineReplaceAnimation(ped, "ped", animName, CUSTOM_PED_BLOCK_NAME, animName) -- and replace the original anim with the custom one end end addEventHandler("onClientElementStreamIn", root, function() -- on element stream in if getElementType(source) == "player" or getElementType(source) == "ped" then replacePedAnims(source) -- apply to the element if it's a player or a ped end end ) -- apply animations on script start for k, v in pairs(getElementsByType("player", root, true)) do replacePedAnims(source) -- apply on each streamed in player end for k, v in pairs(getElementsByType("ped", root, true)) do replacePedAnims(source) -- apply on each streamed in ped end -- (untested) However, I'd like to add that because partial animations (i.e. affecting only certain bones, not all) don't work too well (or at least they didn't last time I checked). For example, a running attack only animates the arm -- but the custom replacement will make the player move in near T-pose with only the arm moving, instead of blending the running animation with the arm movement.
-
If playerZ < getWaterLevel(playerX, playerY, playerZ)
-
Accounts and their related account data is stored in mods/deathmatch/internal.db, so if you just copy that file over to the new host and start up the server, you should be able to log in to accounts that were created on the old host, as well as all their data. All other internal SQL stuff that comes from executeSQLQuery is stored in mods/deathmatch/databases/global/registry.db so you might want to copy that one over too.
-
Can you clarify what you mean? What do you mean you "found" script, and what do you mean by "no menu" -- what menu are you expecting?
-
Why do people keep posting topics in other languages when they can see everything else in the section is in English? Ugh. Try here https://forum.multitheftauto.com/forum/97-portuguese-português/
-
The second snippet you shared appears to takePlayerMoney on the client-side, which is recommended. Do your exports support client-side calling? If not, you'll need to trigger a server event, which the server should handle, passing the amount of money to be charged, and call the exported functions then and there, on the server. If you can call your exports from the client, just put localPlayer as Player in your export parameters.