Jump to content

Problem with export from admin resource


Recommended Posts

Posted (edited)

I tried to export function "aSetPlayerMuted" but got the debug "failed to call 'admin:aSetPlayerMuted' [string "?"], I don't give an anything what's wrong. Maybe I still did not realize how to use call function. I hope that someone will help cause I did not did anything since 2 litres a beer. Thanks everyone who will send something under.

Code of the script:

if str[1] == "/mute" then 
                            
                                if str[2] and str[3] then
                                    if tonumber(str[3]) then
                                        local seconds = str[3] * 60
                                        local thisPlayer = getPlayerFromName(str[2])
                                        if thisPlayer then
                                            exports["admin"]:aSetPlayerMuted(thisPlayer, not isPlayerMuted (thisPlayer), seconds)

 

I am sorry for the screen but this is the code from of the meta.xml

 

cRceSGU.png

 

I do not plan to sleep until I will fix it.

The function of the admin-resource:

function aSetPlayerMuted ( player, state, length )
	if ( setPlayerMuted ( player, state ) ) then
		if not state then
			aRemoveUnmuteTimer( player )
		elseif state and length and length > 0 then
			aAddUnmuteTimer( player, length )
		end
		return true
	end
	return false
end

I'll be sorry if this is a very stupid mistake...

Edited by Erlkonig
Link to post
Posted (edited)

Okay, after the beer is over I had realized that I had not restarted an "admin" resource.  This is my fault. Sorry for this topic.

The problem is solved.

Also I am sorry because it was a very stupid mistake. I lost about 2 hours on this.

Edited by Erlkonig
Link to post

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