Jump to content

[QUESTION] Why not working this script?


Tokio

Recommended Posts

1 hour ago, 50cent said:

Lol, now i have a new problem. O.o The script working, but sometimes the /asay xy command does not working, wtf?! O.o When i restart the resource many times then working again, but just for a few minutes, and does not working again. Wtf, how to fix this problem? :o 

No idea. Give debug errors/warnings.

Edited by koragg
Link to comment
local names = {
	["Admin"] = "Tulajdonos",
	["Moderator"] = "Moderátor"
}


function adminuzi(thePlayer, commandName, ...)
	for i,v in pairs(getElementsByType( "player" )) do
        for group, serverGroupName in pairs( names ) do
            if isGuestAccount( getPlayerAccount( v ) ) then return end
		    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then
		    		local message = table.concat({...}, " ")
	                outputChatBox("#0088FF["..serverGroupName.."]#d8001f  "..getPlayerName(v)..":"..message,getRootElement(),0,0,0,true)
                    break
		    end
        end
	end
end
addCommandHandler("asay", adminuzi)

Juste the thing I gave you, but "break" will stop the "for" loop. It should'nt spam anymore

@50cent

Edited by Gordon_G
Link to comment
2 hours ago, Gordon_G said:

local names = {
	["Admin"] = "Tulajdonos",
	["Moderator"] = "Moderátor"
}


function adminuzi(thePlayer, commandName, ...)
	for i,v in pairs(getElementsByType( "player" )) do
        for group, serverGroupName in pairs( names ) do
            if isGuestAccount( getPlayerAccount( v ) ) then return end
		    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then
		    		local message = table.concat({...}, " ")
	                outputChatBox("#0088FF["..serverGroupName.."]#d8001f  "..getPlayerName(v)..":"..message,getRootElement(),0,0,0,true)
                    break
		    end
        end
	end
end
addCommandHandler("asay", adminuzi)

Juste the thing I gave you, but "break" will stop the "for" loop. It should'nt spam anymore

@50cent

this is not good, because output the text with all player's name.. :S 

Link to comment
10 minutes ago, 50cent said:

i used, but sometimes does not working the cmd :S 

Well it's better than a fully non-working one anyway :D Hope someone can help you, I don't know why it doesn't work from time to time. And nothing in debug...

Link to comment
31 minutes ago, koragg said:

Well it's better than a fully non-working one anyway :D Hope someone can help you, I don't know why it doesn't work from time to time. And nothing in debug...

Now i tested on a localhost server, and on localhost server working fine everytime, and just on hosted server not working everytime :S 

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