Jump to content

help with triggerEvent


swag_k_dog

Recommended Posts

Posted (edited)

I wanted to script a ped, and negate the damage he takes, but I got it wrong..

server:

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()),
	function()
        local batped = createPed(30, 2767.5, -1617, 11)
        setElementRotation(batped, 0, 0, -45)
        setTimer(setPedAnimation,500,1,batped, "dildo", "dildo_idle")
        setTimer(giveWeapon,500,1,batped, 5, 1, true)
		triggerClientEvent("onClientPedDamage", resourceRoot)
	end
) 

and client:

addEvent("onClientPedDamage", true)
addEventHandler("onClientPedDamage", getRootElement(),
function()
cancelEvent()
end
)

whats the problem?

Edited by swag_k_dog
Posted

use this client side

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        batped = createPed(30,  2767.5, -1617, 11)
        setElementRotation(batped, 0, 0, -45)
        setTimer(setPedAnimation,500,1,batped, "dildo", "dildo_idle")
        setTimer(givePedWeapon,500,1,batped, 5, 1, true)
        addEventHandler ( "onClientPedDamage", batped, cancelPedDamage)
    end
) 

function cancelPedDamage ()
    if source == batped then 
        cancelEvent() 
    end
end 

 

  • Like 1

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
1 minute ago, Walid said:

use this client side


addEventHandler("onClientResourceStart", resourceRoot,
    function()
        batped = createPed(30,  2767.5, -1617, 11)
        setElementRotation(batped, 0, 0, -45)
        setTimer(setPedAnimation,500,1,batped, "dildo", "dildo_idle")
        setTimer(givePedWeapon,500,1,batped, 5, 1, true)
        addEventHandler ( "onClientPedDamage", batped, cancelPedDamage)
    end
) 

function cancelPedDamage ()
    if source == batped then 
        cancelEvent() 
    end
end 

 

Thanks for all the help. you're always here when I need you :D damn, scripting is getting more interesting now

Posted
1 minute ago, swag_k_dog said:

Thanks for all the help. you're always here when I need you :D damn, scripting is getting more interesting now

np

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...