Jump to content

HELP TOYS SYSTEM


roddydennvor

Recommended Posts

hello,

How to edit this script so when i click mask in my inventory then play this script ?

I mean, so I do not have to type /mask to run this script ... but when I click the guitar in my inventory, then this script will run?

  
local cases = {} 
  
for i,v in ipairs(getElementsByType("player"))do 
setElementData(v, "mask", 0) 
end 
  
addCommandHandler("mask", 
    function(player) 
        if(getResourceState(getResourceFromName("bone_attach")) == "running")then 
            if(getElementType(player) == "player")then 
                if(getElementData(player, "mask") ~= 1)then 
                    setElementData(player, "mask", 1) 
                    case = createObject(2053,0,0,0) 
                    exports.bone_attach:attachElementToBone(case,player,1,0,0,-0.6,0,0,90) 
                    cases[player] = case 
                elseif(getElementData(player, "mask") == 1)then 
                    setElementData(player, "mask", 0) 
                    exports.bone_attach:detachElementFromBone(cases[player]) 
                    destroyElement(cases[player]) 
                end 
            end 
        else 
            outputChatBox("ERROR #1", player, 255, 50, 0) 
        end 
    end 
) 
  

Link to comment

so i must to change this script like this ??

  
if (itemID==17) then 
local cases = {} 
  
for i,v in ipairs(getElementsByType("player"))do 
setElementData(v, 0) 
end 
  
addEventHandler("onClientGUIClick", 
    function(player) 
        if(getResourceState(getResourceFromName("bone_attach")) == "running")then 
            if(getElementType(player) == "player")then 
                if(getElementData(player, "mask") ~= 1)then 
                    setElementData(player, "mask", 1) 
                    case = createObject(2053,0,0,0) 
                    exports.bone_attach:attachElementToBone(case,player,1,0,0,-0.6,0,0,90) 
                    cases[player] = case 
                elseif(getElementData(player, "mask") == 1)then 
                    setElementData(player, "mask", 0) 
                    exports.bone_attach:detachElementFromBone(cases[player]) 
                    destroyElement(cases[player]) 
                end 
            end 
        else 
            outputChatBox("ERROR #1", player, 255, 50, 0) 
        end 
    end 
end 
) 
  

Not Work :(

Link to comment

I'm so confused, what should I fill in that server side and client side, like this ?

server

  
 function (player) 
        if(getResourceState(getResourceFromName("bone_attach")) == "running")then 
            if(getElementType(player) == "player")then 
                if(getElementData(player, "mask") ~= 1)then 
                    setElementData(player, "mask", 1) 
                    case = createObject(2053,0,0,0) 
                    exports.bone_attach:attachElementToBone(case,player,1,0,0,-0.6,0,0,90) 
                    cases[player] = case 
                elseif(getElementData(player, "mask") == 1)then 
                    setElementData(player, "mask", 0) 
                    exports.bone_attach:detachElementFromBone(cases[player]) 
                    destroyElement(cases[player]) 
                end 
            end 
        else 
            outputChatBox("ERROR #1", player, 255, 50, 0) 
        end 
    end 
) 
addEvent("mask", true) 
addEventHandler("mask", getRootElement(), toys) 
  

Server side like this ? and how to start this script if i clik item id 1 in my inventory

Item id 1 is mask...

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