Jump to content

onElementModelChange


Recommended Posts

Posted
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 

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

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

 

Posted

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

Working thank you, how can i add more? Like 

Tried:

  1. local skinTable = {
  2. --[SKINID] = EXCEPTION
  3. [301] = 1
  4. [50] = 2
  5. [49] = 11
  6. }

its flooding the message xD

Edited by TheMOG
Posted

If you wanna enable the 50 (skinID) to the player whose account ID is 2, then you just do

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

 

  • Thanks 1

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