MOHAMMEDKM Posted July 10, 2015 Share Posted July 10, 2015 help i want my player do anim in selected place like when you press h in selected place player do anim Link to comment Share on other sites More sharing options...
Amey.Banaye Posted July 10, 2015 Share Posted July 10, 2015 player.Task.PlayAnimation("[email protected][email protected]@", "idle_a", 8f, 5, false, 1.0f); Link to comment Share on other sites More sharing options...
MOHAMMEDKM Posted July 10, 2015 Author Share Posted July 10, 2015 thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z) Link to comment Share on other sites More sharing options...
qwerasdzxc Posted July 10, 2015 Share Posted July 10, 2015 thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z)I guess you can just teleport the player to the x,y,z location and instantly play the animation.. Don't know any other way this can be done. Link to comment Share on other sites More sharing options...
Amey.Banaye Posted July 11, 2015 Share Posted July 11, 2015 thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z) Teleport the player using player.Position = your desired location; Link to comment Share on other sites More sharing options...
Colata Posted July 11, 2015 Share Posted July 11, 2015 thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z) just make a trigger bool ifplayerisatxyz = false; then make a float float wheretheplayertriggerstheanimation = world.getdistance(player.position, "INPUT YOUR VECTOR 3 HERE"); if (whenanimationplays < "HOW FAR PLAYER CAN BE BEFORE IT PLAYS") { ifplayerisatxyz = true; } then another if statement if (ifplayerisatxyz) { player.Task.PlayAnimation } that's how i'd do it at least, if you're trying to make the animation play at Vector 3 cords, probably not the best way, mind you. Link to comment Share on other sites More sharing options...
MOHAMMEDKM Posted July 11, 2015 Author Share Posted July 11, 2015 thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z) Teleport the player using player.Position = your desired location; thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z) I guess you can just teleport the player to the x,y,z location and instantly play the animation.. Don't know any other way this can be done. thank's but i don't went to teleport the player in my mod . Link to comment Share on other sites More sharing options...
MOHAMMEDKM Posted July 11, 2015 Author Share Posted July 11, 2015 thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z) just make a trigger bool ifplayerisatxyz = false; then make a float float wheretheplayertriggerstheanimation = world.getdistance(player.position, "INPUT YOUR VECTOR 3 HERE"); if (whenanimationplays < "HOW FAR PLAYER CAN BE BEFORE IT PLAYS") { ifplayerisatxyz = true; } then another if statement if (ifplayerisatxyz) { player.Task.PlayAnimation } that's how i'd do it at least, if you're trying to make the animation play at Vector 3 cords, probably not the best way, mind you. thank's but i gut error's when i try the code: float wheretheplayertriggerstheanimation = GTA.World.GetDistance(GTA.Game.Player.Character.Position,(x,z,y);// errorif (whenanimationplays < "HOW FAR PLAYER CAN BE BEFORE IT PLAYS")// idon't under stand{ifplayerisatxyz = true;}if (ifplayerisatxyz){Game.Player.Character.Task.PlayAnimation("anim", "group", 8f, -1, true, -1f);}}}} help me Link to comment Share on other sites More sharing options...
lulzmodder Posted July 11, 2015 Share Posted July 11, 2015 (edited) bool isPlayerInRange(Ped ped, Vector3& position, float radius){ Vector3 pos1; pos1 = ENTITY::GET_ENTITY_COORDS(ped, TRUE); float dist = GAMEPLAY::GET_DISTANCE_BETWEEN_COORDS(pos1.x, pos1.y, pos1.z, position.x, position.y, position.z, TRUE); if(dist <= radius) return true; return false;}void playAnimInRange(){ Vector3 coord; coord.x = 0.f; //set it to your needs coord.y = 0.f; //set it to your needs coord.z = 0.f; //set it to your needs float rad = 10.f; //set the radius to your needs, as well. if(isPlayerInRange(GAMEPLAY::PLAYER_PED_ID(), coords, rad)) { //play animation }} Try it. Though, I made it in a hurry. Edited July 11, 2015 by lulzmodder Link to comment Share on other sites More sharing options...
MOHAMMEDKM Posted July 11, 2015 Author Share Posted July 11, 2015 bool isPlayerInRange(Ped ped, Vector3& position, float radius){ Vector3 pos1; pos1 = ENTITY::GET_ENTITY_COORDS(ped, TRUE); float dist = GAMEPLAY::GET_DISTANCE_BETWEEN_COORDS(pos1.x, pos1.y, pos1.z, position.x, position.y, position.z, TRUE); if(dist <= radius) return true; return false;}void playAnimInRange(){ Vector3 coord; coord.x = 0.f; //set it to your needs coord.y = 0.f; //set it to your needs coord.z = 0.f; //set it to your needs float rad = 10.f; //set the radius to your needs, as well. if(isPlayerInRange(GAMEPLAY::PLAYER_PED_ID(), coords, rad)) { //play animation }} Try it. Though, I made it in a hurry. i gut errors give me sample Link to comment Share on other sites More sharing options...
lulzmodder Posted July 11, 2015 Share Posted July 11, 2015 I assume that you converted the code into c sharp. What errors you get? Link to comment Share on other sites More sharing options...
Colata Posted July 13, 2015 Share Posted July 13, 2015 (edited) thank's but i used this code to play anim but my problem i don't how to do anim in selected place (x,y,z) just make a trigger bool ifplayerisatxyz = false; then make a float float wheretheplayertriggerstheanimation = world.getdistance(player.position, "INPUT YOUR VECTOR 3 HERE"); if (whenanimationplays < "HOW FAR PLAYER CAN BE BEFORE IT PLAYS") { ifplayerisatxyz = true; } then another if statement if (ifplayerisatxyz) { player.Task.PlayAnimation } that's how i'd do it at least, if you're trying to make the animation play at Vector 3 cords, probably not the best way, mind you. thank's but i gut error's when i try the code: float wheretheplayertriggerstheanimation = GTA.World.GetDistance(GTA.Game.Player.Character.Position,(x,z,y);// errorif (whenanimationplays < "HOW FAR PLAYER CAN BE BEFORE IT PLAYS")// idon't under stand{ifplayerisatxyz = true;}if (ifplayerisatxyz){Game.Player.Character.Task.PlayAnimation("anim", "group", 8f, -1, true, -1f);}}}} help me You need to replace parts. where i say: float wheretheplayertriggerstheanimation = GTA.World.GetDistance(GTA.Game.Player.Character.Position,(x,z,y);// error You replace (x,y,z) with your trigger location in the world. Edited July 13, 2015 by Colata Link to comment Share on other sites More sharing options...
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