SkiZo Posted January 8, 2017 Share Posted January 8, 2017 (edited) Hello Every One function Armor(thePlayer, commandName) setPedArmor ( thePlayer, 30 ) end addCommandHandler("armor", Armor) i Was Asking If There is A Solution To Make Player Use that Comman "armor" after 3 min When He Used He Can't Use it again only after 3min Sorry For My Bad English Edited January 8, 2017 by S.W.A.T Link to comment
Best-Killer Posted January 8, 2017 Share Posted January 8, 2017 (edited) this will work commandTimer = {} function Armor(thePlayer, commandName) if isTimer(commandTimer[getPlayerSerial(thePlayer)]) then return outputChatBox( "Armor: You can't use this command right now ! You must wait "..math.floor(getTimerDetails(commandTimer[getPlayerSerial(thePlayer)])/1000).." seconds to use it again!",thePlayer, 255, 0, 0) end setPedArmor ( thePlayer, 30 ) commandTimer[getPlayerSerial(thePlayer)] = setTimer(function () end, 175000, 1) end addCommandHandler("armor", Armor) Edited January 8, 2017 by Best-Killer fixed Link to comment
SkiZo Posted January 8, 2017 Author Share Posted January 8, 2017 (edited) Thanks ! But :\ [2017-01-08 20:51:37] WARNING: Skills\jetpack.lua:99: Bad argument @ 'getPlayerSerial' [Expected player at argument 1, got nil] [2017-01-08 20:51:37] WARNING: Skills\jetpack.lua:104: Bad argument @ 'getPlayerSerial' [Expected player at argument 1, got nil] [2017-01-08 20:51:43] WARNING: Skills\jetpack.lua:99: Bad argument @ 'getPlayerSerial' [Expected player at argument 1, got nil] [2017-01-08 20:51:43] WARNING: Skills\jetpack.lua:101: Bad argument @ 'getTimerDetails' [Expected lua-timer at argument 1, got nil] [2017-01-08 20:51:43] ERROR: Skills\jetpack.lua:101: attempt to perform arithmetic on a boolean value @Best-Killer Edited January 8, 2017 by S.W.A.T Link to comment
Best-Killer Posted January 8, 2017 Share Posted January 8, 2017 2 minutes ago, S.W.A.T said: Thanks ! But :\ [2017-01-08 20:51:37] WARNING: Skills\jetpack.lua:99: Bad argument @ 'getPlayerSerial' [Expected player at argument 1, got nil] [2017-01-08 20:51:37] WARNING: Skills\jetpack.lua:104: Bad argument @ 'getPlayerSerial' [Expected player at argument 1, got nil] [2017-01-08 20:51:43] WARNING: Skills\jetpack.lua:99: Bad argument @ 'getPlayerSerial' [Expected player at argument 1, got nil] [2017-01-08 20:51:43] WARNING: Skills\jetpack.lua:101: Bad argument @ 'getTimerDetails' [Expected lua-timer at argument 1, got nil] [2017-01-08 20:51:43] ERROR: Skills\jetpack.lua:101: attempt to perform arithmetic on a boolean value @Best-Killer i edited the code go try now Link to comment
SkiZo Posted January 8, 2017 Author Share Posted January 8, 2017 Thank You very Much Bro <3 Link to comment
AfterAll14 Posted January 8, 2017 Share Posted January 8, 2017 (edited) Using serial to store data is not the best option cause players from some countries have same serial for lots of people. Better use: commandTimer[thePlayer] = setTimer(function () end, 175000, 1) commandTimer = {} function Armor(thePlayer, commandName) if isTimer(commandTimer[thePlayer]) then return outputChatBox( "Armor: You can't use this command right now ! You must wait "..math.floor(getTimerDetails(commandTimer[thePlayer])/1000).." seconds to use it again!",thePlayer, 255, 0, 0) end setPedArmor ( thePlayer, 30 ) commandTimer[thePlayer] = setTimer(function () end, 175000, 1) end addCommandHandler("armor", Armor) Edited January 8, 2017 by AfterAll14 Link to comment
SkiZo Posted January 8, 2017 Author Share Posted January 8, 2017 (edited) 18 minutes ago, AfterAll14 said: Using serial to store data is not the best option cause players from some countries have same serial for lots of people. Better use: commandTimer[thePlayer] = setTimer(function () end, 175000, 1) commandTimer = {} function Armor(thePlayer, commandName) if isTimer(commandTimer[thePlayer]) then return outputChatBox( "Armor: You can't use this command right now ! You must wait "..math.floor(getTimerDetails(commandTimer[thePlayer])/1000).." seconds to use it again!",thePlayer, 255, 0, 0) end setPedArmor ( thePlayer, 30 ) commandTimer[thePlayer] = setTimer(function () end, 175000, 1) end addCommandHandler("armor", Armor) People in same countries had same Serial ? Well I Will Change it THANKS Edited January 8, 2017 by S.W.A.T Link to comment
AfterAll14 Posted January 8, 2017 Share Posted January 8, 2017 In some countries Once I observed 4 turkish guys had same serial on same server Link to comment
Best-Killer Posted January 8, 2017 Share Posted January 8, 2017 Just now, AfterAll14 said: In some countries Once I observed 4 turkish guys had same serial on same server this the first time i hear that 1 Link to comment
AfterAll14 Posted January 8, 2017 Share Posted January 8, 2017 (edited) Yeah, and thats ruined my race scoreboard script in which points were attached to player's serial. I hardly expected that two or more players could have common serial. And here they are DNA - only way to be confident. local DNA = getPlayerDNA(thePlayer) someTable[DNA] = someUselessData Edited January 8, 2017 by AfterAll14 1 Link to comment
myonlake Posted January 9, 2017 Share Posted January 9, 2017 I don't think MTA serials have any significant probability for a collision like that. I'd even go as far as to say that the guy who played played on multiple machines, aka multiboxing. 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