`Dmz Posted April 1, 2010 Share Posted April 1, 2010 Hi community, I have a problem whit this scrip, when I push right arrow server outputs this one. [15:51:16] WARNING: rpg.server.lua: Bad argument @ 'getElementModel' - Line: 39 [15:51:16] ERROR: ...rver/mods/deathmatch/resources/RPG-FR/rpg.server.lua:40: attempt to perform arithmetic on local 'skin' (a boolean value) function whatEver ( ) bindKey ( source, "right", "down", function () local plSkin = getPedSkin(source) local plSkin = skin+1 setPedSkin(source,skin) end ) addEventHandler("onPlayerLogin", getRootElement(), whatEver) Link to comment
karlis Posted April 1, 2010 Share Posted April 1, 2010 (edited) omg plSkin is not skin! function whatEver ( ) bindKey (source, "right", "down", function (player) local skin = getPedSkin(player) local skin = skin+1 setPedSkin(player,skin) end ) addEventHandler("onPlayerLogin", getRootElement(), whatEver) Edited April 1, 2010 by Guest Link to comment
`Dmz Posted April 1, 2010 Author Share Posted April 1, 2010 omg plSkin is not skin! function whatEver ( ) bindKey ( source, "right", "down", function () local skin = getPedSkin(source) local skin = skin+1 setPedSkin(source,skin) end ) addEventHandler("onPlayerLogin", getRootElement(), whatEver) I've made this mistake writing the post, sorry, but it doesn't work to. Link to comment
Jason_Gregory Posted April 1, 2010 Share Posted April 1, 2010 function whatEver ( ) bindKey (source, "right", "down", function (player) local skin = getPedSkin(player) local skin = skin+1 while setPedSkin(player,skin) ~= false do skin=skin+1 if(skin > 290)then --Should be the Maximum Skinid skin = 0 end end end ) addEventHandler("onPlayerLogin", getRootElement(), whatEver) Link to comment
karlis Posted April 1, 2010 Share Posted April 1, 2010 (edited) litle fix: function whatEver ( ) bindKey (source, "right", "down", function (player) local skin = getPedSkin(player)+1 while not setPedSkin(player,skin) do skin=skin+1 % 290 end end ) end addEventHandler("onPlayerLogin", getRootElement(), whatEver) also, if you didnt know: a % b = a - math.floor ( b / a ) * b this is much more compact than "if x>y then.."" Edited April 2, 2010 by Guest Link to comment
50p Posted April 2, 2010 Share Posted April 2, 2010 You shouldn't declare the same variable twice. It's confusing for reader (including author). Link to comment
50p Posted April 2, 2010 Share Posted April 2, 2010 wut u mean? local skin = 1; local skin = skin + 1; Link to comment
karlis Posted April 2, 2010 Share Posted April 2, 2010 k alrdy fixed, btw i dont get why u use ";", it only spends size Link to comment
dzek (varez) Posted April 2, 2010 Share Posted April 2, 2010 k alrdy fixed, btw i dont get why u use ";", it only spends size almost every programming language (i dont know every, but a lot) uses ";" .. probably he used to press ";" 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