boro Posted July 30, 2013 Posted July 30, 2013 Hi all i have problem with my bonus script but it don't work i want give player bonus weapon but only for one player not for all players i don't know what is bad. function gibvebonus ( player, command ) if getElementByType ( players ) == 'player' then local bonus = math.random ( player ) giveWeapon ( player, 38, 9999 ) outputChatBox("* ".. getPlayerName(player) .." have bonus weapon") end end addCommandHandler ( "playerbonus", givebonus ) I'll help When I Can.
csiguusz Posted July 30, 2013 Posted July 30, 2013 Use getRandomPlayer to get a random player. And your code doesn't make much sense. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
boro Posted July 30, 2013 Author Posted July 30, 2013 Is it good? function gibvebonus ( player, command ) local randomPlayer = getRandomPlayer ( ) giveWeapon ( randomPlayer, 38, 9999 ) outputChatBox("* ".. getPlayerName(randomPlayer) .." have bonus weapon") end addCommandHandler ( "bonus", givebonus ) i won't t test it because am on phone ty. I'll help When I Can.
Castillo Posted July 30, 2013 Posted July 30, 2013 Yes, should work. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Baseplate Posted July 30, 2013 Posted July 30, 2013 And you have a little mistake, as the event handler is attached to a function which doesn't exist. Change the givebonus with gibvebonus.
Sasu Posted July 30, 2013 Posted July 30, 2013 If you want to use in client side you can use: local player = getElementsByType("player") local randomPlayer = player[math.random(1, #player)] State: Inactive
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