ZeyadGTX Posted September 16, 2014 Share Posted September 16, 2014 Hello i tried to add fightingStyle in Freeroam but i failed that's what i did Fr_client.lua --------------------------- -- Fighting style window --------------------------- wndFighting = { 'wnd', text = 'Set Fighting style', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='fighting', width=230, height=290, columns={ {text='style', attr='name'} }, rows={xml='fighting.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyFightingStyle }, {'btn', id='Set', onclick=applyFightingStyle}, {'btn', id='Close', closeswindow=true} } } addCommandHandler('setstyle', function(cmd, style) style = style and tonumber(style) if style then server.setPedFightingStyle(g_Me, style) end end ) Meta.xml "fighting.xml" type="client" /> fighting.xml type="style"> Also the button added {'btn', id='Fighting Style', window=wndFighting}, Link to comment
Anubhav Posted September 16, 2014 Share Posted September 16, 2014 (edited) --------------------------- -- Fighting style window --------------------------- wndFighting = { 'wnd', text = 'Set Fighting style', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='fighting', width=230, height=290, columns={ {text='style', attr='name'} }, rows={xml='fighting.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyFightingStyle }, {'btn', id='Set', onclick=applyFightingStyle}, {'btn', id='Close', closeswindow=true} } } local numbers = { 4, 5, 6, 7, 15, 16 } addCommandHandler('setstyle', function(s, cmd, style) style = style or tonumber(style) outputed = false for k,v in ipairs(numbers) do if style =~ nil and style =~ false and style == v and not outputed then setPedFightingStyle(s, style) else outputed = true return outputChatBox("Invalid fighting style ID or not entered. Valid fighting id's: 4, 5, 6, 7, 15, 16!", s) end end end ) Edited September 16, 2014 by Guest Link to comment
ZeyadGTX Posted September 16, 2014 Author Share Posted September 16, 2014 --------------------------- -- Fighting style window --------------------------- wndFighting = { 'wnd', text = 'Set Fighting style', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='fighting', width=230, height=290, columns={ {text='style', attr='name'} }, rows={xml='fighting.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyFightingStyle }, {'btn', id='Set', onclick=applyFightingStyle}, {'btn', id='Close', closeswindow=true} } } addCommandHandler('setstyle', function(s, cmd, style) style = style or tonumber(style) if style then setPedFightingStyle(s, style) end end ) Isn't there another problems in fighting.xml or adding lines to fr_server.lua ? Link to comment
ZeyadGTX Posted September 16, 2014 Author Share Posted September 16, 2014 not working look my whole fr_client CONTROL_MARGIN_RIGHT = 5 LINE_MARGIN = 5 LINE_HEIGHT = 16 g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Me = getLocalPlayer() server = createServerCallInterface() guiSetInputMode("no_binds_when_editing") --------------------------- -- Set skin window --------------------------- function skinInit() setControlNumber(wndSkin, 'skinid', getElementModel(g_Me)) end function showSkinID(leaf) if leaf.id then setControlNumber(wndSkin, 'skinid', leaf.id) end end function applySkin() local skinID = getControlNumber(wndSkin, 'skinid') if skinID then server.setMySkin(skinID) fadeCamera(true) end end wndSkin = { 'wnd', text = 'Set skin', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='skinlist', width=230, height=290, columns={ {text='Skin', attr='name'} }, rows={xml='skins.xml', attrs={'id', 'name'}}, onitemclick=showSkinID, onitemdoubleclick=applySkin }, {'txt', id='skinid', text='', width=50}, {'btn', id='set', onclick=applySkin}, {'btn', id='close', closeswindow=true} }, oncreate = skinInit } function setSkinCommand(cmd, skin) skin = skin and tonumber(skin) if skin then server.setMySkin(skin) fadeCamera(true) closeWindow(wndSpawnMap) closeWindow(wndSetPos) end end addCommandHandler('setskin', setSkinCommand) addCommandHandler('ss', setSkinCommand) --------------------------- --- Set animation window --------------------------- function applyAnimation(leaf) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndAnim, 'animlist') if not leaf then return end end server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true) end function stopAnimation() server.setPedAnimation(g_Me, false) end wndAnim = { 'wnd', text = 'Set animation', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='animlist', width=230, height=290, columns={ {text='Animation', attr='name'} }, rows={xml='animations.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyAnimation }, {'btn', id='set', onclick=applyAnimation}, {'btn', id='stop', onclick=stopAnimation}, {'btn', id='close', closeswindow=true} } } addCommandHandler('anim', function(command, lib, name) server.setPedAnimation(g_Me, lib, name, true, true) end ) --------------------------- -- Walking Style Window --------------------------- function applyWalkStyle( leaf ) if type( leaf ) ~= 'table' then leaf = getSelectedGridListLeaf( wndWalking, 'walkStyle' ) if not leaf then return end end server.setPedWalkingStyle( g_Me, leaf.id ) end function stopWalkStyle() server.setPedWalkingStyle( g_Me, 0 ) end wndWalking = { 'wnd', text = 'Walking style', width = 250, controls = { { 'lst', id = 'walkStyle', width = 230, height = 290, columns = { { text = 'Walking', attr = 'name' } }, rows = { xml = 'walkstyle.xml', attrs = { 'id', 'name' } }, onitemdoubleclick = applyWalkStyle }, { 'btn', id = 'set', onclick = applyWalkStyle }, { 'btn', id = 'stop', onclick = stopWalkStyle }, { 'btn', id = 'close', closeswindow = true } } } function setWalkStyleCommand( cmd, id ) id = id and tonumber( id ) if id then server.setPedWalkingStyle( id ) end end addCommandHandler( 'setwalkstyle', setWalkStyleCommand ) addCommandHandler( 'walkstyle', setWalkStyleCommand ) --------------------------- -- Weapon window --------------------------- function addWeapon(leaf, amount) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf then return end end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Give weapon', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Weapon', attr='name'} }, rows={xml='weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='add', onclick=addWeapon}, {'btn', id='close', closeswindow=true} } } function giveWeaponCommand(cmd, weapon, amount) weapon = tonumber(weapon) or getWeaponIDFromName(weapon) if not weapon then return end amount = amount and tonumber(amount) or 500 server.giveMeWeapon(math.floor(weapon), amount) end addCommandHandler('give', giveWeaponCommand) addCommandHandler('wp', giveWeaponCommand) --------------------------- -- Fighting style window --------------------------- wndFighting = { 'wnd', text = 'Set Fighting style', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='fighting', width=230, height=290, columns={ {text='style', attr='name'} }, rows={xml='fighting.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyFightingStyle }, {'btn', id='Set', onclick=applyFightingStyle}, {'btn', id='Close', closeswindow=true} } } addCommandHandler('setstyle', function(s, cmd, style) style = style or tonumber(style) if style then setPedFightingStyle(s, style) end end ) Link to comment
-.Paradox.- Posted September 16, 2014 Share Posted September 16, 2014 setPedFightingStyle is server side Link to comment
ZeyadGTX Posted September 16, 2014 Author Share Posted September 16, 2014 my sv side @ setPedFightingStyle = { option = 'style', descr = 'Setting fighting style' }, Link to comment
Anubhav Posted September 16, 2014 Share Posted September 16, 2014 First of all, Why should we do it? You are not telling us errors even. You are only posting codes and letting us do everything. 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