Tekken Posted March 16, 2015 Share Posted March 16, 2015 Why i got this error ? Error: expected element at argument 1 got string "Player-Name" Server: addEvent("onPlayerIsMute", true) function mutePlayer(theTarget, muteTime) if (getPlayerFromName(theTarget)) then if theTarget ~= nil and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(client)), aclGetGroup("MOD")) then if tonumber(muteTime) > 0 and tonumber(muteTime) < 121 then setPlayerMuted(theTarget, true) end end end end addEventHandler("onPlayerIsMute", root, mutePlayer) Client: addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), function() if (source == muteok) then local theTarget = guiGridListGetItemText(gridmain, guiGridListGetSelectedItem(gridmain), 1) local muteTime = tonumber(guiGetText(muttime)) if (getPlayerFromName(theTarget)) then triggerServerEvent("onPlayerIsMute", localPlayer, theTarget, tonumber(muteTime)) end --guiSetVisible(mute,false) end end) Link to comment
JR10 Posted March 16, 2015 Share Posted March 16, 2015 You check if there is a player with the name, but you never assign the player to the 'theTarget' variable. addEvent("onPlayerIsMute", true) function mutePlayer(theTarget, muteTime) theTarget = getPlayerFromName(theTarget) if (isElement(target)) then if theTarget ~= nil and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(client)), aclGetGroup("MOD")) then if tonumber(muteTime) > 0 and tonumber(muteTime) < 121 then setPlayerMuted(theTarget, true) end end end end addEventHandler("onPlayerIsMute", root, mutePlayer) Link to comment
Tekken Posted March 16, 2015 Author Share Posted March 16, 2015 You check if there is a player with the name, but you never assign the player to the 'theTarget' variable. addEvent("onPlayerIsMute", true) function mutePlayer(theTarget, muteTime) theTarget = getPlayerFromName(theTarget) if (isElement(target)) then if theTarget ~= nil and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(client)), aclGetGroup("MOD")) then if tonumber(muteTime) > 0 and tonumber(muteTime) < 121 then setPlayerMuted(theTarget, true) end end end end addEventHandler("onPlayerIsMute", root, mutePlayer) Thank's Link to comment
TAPL Posted March 16, 2015 Share Posted March 16, 2015 You check if there is a player with the name, but you never assign the player to the 'theTarget' variable. addEvent("onPlayerIsMute", true) function mutePlayer(theTarget, muteTime) theTarget = getPlayerFromName(theTarget) if (isElement(target)) then if theTarget ~= nil and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(client)), aclGetGroup("MOD")) then if tonumber(muteTime) > 0 and tonumber(muteTime) < 121 then setPlayerMuted(theTarget, true) end end end end addEventHandler("onPlayerIsMute", root, mutePlayer) Line 4: target -> theTarget Link to comment
Tekken Posted March 16, 2015 Author Share Posted March 16, 2015 Line 4: target -> theTarget i figured it out myself. 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