Overkillz Posted July 30, 2014 Share Posted July 30, 2014 Hey everyone, I have a problem with this script that I want to fix, It is a old script, but I fixed it more less, but it doesn't set the status. IDK what is the problem, I check all, and all its correct. local scriptcol = {{255,178,0,true},{255,0,0,true},{255,255,255,true}} --end utility-- -------------------------------------- addCommandHandler("status", function (player, command, target, value) local account = getPlayerAccount(player) if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then if string.find(getPlayerName(player), "Luis") then if (target) and (value) then local targetPlayer = getPlayerWildcard(target) if (targetPlayer) then if not (isGuestAccount(getPlayerAccount(targetPlayer))) then setAccountData(getPlayerAccount(targetPlayer),"playerstatus", value) outputChatBox("#FFFFFF[Admin] #00ccffSuccessfully settet staus for#FFFFFF"..getPlayerName(targetPlayer).." "..tostring(value).." ",player,unpack(scriptcol[1])) outputChatBox("#FFFFFF[Admin] "..getPlayerName(player).."#00FF00 set you an new status '"..tostring(value).."'",targetPlayer,unpack(scriptcol[3])) return else outputChatBox("#FFFFFF[Admin] #00ccffError: Target not logged in!",player,unpack(scriptcol[2])) end else outputChatBox("#FFFFFF[Admin] #00ccffError: Could not find player!",player,unpack(scriptcol[2])) end else outputChatBox("#FFFFFF[Admin] #00ccffError: Syntax error: /status !",player,unpack(scriptcol[2])) end else outputChatBox("#FFFFFF[Admin] #00ccffError: You can't use this function!",player,unpack(scriptcol[2])) end else outputChatBox("#FFFFFF[Admin] #00ccffError: You can't use this function!",player,unpack(scriptcol[2])) end outputChatBox("#FFFFFF[Admin] #00ccffError: Could not find the datatype!",player,unpack(scriptcol[2])) end) ------------------------------------------------------------------- --SCOREB function makeCol() exports.scoreboard:addScoreboardColumn("Status") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), makeCol) function destrCol() exports.scoreboard:removeScoreboardColumn("Status") end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destrCol) function onJoinSetG() setElementData(source, "Status", "guest") end addEventHandler("onPlayerJoin", getRootElement(), onJoinSetG) function onLoginSetC(thePreviousAccount, current, autoLogin) setElementData(source, "Status", getAccountData(current, "playerstatus")) end addEventHandler("onPlayerLogin", getRootElement(), onLoginSetC) Debugscript 3: Nothing Outputchatbox: [Admin] Error: You can't use this function! [Admin] Error: Could not find the datatype! ---------------------------- Im logged as admin, and the account is in the group "Admin" Im writing part of the name or all the name correctly and after set the status Example: ./status Luis test I hope you can help me. Regards. Link to comment
Et-win Posted July 30, 2014 Share Posted July 30, 2014 if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then --Not in Admin group. outputChatBox("#FFFFFF[Admin] #00ccffError: Could not find the datatype!",player,unpack(scriptcol[2])) --Is just outputting because it's not in an 'if'. Link to comment
Overkillz Posted July 30, 2014 Author Share Posted July 30, 2014 if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then --Not in Admin group. outputChatBox("#FFFFFF[Admin] #00ccffError: Could not find the datatype!",player,unpack(scriptcol[2])) --Is just outputting because it's not in an 'if'. Ok, I saw it, but this will not fix the problem, what I can do ? I delete that output ... but the problem is [Admin] Error: You can't use this function! What should I put here ? if string.find(getPlayerName(player), "") then Thanks for answer and regards. Link to comment
Overkillz Posted July 31, 2014 Author Share Posted July 31, 2014 I made a little modification local scriptcol = {{255,178,0,true},{255,0,0,true},{255,255,255,true}} --end utility-- -------------------------------------- addCommandHandler("status", function (player, command, target, value) local account = getPlayerAccount(player) if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then if string.find(getPlayerName(player), "") then if (target) and (value) then local targetPlayer = getPlayerWildcard(target) if (targetPlayer) then if not (isGuestAccount(getPlayerAccount(targetPlayer))) then setAccountData(getPlayerAccount(targetPlayer),"playerstatus", value) outputChatBox("#FFFFFF[Admin] #00ccffSuccessfully settet staus for#FFFFFF"..getPlayerName(targetPlayer).." "..tostring(value).." ",player,unpack(scriptcol[1])) outputChatBox("#FFFFFF[Admin] "..getPlayerName(player).."#00FF00 set you an new status '"..tostring(value).."'",targetPlayer,unpack(scriptcol[3])) return else outputChatBox("#FFFFFF[Admin] #00ccffError: Target not logged in!",player,unpack(scriptcol[2])) end else outputChatBox("#FFFFFF[Admin] #00ccffError: Could not find player!",player,unpack(scriptcol[2])) end else outputChatBox("#FFFFFF[Admin] #00ccffError: Syntax error: /status !",player,unpack(scriptcol[2])) end else outputChatBox("#FFFFFF[Admin] #00ccffError: You can't use this function!",player,unpack(scriptcol[2])) end end end) ------------------------------------------------------------------- --SCOREB function makeCol() exports.scoreboard:addScoreboardColumn("Status") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), makeCol) function destrCol() exports.scoreboard:removeScoreboardColumn("Status") end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destrCol) function onJoinSetG() setElementData(source, "Status", "guest") end addEventHandler("onPlayerJoin", getRootElement(), onJoinSetG) function onLoginSetC(thePreviousAccount, current, autoLogin) setElementData(source, "Status", getAccountData(current, "playerstatus")) end addEventHandler("onPlayerLogin", getRootElement(), onLoginSetC) Now DebugScript 3 tell me: ..../Status.lua:12: attemp to call global 'getPlayerWildcard' (a nil value) I hope you can help me . Regards. Link to comment
Overkillz Posted July 31, 2014 Author Share Posted July 31, 2014 Noone Can help me ? ;( 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