Gallagher Posted November 24, 2013 Share Posted November 24, 2013 Hello all right? I have a problem, I made a simple script to give information to the players on my server vip. More players are flooding the server with the /vip command. how do I fix this? how can i put a timer so that the command can be executed only after 1 minute? Or only once per spawn? thanks for attention! function v1p ( source ) outputChatBox ( "Want to be VIP? add skype Load31", source, 0, 250, 150, false, false ) outputChatBox ( "VIPs can not abuse their extra skills", source, 0, 250, 150, false, false ) playSoundFrontEnd ( source, 5 ) end addCommandHandler("vip", v1p) Link to comment
glowdemon1 Posted November 24, 2013 Share Posted November 24, 2013 Use https://wiki.multitheftauto.com/wiki/Rem ... andHandler and set a timer on addCommandHandler. Link to comment
Gallagher Posted November 24, 2013 Author Share Posted November 24, 2013 so is right? function v1p ( source ) outputChatBox ( "Want to be VIP? add skype Load31", source, 0, 250, 150, false, false ) outputChatBox ( "VIPs can not abuse their extra skills", source, 0, 250, 150, false, false ) playSoundFrontEnd ( source, 5 ) SetTimer ( "DestroyElement" , 10000, 1, v1p ) end addCommandHandler("vip", v1p) Link to comment
Spajk Posted November 24, 2013 Share Posted November 24, 2013 This should do the trick: function v1p ( source ) outputChatBox ( "Want to be VIP? add skype Load31", source, 0, 250, 150, false, false) outputChatBox ( "VIPs can not abuse their extra skills", source, 0, 250, 150, false, false) playSoundFrontEnd ( source, 5 ) removeCommandHandler("vip", v1p) setTimer(addCommandHandler, 10000, 1, "vip", v1p) end addCommandHandler("vip", v1p) Link to comment
TAPL Posted November 24, 2013 Share Posted November 24, 2013 vTimer = {} addCommandHandler("vip", function(player) if not isTimer(vTimer[player]) then vTimer[player] = setTimer(function(player) vTimer[player] = nil end, 60000, 1, player) outputChatBox("Want to be VIP? add skype Load31", player, 0, 250, 150, false) outputChatBox("VIPs can not abuse their extra skills", player, 0, 250, 150, false) playSoundFrontEnd(player, 5) end end) Link to comment
Gallagher Posted November 26, 2013 Author Share Posted November 26, 2013 vTimer = {} addCommandHandler("vip", function(player) if not isTimer(vTimer[player]) then vTimer[player] = setTimer(function(player) vTimer[player] = nil end, 60000, 1, player) outputChatBox("Want to be VIP? add skype Load31", player, 0, 250, 150, false) outputChatBox("VIPs can not abuse their extra skills", player, 0, 250, 150, false) playSoundFrontEnd(player, 5) end end) Thanks Link to comment
Gallagher Posted November 26, 2013 Author Share Posted November 26, 2013 This should do the trick: function v1p ( source ) outputChatBox ( "Want to be VIP? add skype Load31", source, 0, 250, 150, false, false) outputChatBox ( "VIPs can not abuse their extra skills", source, 0, 250, 150, false, false) playSoundFrontEnd ( source, 5 ) removeCommandHandler("vip", v1p) setTimer(addCommandHandler, 10000, 1, "vip", v1p) end addCommandHandler("vip", v1p) the command is disabled, but after 10 seconds the command is not enabled! anyway thanks for listening! Link to comment
Gallagher Posted November 26, 2013 Author Share Posted November 26, 2013 This should do the trick: function v1p ( source ) outputChatBox ( "Want to be VIP? add skype Load31", source, 0, 250, 150, false, false) outputChatBox ( "VIPs can not abuse their extra skills", source, 0, 250, 150, false, false) playSoundFrontEnd ( source, 5 ) removeCommandHandler("vip", v1p) setTimer(addCommandHandler, 10000, 1, "vip", v1p) end addCommandHandler("vip", v1p) the command is disabled, but after 10 seconds the command is not enabled! anyway thanks for listening! Link to comment
TAPL Posted December 1, 2013 Share Posted December 1, 2013 vTimer = {} addCommandHandler("vip", function(player) if not isTimer(vTimer[player]) then vTimer[player] = setTimer(function(player) vTimer[player] = nil end, 60000, 1, player) outputChatBox("Want to be VIP? add skype Load31", player, 0, 250, 150, false) outputChatBox("VIPs can not abuse their extra skills", player, 0, 250, 150, false) playSoundFrontEnd(player, 5) end end) Thanks You're welcome. 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