Jump to content

Don't works


`Dmz

Recommended Posts

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

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 by Guest
Link to comment
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, :D but it doesn't work to. :cry:

Link to comment
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

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 by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...