xFabel

please help :(

Recommended Posts

yo guys i'm trying to make an command to Enabled and Disabled but i noticed a mistake when my friend tired wrote command he just only succeeded worked with him and did not work when all players like almost .localPlayer. i have tried and did not work for me what is the problem in that?

 

server side:

function SystemCenter(player)
local account = getPlayerAccount (player)
local accName = getAccountName ( getAccountName ( account ) )
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
      setElementData(source,"Admin",true)	
          end
     end

client side:

function onSystemDisabled()
if getElementData(localPlayer,"Admin") then
removeCommandHandler("setw")
removeCommandHandler("sett")
unbindKey("f2")
--nbindKey("n")
 local localPlayerName = getPlayerName(getLocalPlayer())
triggerServerEvent("outputBoxChat", resourceRoot," work "..localPlayerName)
else -- invert
outputChatBox("Access Denied", 255,255,255,true)
end -- to close a event
end -- to close a function
addCommandHandler("dres", onWarpsClose)

how i do if i write this and come to all players? :/

 

Edited by xFabel

Share this post


Link to post

i tried like this and i get some problems in server side
excepted argument 1, got nil

function onSystemEnabled()
if triggerServerEvent("checkPlayer", resourceRoot, player) then
removeCommandHandler("setw", saveCheckPoint)
removeCommandHandler("sett", saveCheckPoint)
unbindKey("f2")
--nbindKey("n")
 local localPlayerName = getPlayerName(getLocalPlayer())
triggerServerEvent("outputBoxChat", resourceRoot," work "..localPlayerName)
else
outputChatBox("Access Denied", 255,255,255,true)
end
end -- same
addCommandHandler("dres", onSystemEnabled)

server:

function SystemCenter(player)
local playerName = getPlayerName(player)
local account = getPlayerAccount (player)
local account_name = getAccountName(account)
local accName = getAccountName ( getPlayerAccount ( player ) )
	if isObjectInACLGroup ( "user."..account_name, aclGetGroup ( "Admin" )) then
	else
	outputChatBox("Access Denied", root, 255,255,255,true)
          end
     end
addEvent("checkPlayer", true)
addEventHandler("checkPlayer", root, SystemCenter)

 

Edited by xFabel

Share this post


Link to post

pleaaase where problem here i'm really confused why not call triggerServerEvent?? :/ :/

function sys(thePlayer, command)
local accName = getAccountName(getPlayerAccount(thePlayer))
local playerName = getPlayerName (thePlayer)
	if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" )) then
	outputChatBox("| the Admin has been #00ff00enabled #ffffffResource Training by "..playerName, root, 255,255,255,true)
	else
		outputChatBox("#ffffffAccess Denied", thePlayer,255,255,255,true)
	end
end
addEvent("amkocworkplz", true)
addEventHandler("amkocworkplz", getRootElement(), sys)
addCommandHandler("eres", sys)

CLIENT

function fastestman()
if triggerServerEvent("amkocworkplz", getRootElement()) then
addCommandHandler("sw", sw)
addCommandHandler("lw", lw)
end
end

 

Share this post


Link to post
On 22/11/2019 at 23:55, xFabel said:

pleaaase where problem here i'm really confused why not call triggerServerEvent??

Because there is something called "ping" (internet/network speed delay), therefore the code doesn't wait for the message to be returned.

Which means that this condition will not work as it was intended for:

if triggerServerEvent(--[[...]]) then

 

Also, you forgot to include the player. Which is used in the sys function. Your main problem.

 triggerServerEvent("amkocworkplz", getRootElement(), localPlayer) 

 

I do not see if the fastestman function is called, so I can't validate that part.

 

Edited by IIYAMA

Share this post


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.