nikitafloy Posted April 19, 2014 Share Posted April 19, 2014 server triggered clientside event <...>, but event is not added. Server if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( thePlayer )), aclGetGroup ( 'Security' ) ) then i=i+1 local players = getElementsByType ( "player" ) for _, GlDetect in ipairs( players ) do if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( GlDetect )), aclGetGroup ( 'GlPolice' ) ) then GlPolicePlayer = GlDetect if GlPolicePlayer then k = 55000*i if getPlayerMoney(GlPolicePlayer) >= k then triggerClientEvent('payForJob', getRootElement(), client, k) else outputChatBox( 'Ошибка выплат: У главного нет денег.1', root, 255, 0, 0 ) end end end end if not GlPolicePlayer then local nowMoney = tonumber(getElementData(getRootElement(), "funmodev2-money-GlPolice")) k = 55000*i if nowMoney >= k then givePlayerMoney( thePlayer, 55000 ) setElementData(getRootElement(), 'funmodev2-money-GlPolice', tonumber(getElementData(getRootElement(), "funmodev2-money-GlPolice"))-55000) end end end Client: function payJob(player,k) takePlayerMoney( player, k ) local players = getElementsByType ( "player" ) for theKey, thePlayer in ipairs( players ) do if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( thePlayer )), aclGetGroup ( "Security" ) ) then givePlayerMoney( thePlayer, 55000 ) end end end addEvent( "payForJob", true ) addEventHandler( "payForJob", getRootElement(), payJob ) Link to comment
golanu21 Posted April 19, 2014 Share Posted April 19, 2014 IsObjectInACLGroup, getAccountName , getPlayerAccount, aclGetGroup this all functions is working just in server side, not in client Link to comment
nikitafloy Posted April 19, 2014 Author Share Posted April 19, 2014 IsObjectInACLGroup, getAccountName , getPlayerAccount, aclGetGroupthis all functions is working just in server side, not in client Thank you, I'm a bit mapping going crazy at night. How can I pass a group of players 'Security'? Link to comment
Karuzo Posted April 19, 2014 Share Posted April 19, 2014 Check server-side if they are in that group , if so --> trigger to the client. But it doesn't make sense since your using givePlayerMoney client-side. The money won't added server-side. So better use it in server-sided file. Using this function client side (not recommended) will not change a players money server side Link to comment
nikitafloy Posted April 19, 2014 Author Share Posted April 19, 2014 Check server-side if they are in that group , if so --> trigger to the client.But it doesn't make sense since your using givePlayerMoney client-side. The money won't added server-side. So better use it in server-sided file. Using this function client side (not recommended) will not change a players money server side That damn, sure! Thank you, I'll go to sleep. Link to comment
Mr_Moose Posted April 19, 2014 Share Posted April 19, 2014 In this case you should run this payment system on the server completely as the others described. The reason for your error however is because the server trigger the client event when the resource is started, at that moment, none of the clients has finished their downloads of this resource. Link to comment
nikitafloy Posted April 19, 2014 Author Share Posted April 19, 2014 In this case you should run this payment system on the server completely as the others described. The reason for your error however is because the server trigger the client event when the resource is started, at that moment, none of the clients has finished their downloads of this resource. Yes, yes, I came to his senses. Done, everything works, all thanks! ) 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