Jump to content

executeCommandHandler


CodX

Recommended Posts

Hi !

It's possible to excute server command as admin using executeCommandHandler ?
For example, i want give some game points using sql for a player that have 10 hours, but he doesn't have access to game point's command.

Link to comment
  • Moderators
40 minutes ago, CodX said:

It's possible to excute server command as admin using executeCommandHandler ?

Not likely, since that only will work when there is an admin online which you can use as executor.

https://wiki.multitheftauto.com/wiki/Element/Console

 

 

It is better to solve that at the source:

local console = getElementChildren ( root, "console")[1]

addCommandHandler ( "somecommand", 
function ( playerSource, commandName )
	if console == playerSource or --[[ ACL check]] then
      
	end
end)

 

Option A

local console = getElementChildren ( root, "console")[1]

if console == playerSource then
  
end

 

Option B

if getElementType(playerSource) == "console" then
  
end

 

Edited by IIYAMA
Link to comment
21 hours ago, IIYAMA said:

Not likely, since that only will work when there is an admin online which you can use as executor.

https://wiki.multitheftauto.com/wiki/Element/Console

 

 

It is better to solve that at the source:


local console = getElementChildren ( root, "console")[1]

addCommandHandler ( "somecommand", 
function ( playerSource, commandName )
	if console == playerSource or --[[ ACL check]] then
      
	end
end)

 

Option A


local console = getElementChildren ( root, "console")[1]

if console == playerSource then
  
end

 

Option B


if getElementType(playerSource) == "console" then
  
end

 

So, at server side i can use that function like "executeCommandHandler("give", "console", "money", 5000)

'give' is the command and the  executor is 'console', rest of them are arguments.

Link to comment
  • Moderators
1 minute ago, CodX said:

'give' is the command and the  executor is 'console', rest of them are arguments.

Maybe, there is no information about console being available here: https://wiki.multitheftauto.com/wiki/ExecuteCommandHandler

So I am not sure if that is supported.

But if you want to try that, you need to provide the element console and not the string "console".

 

 

 

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