Jump to content

Crazy problem.


coolman

Recommended Posts

Resource 1#.

i trigger localplayer from client to server ( sPlayer = source ), I can outputchatbox him and sPlayer element is still working but when i use: exports.system:doPlayerCommand( sPlayer ) it don't make any effect.

  
function doPlayerCommand( player ) 
executeCommandHandler( "dance", player ) --it always return false from upper problem, anyway always works good  
end 

So, bug ?

Link to comment

I think, don't get this because i'm not sure, that you can't execute a command handler from server on client.

Here you have a code for client-side:

  
function doPlayerCommand( player ) 
     triggerServerEvent("onExecuteCommand", player ) 
end 
  

And a code for server-side:

  
addCommandHandler("dance", 
function() 
--[[ Here you must add the full commandHandler function. ]]-- 
end 
) 
  
  
addEvent("onExecuteCommand") 
addEventHandler("onExecuteCommand", 
function(player) 
executeCommandHandler( "dance", player ) 
end 
) 
  

Try it and tell me what happens.

Link to comment
i trigger localplayer from client to server ( sPlayer = source ), I can outputchatbox him and sPlayer element is still working but when i use: exports.system:doPlayerCommand( sPlayer ) it don't make any effect.

Don't do this

sPlayer = source 

or this

local sPlayer = source 

because this may buged, source is the element that the event originated from

remember this: Each event has a source element

so why you don't just use this?!

exports.system:doPlayerCommand( source ) 

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