iRack Posted March 16, 2019 Share Posted March 16, 2019 Hi ! Can someone help me ? I want: ONLY in that cylinder you can use command [/ad], only in it, I don't know how to do it. ( it's an advertisement system for RPG ) Thanks a lot ! function Advertisment(thePlayer, commandName, ...) local players = getElementsByType("player") local playerName = getPlayerName ( thePlayer ) local chatContent = {...} for index, player in ipairs ( players ) do outputChatBox( "Advertisment from " .. playerName.. ": " ..table.concat ( chatContent, " "), player, 0, 190, 40) end end addCommandHandler( "ad", Advertisment ) cylinder = createMarker(1168.6981201172, -1489.6285400391, 21.756763458252, "cylinder", 5, 100, 0, 0) setElementInterior(cylinder, 0) function Advertisment (thePlayer) if source == Advertisment then setElementInterior(thePlayer, 0) setElementPosition(thePlayer, 1168.6981201172, -1489.6285400391, 22.756763458252) elseif source == cylinder then outputChatBox("Type [/ad] to publish your advertisment.", thePlayer, 255, 255, 0) end end addEventHandler("onMarkerHit", getRootElement(), Advertisment) Link to comment
Master_MTA Posted March 16, 2019 Share Posted March 16, 2019 14 minutes ago, iRack said: Thanks cylinder = createMarker(1168.6981201172, -1489.6285400391, 21.756763458252, "cylinder", 5, 100, 0, 0) setElementInterior(cylinder, 0) function Advertisment(thePlayer, commandName, ...) if isElementWithinMarker(thePlayer,cylinder) then local players = getElementsByType("player") local playerName = getPlayerName ( thePlayer ) local chatContent = {...} for index, player in ipairs ( players ) do outputChatBox( "Advertisment from " .. playerName.. ": " ..table.concat ( chatContent, " "), player, 0, 190, 40) end else outputChatBox("#ff0000* you must be in the marker",thePlayer,255,255,255,true) end end addCommandHandler( "ad", Advertisment ) function Advertisment (thePlayer) if source == Advertisment then setElementInterior(thePlayer, 0) setElementPosition(thePlayer, 1168.6981201172, -1489.6285400391, 22.756763458252) elseif source == cylinder then outputChatBox("Type [/ad] to publish your advertisment.", thePlayer, 255, 255, 0) end end addEventHandler("onMarkerHit", getRootElement(), Advertisment) try this Link to comment
iRack Posted March 16, 2019 Author Share Posted March 16, 2019 Thanks ! It worked ! Have a nice day sir ! Link to comment
Master_MTA Posted March 17, 2019 Share Posted March 17, 2019 14 hours ago, iRack said: Have u r 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