Jump to content

onElementModelChange


Recommended Posts

5 hours ago, NeXuS™ said:

Do you wanna create a script, which block skins for everyone except some users?

Yes for accountID.

Example: My accountID is 1, and i want to add 303 skinID only for my account. So if anybody have that skin, the script change that to 0 

Link to comment
local skinTable = {
	--[SKINID] = EXCEPTION
	[301] = 1
}

addEventHandler("onElementModelChange", getRootElement(), function(oldModel)
	local newModel = getElementModel(source)
	if skinTable[newModel] then
		if getElementData(source, "acc.accID") ~= skinTable[newModel] then
			setElementModel(source, oldModel)
			outputChatBox("That model is prohibited to all users except one.", source)
		end
	end
end)

Try this one out.

Link to comment
13 hours ago, NeXuS™ said:

local skinTable = {
	--[SKINID] = EXCEPTION
	[301] = 1
}

addEventHandler("onElementModelChange", getRootElement(), function(oldModel)
	local newModel = getElementModel(source)
	if skinTable[newModel] then
		if getElementData(source, "acc.accID") ~= skinTable[newModel] then
			setElementModel(source, oldModel)
			outputChatBox("That model is prohibited to all users except one.", source)
		end
	end
end)

Try this one out.

Hmm.. Now this working without any debug error, but i can still have the skin. 

Tried to set the skin instant 1, but didnt work.

local skinTable = {
    --[SKINID] = EXCEPTION
    [301] = 1
}

addEventHandler("onElementModelChange", getRootElement(), function(oldModel)
    local newModel = getElementModel(source)
    if skinTable[newModel] then
        if getElementData(source, "acc.accID") ~= skinTable[newModel] then
            iprint("ez a skinID accountID -re van védve")
            setElementModel(source,1)
        end
    end
end)

 

Link to comment

Does it output the message?

Adding a timer made the whole thing work.

local skinTable = {
	--[SKINID] = EXCEPTION
	[301] = 1
}

addEventHandler("onElementModelChange", getRootElement(), function(oldModel)
	local newModel = getElementModel(source)
	if skinTable[newModel] then
		if getElementData(source, "acc.accID") ~= skinTable[newModel] then
			outputChatBox("That model is prohibited to all users except one.", source)
			setTimer(setElementModel, 50, 1, source, oldModel)
		end
	end
end)

 

  • Thanks 1
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...