Jump to content

Don't works


`Dmz

Recommended Posts

Posted

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)

Posted
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:

Posted
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)

Stats_Signature.php?name=Jason_Gregory
Contact me if you need a Website / Signature ↑ / Mapuploadsystem

(HTML5, JS, PHP, ASP.NET, MySQL / Sybase)

Posted (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 by Guest
Posted
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 ";" :)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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...