Z4Zy Posted April 8, 2018 Share Posted April 8, 2018 Hi Again.... in client side of the LUA script, we could done like below, local player = getLocalPlayer () then the word player is equal to the "local player's" specifications. But in server side.... it couldn't done, because getLocalPlayer () is a client side event. So what is the way of enter it in to the server side ?? Link to comment
WorthlessCynomys Posted April 8, 2018 Share Posted April 8, 2018 You can't. It is possible in client side, because every client side script runs separately om every players PC. The server side script runs only on the server PC and affects everyone. When you trigger a server side event, from client side, you get the client in the variable name "client". It's like source at events Link to comment
Z4Zy Posted April 8, 2018 Author Share Posted April 8, 2018 in every 2 seconds, admin's health should decrease by 5%. Can you fix below wrong code function decrease ( ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) for _,p in pairs(getElementsByType ( "player" )) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementHealth ( thePlayer, getElementHealth(thePlayer) - 5 ) end end end setTimer ( decrease, 2000, 0 ) Link to comment
Moderators Patrick Posted April 8, 2018 Moderators Share Posted April 8, 2018 1 hour ago, DeadthStrock said: in every 2 seconds, admin's health should decrease by 5%. Can you fix below wrong code function decrease ( ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) for _,p in pairs(getElementsByType ( "player" )) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementHealth ( thePlayer, getElementHealth(thePlayer) - 5 ) end end end setTimer ( decrease, 2000, 0 ) function decrease() for _, thePlayer in ipairs(getElementsByType("player" )) do local accName = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setElementHealth(thePlayer, getElementHealth(thePlayer) - 5) end end end setTimer(decrease, 2000, 0) 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now