-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
"onClientPlayerDamage" setElementHealth
-
http://s6.dosya.tc/server9/ssefpp/hs.zip.html Working.
-
Send me the full script in a zip file. Your poor debug skills are getting the better of me, looking at the freaking debug console isn't enough.
-
restarted the resource? And: headshotDamage = 200?
-
If it sets your health to 90, then you still haven't set the 90 to 0. local newHealth = math.max(playerOriginalHealth - headshotDamage, 0) ...
-
I did test the code without this part: if not ( bodypart == 9 ) then return false end -- check if the player has been hit in the head if not attacker or not ( getElementType( attacker ) == "player" ) then return false end -- check if the attacker is a player Just to check if it is working (because I didn't have a dummy to test it on). It did work. If you disable that, will it give you an insta-kill when you receive any damage? If not, then you have :Oed it up somewhere along the way.
-
You edited line 7, that is a bit sloppy of you. If you put that to 90, the health can never be lower than 90. If you want it to work, change it back to the code I gave you. My code: local newHealth = math.max(playerOriginalHealth - headshotDamage, 0) Your code: local newHealth = math.max(playerOriginalHealth - headshotDamage, 90)
-
yea, that explains a lot. Run the script clientside, not serverside. Make a backup of the meta.xml (so can mess it up) Open the meta.xml <script src="scriptName.lua" /> change to: <script src="scriptName.lua" type="client"/> Restart the resource.
-
function onPlayerHeadshot( attacker, _, bodypart, loss ) if not ( bodypart == 9 ) then return false end -- check if the player has been hit in the head if not attacker or not ( getElementType( attacker ) == "player" ) then return false end -- check if the attacker is a player local playerOriginalHealth = getElementHealth( source ) + loss -- get the player's original health local newHealth = math.max(playerOriginalHealth - headshotDamage, 0) setElementHealth( localPlayer, newHealth) -- set the player's new health iprint("playerOriginalHealth:", playerOriginalHealth, ", newHealth:", newHealth) end addEventHandler( "onClientPlayerDamage", localPlayer, onPlayerHeadshot ) debug it and show results.
-
function onPlayerHeadshot( attacker, _, bodypart, loss ) if not ( bodypart == 9 ) then return false end -- check if the player has been hit in the head if not ( getElementType( attacker ) == "player" ) then return false end -- check if the attacker is a player local playerOriginalHealth = getElementHealth( source ) + loss -- get the player's original health local newHealth = math.max(playerOriginalHealth - headshotDamage, 0) setElementHealth( localPlayer, newHealth) -- set the player's new health end addEventHandler( "onClientPlayerDamage", localPlayer, onPlayerHeadshot )
-
Try harder. You are not coding at the moment, you are simple moving lines.
-
Did you? You should have warnings/errors at the moment, so I don't think so. Replace line 8 with line 1 and 2. (of your updated code) Replace line 12 with the line that looks similar. (from my code) And show the updated code.
-
[PLEASE HELP]dxDrawMaterialLine3D and dxDrawText
IIYAMA replied to MysticEmpire's topic in Scripting
There is already an example on wiki, which only require copy past. -
I am talking about this: local selectWidth = 300 local selectHeight = 100 But if that doesn't work, there is also: https://wiki.multitheftauto.com/wiki/DxSetShaderTransform Which I prefer if it is UI. Shader needed for this? (most simple possible shader can be used) texture gTexture; technique IIYAMA { pass P0 { Texture[0] = gTexture; } }
-
function onPlayerHeadshot( attacker, _, bodypart, loss ) local playerOriginalHealth = getElementHealth( source ) + loss -- get the player's original health local newHealth = math.max(playerHealth - headshotDamage, 0) setElementHealth( localPlayer, newHealth) -- set the player's new health You have to add the loss back to get the original health. In this case it doesn't really matter since the damage is 200, but if you want to use values lower than 200, you will need to add that. If you put the health under 0, it will do strange things.(reset etc.) addEventHandler( "onClientPlayerDamage", localPlayer, onPlayerHeadshot ) You can't set other players their health with success, only that one of the localPlayer. So we only have to check the localPlayer. cancelEvent() No need for cancelling. Keep in mind that this can get bugged under strange occasions. Because of the GTA engine. If this doesn't work, post the updated code.
-
How about increasing the resolution of the captured area?
-
[PLEASE HELP]dxDrawMaterialLine3D and dxDrawText
IIYAMA replied to MysticEmpire's topic in Scripting
Render both as 2D. Then capture them with a render target. https://wiki.multitheftauto.com/wiki/DxCreateRenderTarget And as last render the rendertarget(image/texture format) in 3D. -
[PLEASE HELP]dxDrawMaterialLine3D and dxDrawText
IIYAMA replied to MysticEmpire's topic in Scripting
Your order: spaghetti with marinara sauce + egg noodles and ketchup is not ready yet, I am terrible sorry. I have no clue what you want. -
Check if onClientPlayerDamage gets cancelled. @Dziugasc Weapon properties do not work for fire or explosions. The damage of those effects are indirect and aren't attached to the weapons in your hand.
-
Setting the sniper at 100 damage will not do 100 damage. There is a multiplier that will give different damage results to players/peds, objects and vehicles. For example ~130 will do 50 damage to a player. (can't remember the exact values) So set the damage at 1000 or even 10000. I assume you use: setWeaponProperty
-
after randomize it, save the last result in a variable. With the next randomization you will have to check if the new value is not the same as the old one. local lastRandomResult local randomResult repeat randomResult = math.random() until lastRandomResult ~= randomResult lastRandomResult = randomResult
- 1 reply
-
- 1
-
-
local ox = getElementData(vehicle, "gear_f") -- ox can be used after here if ox then -- isn't it false or nil? end getElementData has a different syntax than setElementData. Check wiki pls.
