Jump to content

cancelEvent


TorNix~|nR

Recommended Posts

Posted (edited)

Guys, I need help on this little script!

I want a cancelEvent when the skin id is: 308

function tt()
			triggerServerEvent( "setplayermask", localPlayer, "zombie") 
						if getElementModel( source ) == 308 then
			cancelEvent()
			end
end
addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), tt)

 

Edited by TorNix~|nR
  • Moderators
Posted

Is(And to which skin afterwards?) OR on skin changed?

Your code doesn't make sense and should be serverside to prevent de-sync.

 

 

Posted
function maske_ekle(name)
		if obje[source] then
		destroyElement(obje[source])
		end
local objeid = maskTable[name][1]
local bodyattach = maskTable[name][2]
local zROT = maskTable[name][3]
obje[source] = createObject ( objeid, 0, 0, 0, 0, 0, 0 )
exports.bone_attach:attachElementToBone(obje[source],source,bodyattach,0,0,-0.61,0,0,zROT)
  if getElementModel( source ) == 308 then
    cancelEvent()
end    
end 
addEvent("setplayermask",true) 
addEventHandler("setplayermask", root, maske_ekle) 

this is the server-side

  • Moderators
Posted (edited)

The event you cancelled has no relationship with changing the skin, so that will not work.

 

Use, over cancelEvent().

setElementModel( source, 0 )

 

 

And this part is incorrect:

function tt()

triggerServerEvent( "setplayermask", localPlayer, "zombie")

if getElementModel( source ) == 308 then

cancelEvent()

end

end

addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), tt)

Edited by IIYAMA

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