JoZeFSvK Posted April 13, 2013 Share Posted April 13, 2013 Hey i wanna create when player will in alc group etc. vip then he can use command. how i create it ? can you show me example ? local restriction = {} function fck(player, cmd) if (not restriction[player]) then restriction[player] = {} end if not restriction[player][cmd] then outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 says: F*ck You! ", root, 255, 255, 255, true) restriction[player][cmd] = true setTimer(function () restriction[player][cmd] = false end, 5000, 1) else outputChatBox("#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.", player, 255, 255, 255, true) end end addCommandHandler("fu", fck) how i add here "when player is acl gorup vip" ? Link to comment
denny199 Posted April 13, 2013 Share Posted April 13, 2013 Apply this to your code: accountname = getAccountName (getPlayerAccount(playerElement)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( vip" ) ) then You should edit the "playerElement" ofcourse, etc. Link to comment
JoZeFSvK Posted April 13, 2013 Author Share Posted April 13, 2013 i add but dont work Link to comment
PaiN^ Posted April 13, 2013 Share Posted April 13, 2013 Show us what you have done .. Link to comment
JoZeFSvK Posted April 13, 2013 Author Share Posted April 13, 2013 accountname = getAccountName (getPlayerAccount(playerElement)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then local restriction = {} function fck(player, cmd) if (not restriction[player]) then restriction[player] = {} end if not restriction[player][cmd] then outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 says: F*ck You! ", root, 255, 255, 255, true) restriction[player][cmd] = true setTimer(function () restriction[player][cmd] = false end, 5000, 1) else outputChatBox("#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.", player, 255, 255, 255, true) end end addCommandHandler("fu", fck) Link to comment
Puma Posted April 13, 2013 Share Posted April 13, 2013 Apply this to your code: accountname = getAccountName (getPlayerAccount(playerElement)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( vip" ) ) then You should edit the "playerElement" ofcourse, etc. accountname = getAccountName (getPlayerAccount(playerElement)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then Fixed, you forgot the opening " to vip. Link to comment
PaiN^ Posted April 13, 2013 Share Posted April 13, 2013 local restriction = {} function fck ( player, cmd ) accountname = getAccountName ( getPlayerAccount ( player ) ); if not isObjectInACLGroup ( 'user.' .. accountname, aclGetGroup ( 'vip' ) ) then return end if not restriction[player] then restriction[player] = {} end if not restriction[player][cmd] then outputChatBox ( '#FFFFFF'.. getPlayerName(player) ..'#5DACD1 says: F*ck You! ', root, 255, 255, 255, true ); restriction[player][cmd] = true setTimer ( function ( ) restriction[player][cmd] = false end, 5000, 1 ); else outputChatBox ( '#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.', player, 255, 255, 255, true ); end end addCommandHandler( 'fu', fck ); Link to comment
JoZeFSvK Posted April 13, 2013 Author Share Posted April 13, 2013 thank you for your time Link to comment
JoZeFSvK Posted April 13, 2013 Author Share Posted April 13, 2013 agrh i have problem again i dont know where is problem Client function hell ( onPlayerHell ) local sound = playSound("song/hell.mp3") setSoundVolume(sound, 0.5) end addEventHandler("onPlayerHell", getLocalPlayer(), hell) addEventHandler("onPlayerHell", getRootElement(), hell) Server local restriction = {} function fck ( player, cmd ) accountname = getAccountName ( getPlayerAccount ( player ) ); if not isObjectInACLGroup ( 'user.' .. accountname, aclGetGroup ( 'vip' ) ) then return end if not restriction[player] then restriction[player] = {} end if not restriction[player][cmd] then triggerClientEvent("onPlayerHell",getRootElement()) restriction[player][cmd] = true setTimer ( function ( ) restriction[player][cmd] = false end, 5000, 1 ); else outputChatBox ( '#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.', player, 255, 255, 255, true ); end end addCommandHandler( 'fu', fck ); Link to comment
JoZeFSvK Posted April 13, 2013 Author Share Posted April 13, 2013 i added but problem in debug see Server triggered clientside event onPlayerHell, but event is not added clientside Link to comment
iPrestege Posted April 13, 2013 Share Posted April 13, 2013 Client ; function hell ( ) local sound = playSound("song/hell.mp3") setSoundVolume(sound, 0.5) end addEvent("onPlayerHell",true) addEventHandler("onPlayerHell", getRootElement(), hell) Server ; local restriction = {} function fck ( player, cmd ) accountname = getAccountName ( getPlayerAccount ( player ) ); if not isObjectInACLGroup ( 'user.' .. accountname, aclGetGroup ( 'vip' ) ) then return end if not restriction[player] then restriction[player] = {} end if not restriction[player][cmd] then triggerClientEvent("onPlayerHell",getRootElement()) restriction[player][cmd] = true setTimer ( function ( ) restriction[player][cmd] = false end, 5000, 1 ); else outputChatBox ( '#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.', player, 255, 255, 255, true ); end end addCommandHandler( 'fu', fck ); All players will hear the sound . 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