Jump to content

Whats wrong whit this? (tazer)


kevenvz

Recommended Posts

Hello, I am back again :P

Maybe you know me from my other tazer(I hated that one) I got now a new one.

I got 1 problem. I thinkj it is in the serverside system. I wanted a timer of the player animation. You know that he is laying down on the floor for 2 seconds. The problem is he don't do the animation. WHat is wrong whit this code???

Client side:

function tazer ( attacker, weapon ) 
    if (attacker) and (weapon == 24) then 
    triggerServerEvent ( "setAnim", source ) 
    cancelEvent() 
    end 
end 
addEventHandler ( "onClientPlayerDamage", getRootElement(), tazer ) 

server side:

function theAnim (  ) 
        setPedAnimation( source, "ped", "FLOOR_hit_f") 
end 
function setAnim (  ) 
    if not isPedInVehicle( player ) then 
        setTimer(theAnim, source, 2000, 1 ) 
    end 
end 
addEvent ( "setAnim", true ) 
addEventHandler ( "setAnim", getRootElement(), setAnim ) 

Thank you, ;)

Link to comment
function tazer ( attacker, weapon ) 
    if (attacker) and (weapon == 24) then 
    local source = getLocalPlayer() 
    triggerServerEvent ( "setAnim", source,source ) 
    cancelEvent() 
    end 
end 
addEventHandler ( "onClientPlayerDamage", getRootElement(), tazer ) 

server side:

function setAnim ( player ) 
    if not isPedInVehicle( player ) then 
        setTimer(setPedAnimation,2000,1, player,"ped", "FLOOR_hit_f") 
    end 
end 
addEvent ( "setAnim", true ) 
addEventHandler ( "setAnim", getRootElement(), setAnim ) 

Link to comment
  • 3 weeks later...
  • Discord Moderators

yes but isn't that because he extends the function with setTimer?

setTimer(theAnim, source, 2000, 1 ) 

secondly, he doesn't transfer any argument as player in the client>server trigger? The argument player in setAnim is void then

use source instead

addEvent ('setAnim', true) 
addEventHandler ('setAnim', root, 
    function () 
        setPedAnimation (source, 'ped', 'FLOOR_hit_f') 
    end 
) 

Link to comment

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...