golanu21 Posted August 22, 2013 Posted August 22, 2013 warns = 0 function command (sourcePlayer, command, who) name = getPlayerFromName(who) if name then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then for index, name in ipairs(name) do if warns == 0 then warns = 1 outputChatBox("Jucatorul"..name.."a primit warn din partea administratorilor 1/3") elseif warns == 1 then warns = 2 outputChatBox("Jucatorul"..name.."a primit warn din partea administratorilor 2/3") elseif warns == 2 then warns = 3 outputChatBox("Jucatorul"..name.."a primit warn din partea administratorilor 3/3") banPlayer(name) end end end else outputChatBox("Invalid Syntax:/warn Player", source, 255, 0, 0 ) end end addCommandHandler("warn", command) WARNING: gymScript\server.lua:3: Bad argument @ 'getPlayerFromName' [2013-08-22 12:31:25] WARNING: gymScript\server.lua:5: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [2013-08-22 12:31:25] WARNING: gymScript\server.lua:5: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [2013-08-22 12:31:25] ERROR: gymScript\server.lua:6: attempt to concatenate local 'accName' (a boolean value) [Dev]BloWnRPG - We BloW the World [1%]
csiguusz Posted August 22, 2013 Posted August 22, 2013 (edited) warns = 0 function command (sourcePlayer, command, who) if not who then outputChatBox ( "No name was given." ) return end name = getPlayerFromName(who) if name then local accName = getAccountName ( getPlayerAccount ( sourcePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then for index, name in ipairs(name) do -- that makes no sense if warns == 0 then warns = 1 outputChatBox("Jucatorul"..name.."a primit warn din partea administratorilor 1/3") elseif warns == 1 then warns = 2 outputChatBox("Jucatorul"..name.."a primit warn din partea administratorilor 2/3") elseif warns == 2 then warns = 3 outputChatBox("Jucatorul"..name.."a primit warn din partea administratorilor 3/3") banPlayer(name) end end end else outputChatBox("Invalid Syntax:/warn Player", source, 255, 0, 0 ) end end addCommandHandler("warn", command) Edited August 22, 2013 by Guest Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
Sora Posted August 22, 2013 Posted August 22, 2013 Here's the error i found so far in your code in line 5 , you've put thePlayer in place of sourcePlayer & in line 7 ,you've tried to loop a variable not a table [REL] Resource Starter System v1.3 [REL] Give Permissions Panel v1.4 [REL] Meta Creator 1.1 ( In-game MetaCreator ) [REL] ACL Permission Manager 1.0 [REL] Accounts Security Manager 1.1 Name(s) in-game : old |S.s|SoRa, current : *Sora
golanu21 Posted August 22, 2013 Author Posted August 22, 2013 server.lua:11: bad argument #1 to 'ipairs' (table expected, got userdata) [Dev]BloWnRPG - We BloW the World [1%]
csiguusz Posted August 22, 2013 Posted August 22, 2013 & in line 7 ,you've tried to loop a variable not a table Yes, Sora is right, I haven't noticed this. But it's now line 11 in my version. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
golanu21 Posted August 22, 2013 Author Posted August 22, 2013 and how i make it to work ? [Dev]BloWnRPG - We BloW the World [1%]
csiguusz Posted August 22, 2013 Posted August 22, 2013 What exactly would you want to do there? Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
golanu21 Posted August 22, 2013 Author Posted August 22, 2013 a warn system, when player "who" has received a 3 warns .. ban the player Who.. [Dev]BloWnRPG - We BloW the World [1%]
csiguusz Posted August 22, 2013 Posted August 22, 2013 (edited) Then use a table, eg.: local warn = {} And store there the warns of individual players: if not warn[ name ] then -- hasn't got a warning yet warn[ name ] = 1 else warn[ name ] = warn[ name ] + 1 --alredy has waring(s), so give one more end if warn[ name ] >= 3 then -- 3 warnings = ban banPlayer(...) end Edited August 22, 2013 by Guest Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
golanu21 Posted August 22, 2013 Author Posted August 22, 2013 SCRIPT ERROR: gymScript\server.lua:8: 'then' expected near '=' [2013-08-22 13:08:50] WARNING: Loading script failed: gymScript\server.lua:8: 'then' expected near '=' [Dev]BloWnRPG - We BloW the World [1%]
csiguusz Posted August 22, 2013 Posted August 22, 2013 Eh, I'm a bit silly today... Error fixed. I wrote => instead of >= . But don't just copy-paste it into your script. It's an example of how you could do it, but you have to implement it to your needs. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
golanu21 Posted August 22, 2013 Author Posted August 22, 2013 i put to banPlayer(who), and is acces Denied [Dev]BloWnRPG - We BloW the World [1%]
csiguusz Posted August 22, 2013 Posted August 22, 2013 Then your script doesn't have the right to ban. Put resource.resourcename in an ACL group wich can ban. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
golanu21 Posted August 22, 2013 Author Posted August 22, 2013 bad argument [Dev]BloWnRPG - We BloW the World [1%]
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