thund3rbird23 Posted September 5, 2019 Posted September 5, 2019 I want to use the "bom_plan" animation (https://wiki.multitheftauto.com/wiki/Animations#bomber) but doesn't work. function Test(thePlayer) setPedAnimation(thePlayer, "ped", "bom_plan", -1, false, false, false, false) end addCommandHandler("xy", Test)
and. Posted September 5, 2019 Posted September 5, 2019 function Test(thePlayer) setPedAnimation(thePlayer, "bomber", "bom_plan", -1, false, false, false, false) end addCommandHandler("xy", Test) try this
thund3rbird23 Posted September 5, 2019 Author Posted September 5, 2019 Does nothing if I type xy in the console. So the first one which was "ped" in my comment is the main animation name if I'm correct?
AlvarO Posted September 5, 2019 Posted September 5, 2019 Try this: function test(thePlayer) local targetPlayer = getPlayerFromName (thePlayer) if targetPlayer then setPedAnimation(targetPlayer, "ped", "bom_plan", -1, false, false, false, false) else outputChatBox("Error, we can't find a player with that name!") end end addCommandHandler("xy", test) You should write the command as this: /xy <playerName>
thund3rbird23 Posted September 5, 2019 Author Posted September 5, 2019 It's just say "Error, we can't find a player with that name!"
AlvarO Posted September 5, 2019 Posted September 5, 2019 I modified what I wrote for you, and found that the problem is the animation, tried other one and works fine, here you have the code: function test(player, cmd, target) local targetPlayer = getPlayerFromPartialName(target) if targetPlayer then setPedAnimation(targetPlayer, "ped", "WOMAN_walknorm") else outputChatBox("Sorry, we don't know a person called " .. target, player, 255, 0, 0) end end addCommandHandler("xy", test) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end
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