Hell-Mate Posted March 4, 2014 Posted March 4, 2014 Hello community ,, i have made a /hitme command and this command creates a blip attached to the player. and made the blip destroyed onPlayerWasted. the Problem Is : and the two died, only the 2nd one blip will get destroyed. that means it only destroys the blip of the last one who used the command .. and here is my script>> function hitme ( thePlayer, commandName, moneyAmount ) local playermoney = getPlayerMoney ( thePlayer ) if playermoney < tonumber(moneyAmount) then outputChatBox ( "You dont have enough money to make hit",thePlayer,255,0,0, false ) else amount = tonumber(moneyAmount) if amount > 500000 then outputChatBox ( "Maximum hit amount is $500000", thePlayer,255,0,0, false ) else if amount < 50000 then outputChatBox ( "Minimum hit amount is $50000", thePlayer,255,0,0, false ) else if ( getElementData ( thePlayer, 'Player' ) == 'Hit' ) then outputChatBox ( "You are already a hit", thePlayer,255,0,0, false ) else local playername = getPlayerName ( thePlayer ) hitBlip = createBlipAttachedTo ( thePlayer, 26 ) setPlayerNametagColor ( thePlayer, 0, 0, 0 ) takePlayerMoney ( thePlayer, amount ) setElementData ( thePlayer, 'Player', "Hit" ) outputChatBox ( "You have placed a $" .. amount .. " hit on your self",thePlayer,255,235,0, false ) outputChatBox ( "A hit has been placed on " .. playername .. " For $" .. amount .. ".",root,255,235,0, false ) end end end end end addCommandHandler ("hitme", hitme) function ondie () if ( getElementData ( source, 'Player' ) == 'Hit' ) then removeElementData( source, 'Player', "Hit" ) setPlayerNametagColor ( source, 255, 255, 0 ) destroyElement ( hitBlip ) end end addEventHandler ( "onPlayerWasted", getRootElement(), ondie )
Castillo Posted March 4, 2014 Posted March 4, 2014 Store the blips in a table. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Hell-Mate Posted March 4, 2014 Author Posted March 4, 2014 and how to make this ? i have no idea about tables ..
Castillo Posted March 4, 2014 Posted March 4, 2014 http://lua-users.org/wiki/TablesTutorial San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Hell-Mate Posted March 4, 2014 Author Posted March 4, 2014 http://lua-users.org/wiki/TablesTutorial Thanks. learned how to make table and solved the problem Thanks
Castillo Posted March 4, 2014 Posted March 4, 2014 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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