mcer Posted July 6, 2013 Share Posted July 6, 2013 function LowBloodAnim() local getplayer = getPlayerName(sourcePlayer) if getElementHealth ( sourcePlayer ) <= 20 then if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then setPedAnimation ( sourcePlayer, "crack", "crckidle1", -1, true, true, false ) end end end It's serverside. Link to comment
Castillo Posted July 6, 2013 Share Posted July 6, 2013 And how do you execute that function? and where's sourcePlayer defined? Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 Sourceplayer = Localplayer? Link to comment
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team Share Posted July 6, 2013 (edited) He is asking, how does that function execute..? With command? event?..Etc.. EDIT: You must define sourcePlayer.. Example: function say (sourcePlayer) end addCommandHandler ( "hello", say ) Edited July 6, 2013 by Guest Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 He is asking, how does that function execute..? With command? event?..Etc.. Command Link to comment
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team Share Posted July 6, 2013 function LowBloodAnim(sourcePlayer) local getplayer = getPlayerName(sourcePlayer) if getElementHealth ( sourcePlayer ) <= 20 then if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then setPedAnimation ( sourcePlayer, "crack", "crckidle1", -1, true, true, false ) end end end addCommandHandler ( "anim", LowBloodAnim ) Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 Look (Clientside). addEventHandler('onClientResourceStart',resourceRoot, function () Shocking1() end ) function Shocking1() setTimer ( function ( ) local anim = {getPedAnimation( localPlayer )} if getElementHealth ( localPlayer ) <= 20 then if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then addEventHandler("onClientRender", getRootElement(), ShockWinGui) setPedAnimation ( localPlayer, "crack", "crckidle1", -1, true, true, false ) end else if ( anim[1] == "crack" and anim[2] == "crckidle1" ) then setPedAnimation( localPlayer, false) removeEventHandler("onClientRender", getRootElement(), ShockWinGui) end end end,500,0 ) end It set the anim only for the client... The other players can't see it. Link to comment
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team Share Posted July 6, 2013 Well whats the problem there? Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 Well whats the problem there? I want it for serverside, But idk how. Link to comment
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team Share Posted July 6, 2013 addEventHandler('ResourceStart',resourceRoot, function () Shocking1() end ) function Shocking1() for i,v in ipairs(getElementsByType("player")) do setTimer ( function ( ) local anim = {getPedAnimation( v )} if getElementHealth ( v ) <= 20 then if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then setPedAnimation ( v, "crack", "crckidle1", -1, true, true, false ) end else if ( anim[1] == "crack" and anim[2] == "crckidle1" ) then setPedAnimation( v, false) end end end,500,0 ) end end It would be something like that,.Im from my cell, Maybe wrong somewhere,Try it..Anyway there are event handlers a bit strange there...Is it your script? Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 addEventHandler('ResourceStart',resourceRoot, function () Shocking1() end ) function Shocking1() for i,v in ipairs(getElementsByType("player")) do setTimer ( function ( ) local anim = {getPedAnimation( v )} if getElementHealth ( v ) <= 20 then if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then setPedAnimation ( v, "crack", "crckidle1", -1, true, true, false ) end else if ( anim[1] == "crack" and anim[2] == "crckidle1" ) then setPedAnimation( v, false) end end end,500,0 ) end end It would be something like that,.Im from my cell, Maybe wrong somewhere,Try it..Anyway there are event handlers a bit strange there...Is it your script? Don't work and no errors in Debugscript. Link to comment
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team Share Posted July 6, 2013 Copy it again Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 Copy it again Still not working. Link to comment
iPrestege Posted July 6, 2013 Share Posted July 6, 2013 It's client side so you'll not see other players. Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 It's client side so you'll not see other players. I know, that's why I want to do this serverside. Link to comment
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team Share Posted July 6, 2013 It's client side so you'll not see other players. I made it server side-Did you switch the type in the meta? Link to comment
mcer Posted July 6, 2013 Author Share Posted July 6, 2013 It's client side so you'll not see other players. I made it server side-Did you switch the type in the meta? Yes. Link to comment
iMr.3a[Z]eF Posted July 6, 2013 Share Posted July 6, 2013 getPedAnimation this function is ClientSide only Link to comment
iPrestege Posted July 6, 2013 Share Posted July 6, 2013 It's client side so you'll not see other players. I made it server side-Did you switch the type in the meta? You can't change it to server side read the code. Link to comment
mcer Posted July 7, 2013 Author Share Posted July 7, 2013 Okay, The post is ended. I recreated this for serverside. Thanks everyone!. 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