Tekken Posted March 14, 2015 Share Posted March 14, 2015 Why i got this error ? My code: Server: addEvent("onPlayerIsMute", true) function mutePlayer(theTarget, muteTime, msg) if theTarget ~= nil and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(client)), aclGetGroup("MOD")) then setPlayerMuted(theTarget, true) if muteTime then setTimer(function() setPlayerMuted(theTarget, false) outputChatBox("Pedeapsa ta a expirat! Poti vorbi din nou!", theTarget, 130, 130, 130) end end, tonumber(muteTime)*60000, 1) end end addEventHandler("onPlayerIsMute", root, mutePlayer) Client: addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), function() if (source == GUIEditor.button[20]) then local theTarget = guiGridListGetSelectedItem(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local muteTime = guiGetText(GUIEditor.edit[3]) local msg = guiGetText(GUIEditor.edit[4]) triggerServerEvent("onPlayerIsMute", localPlayer, theTarget, muteTime, msg) guiSetVisible(GUIEditor.window[3],false) end end ) Error: attempt to compare noumber with nil Link to comment
darhal Posted March 14, 2015 Share Posted March 14, 2015 You dont compare anything in your posted script also make sure that the two argument that you compare are numbers Link to comment
Tekken Posted March 14, 2015 Author Share Posted March 14, 2015 Oh soryy i forgot to add this addEvent("onPlayerIsMute", true) function mutePlayer(theTarget, muteTime, msg) if tonumber(muteTime) > 0 and tonumber(muteTime) < 121 then --I forgot to add this, and here it give me the error if theTarget ~= nil and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(client)), aclGetGroup("MOD")) then setPlayerMuted(theTarget, true) if muteTime then setTimer(function() setPlayerMuted(theTarget, false) outputChatBox("Pedeapsa ta a expirat! Poti vorbi din nou!", theTarget, 130, 130, 130) end end, tonumber(muteTime)*60000, 1) end end end addEventHandler("onPlayerIsMute", root, mutePlayer) Link to comment
darhal Posted March 14, 2015 Share Posted March 14, 2015 if muteTime and msg then triggerServerEvent("onPlayerIsMute", localPlayer, theTarget, muteTime, msg) end guiSetVisible(GUIEditor.window[3],false) Added this client side Link to comment
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