mcer Posted July 6, 2013 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.
Castillo Posted July 6, 2013 Posted July 6, 2013 And how do you execute that function? and where's sourcePlayer defined?
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team 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
mcer Posted July 6, 2013 Author Posted July 6, 2013 He is asking, how does that function execute..? With command? event?..Etc.. Command
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team 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 )
mcer Posted July 6, 2013 Author 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.
mcer Posted July 6, 2013 Author Posted July 6, 2013 Well whats the problem there? I want it for serverside, But idk how.
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team 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?
mcer Posted July 6, 2013 Author 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.
mcer Posted July 6, 2013 Author 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.
MTA Team 0xCiBeR Posted July 6, 2013 MTA Team 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?
mcer Posted July 6, 2013 Author 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.
iPrestege Posted July 6, 2013 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.
mcer Posted July 7, 2013 Author Posted July 7, 2013 Okay, The post is ended. I recreated this for serverside. Thanks everyone!.
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