Tycka Posted October 8, 2014 Posted October 8, 2014 Code: function getSkinIDFromName(name) for i, skin in ipairs(skinTable) do if name == skin[1] then return skin[2] end end end function getSkinNameFromID(id) for i, skin in ipairs(skinTable) do if id == skin[2] then return skin[1] end end end function addPlayerSkin(skin) local current = getElementData(source, "skin") local name = getSkinNameFromID(current) setElementData(source, name, getElementData(source, name) + 1) setElementData(source, skin, getElementData(source, skin) - 1) local id = getSkinIDFromName(skin) setElementData(source, "skin", id) setElementModel(source, id) triggerClientEvent(source, "refreshInventoryManual", source) end addEvent("onPlayerChangeSkin", true) addEventHandler("onPlayerChangeSkin", getRootElement(), addPlayerSkin) Error: [2014-10-07 22:58:46] WARNING: [DayZ-MTA]\DayZ\survivorSystem.lua:892: Bad argument @ 'getElementData' [Expected string at argument 2, got nil] [2014-10-07 22:58:46] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:892: attempt to perform arithmetic on a boolean value [2014-10-07 22:58:46] WARNING: [DayZ-MTA]\DayZ\survivorSystem.lua:892: Bad argument @ 'getElementData' [Expected string at argument 2, got nil] [2014-10-07 22:58:46] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:892: attempt to perform arithmetic on a boolean value Dayz (y)
n3wage Posted October 8, 2014 Posted October 8, 2014 That should Work: function getSkinIDFromName(name) for i, skin in ipairs(skinTable) do if name == skin[1] then return skin[2] end end end function getSkinNameFromID(id) for i, skin in ipairs(skinTable) do if id == skin[2] then return skin[1] end end end function addPlayerSkin(skin) local current = getElementData(source, "skin") local name = getSkinNameFromID(current) setElementData(source, "name", getElementData(source, "name") + 1) setElementData(source, "skin", getElementData(source, "skin") - 1) local id = getSkinIDFromName(skin) setElementData(source, "skin", id) setElementModel(source, id) triggerClientEvent(source, "refreshInventoryManual", source) end addEvent("onPlayerChangeSkin", true) addEventHandler("onPlayerChangeSkin", getRootElement(), addPlayerSkin)
Tycka Posted October 8, 2014 Author Posted October 8, 2014 Error line: setElementData(source, "name", getElementData(source, "name") + 1) Error: ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:893: attempt to perform arithmetic on a boolean value Dayz (y)
Anubhav Posted October 8, 2014 Posted October 8, 2014 Don't get it risky for players! Always use client at triggers! function getSkinIDFromName(name) for i, skin in ipairs(skinTable) do if name == skin[1] then return skin[2] end end end function getSkinNameFromID(id) for i, skin in ipairs(skinTable) do if id == skin[2] then return skin[1] end end end function addPlayerSkin(skin) local current = getElementData(client, "skin") or 0 local name = getSkinNameFromID(current) or "CJSkin" setElementData(source, name, getElementData(client, name) + 1) setElementData(source, skin, getElementData(client, skin) - 1) local id = getSkinIDFromName(skin) setElementData(client, "skin", id) setElementModel(client, id) triggerClientEvent(source, "refreshInventoryManual", source) end addEvent("onPlayerChangeSkin", true) addEventHandler("onPlayerChangeSkin", getRootElement(), addPlayerSkin) See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Castillo Posted October 9, 2014 Posted October 9, 2014 What is the error? and in which line of the code? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Tycka Posted October 10, 2014 Author Posted October 10, 2014 What is the error? and in which line of the code? Error line: setElementData(source, "name", getElementData(source, "name") + 1) Error: ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:893: attempt to perform arithmetic on a boolean value FIXED. Dayz (y)
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