micheal1230 Posted June 16, 2012 Share Posted June 16, 2012 Well There Are No Errors But It Doesnt Work client: local localPlayer = getLocalPlayer() local gas = getElementData(localPlayer, "gasmask") function cancelTearGasChoking(weaponID, localPlayer) if (weaponID==17) and (gas==1) then cancelEvent() end end addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) client: -- Copyright of Fort Carson Roleplay © -- Script By haws1290 local playerHealth = getElementHealth ( getLocalPlayer() ) local localPlayer = getLocalPlayer() function BloodonDamage( attacker, weapon, bodypart ) if ( getElementHealth(localPlayer) < 20 ) then local x, y, z = getElementPosition( localPlayer ) fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) Link to comment
micheal1230 Posted June 16, 2012 Author Share Posted June 16, 2012 Well There Are No Errors But It Doesnt Workclient: local localPlayer = getLocalPlayer() local gas = getElementData(localPlayer, "gasmask") function cancelTearGasChoking(weaponID, localPlayer) if (weaponID==17) and (gas==1) then cancelEvent() end end addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) client: -- Copyright of Fort Carson Roleplay © -- Script By haws1290 local playerHealth = getElementHealth ( getLocalPlayer() ) local localPlayer = getLocalPlayer() function BloodonDamage( attacker, weapon, bodypart ) if ( getElementHealth(localPlayer) < 20 ) then local x, y, z = getElementPosition( localPlayer ) fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) anyone?????? Link to comment
Castillo Posted June 16, 2012 Share Posted June 16, 2012 -- Gas mask: function cancelTearGasChoking ( weaponID ) local gas = getElementData ( localPlayer, "gasmask" ) -- You have to get it inside the function. if ( weaponID == 17 ) and ( gas == 1 ) then cancelEvent ( ) end end addEventHandler ( "onClientPlayerChoke", localPlayer, cancelTearGasChoking ) About blood, I don't know what's wrong with it. Link to comment
micheal1230 Posted June 17, 2012 Author Share Posted June 17, 2012 Gas Script Still Does'nt Work, if i toss some gas and walk into it, it still puts me into the choke anim and takes my HP Link to comment
Castillo Posted June 17, 2012 Share Posted June 17, 2012 Well, I set "gasmask" data to 1 and it worked, I didn't get chocked. Link to comment
micheal1230 Posted June 17, 2012 Author Share Posted June 17, 2012 Well, I set "gasmask" data to 1 and it worked, I didn't get chocked. i did, i throw some tear gas onto the floor and walked into it and i started getting choked, what are you loading the script as? client? Link to comment
Castillo Posted June 17, 2012 Share Posted June 17, 2012 Of course, is a client side script. Link to comment
micheal1230 Posted June 17, 2012 Author Share Posted June 17, 2012 Of course, is a client side script. Fixed It But Now I Got Another Problem, It Doesnt setElementData to 0 for the mask and gas mask elseif (itemID==26) then -- GASMASK local gas = getElementData(source, "gasmask") if not (gas) or (gas==0) then exports.global:sendLocalMeAction(source, "slips a black gas mask over their face.") -- can't see their name local pid = getElementData(source, "playerid") local fixedName = "Unknown Person(Gas M)" setPlayerNametagText(source, tostring(fixedName)) setElementData(source, "gasmask", 1) exports['anticheat-system']:changeProtectedElementDataEx(source, "gasmask", 1, false) elseif (gas==1) then exports.global:sendLocalMeAction(source, "slips a black gas mask off their face.") -- can't see their name local pid = getElementData(source, "playerid") local name = string.gsub(getPlayerName(source), "_", " ") setPlayerNametagText(source, tostring(name)) setElementData(source, "gasmask", 0) exports['anticheat-system']:changeProtectedElementDataEx(source, "gasmask", 0, false) end elseif (itemID==56) then -- MASK local mask = getElementData(source, "mask") if not (mask) or (mask==0) then exports.global:sendLocalMeAction(source, "slips a mask over their face.") -- can't see their name local pid = getElementData(source, "playerid") local fixedName = "Unknown Person(Mask)" setPlayerNametagText(source, tostring(fixedName)) setElementData(source, "mask", 1) exports['anticheat-system']:changeProtectedElementDataEx(source, "mask", 1, false) elseif (mask==1) then exports.global:sendLocalMeAction(source, "slips a mask off their face.") -- can't see their name local pid = getElementData(source, "playerid") local name = string.gsub(getPlayerName(source), "_", " ") setPlayerNametagText(source, tostring(name)) setElementData(source, "mask", 0) exports['anticheat-system']:changeProtectedElementDataEx(source, "mask", 0, false) end Link to comment
top sniper Posted June 17, 2012 Share Posted June 17, 2012 Well There Are No Errors But It Doesnt Workclient: local localPlayer = getLocalPlayer() local gas = getElementData(localPlayer, "gasmask") function cancelTearGasChoking(weaponID, localPlayer) if (weaponID==17) and (gas==1) then cancelEvent() end end addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) client: -- Copyright of Fort Carson Roleplay © -- Script By haws1290 local playerHealth = getElementHealth ( getLocalPlayer() ) local localPlayer = getLocalPlayer() function BloodonDamage( attacker, weapon, bodypart ) if ( getElementHealth(localPlayer) < 20 ) then local x, y, z = getElementPosition( localPlayer ) fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) function BloodonDamage() if ( getElementHealth(source) < 20 ) then local x,y,z = getElementPosition( source ) fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) Link to comment
micheal1230 Posted June 17, 2012 Author Share Posted June 17, 2012 Well There Are No Errors But It Doesnt Workclient: local localPlayer = getLocalPlayer() local gas = getElementData(localPlayer, "gasmask") function cancelTearGasChoking(weaponID, localPlayer) if (weaponID==17) and (gas==1) then cancelEvent() end end addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) client: -- Copyright of Fort Carson Roleplay © -- Script By haws1290 local playerHealth = getElementHealth ( getLocalPlayer() ) local localPlayer = getLocalPlayer() function BloodonDamage( attacker, weapon, bodypart ) if ( getElementHealth(localPlayer) < 20 ) then local x, y, z = getElementPosition( localPlayer ) fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) function BloodonDamage() if ( getElementHealth(source) < 20 ) then local x,y,z = getElementPosition( source ) fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) You cant use source in a client side can you? Link to comment
TAPL Posted June 17, 2012 Share Posted June 17, 2012 Yes you can use source in client, but you need to change localPlayer to root. Read wiki it's said everything https://wiki.multitheftauto.com/wiki/OnC ... ayerDamage The source of this event is the player that got damaged. (Streamed in players only) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now