Imposter Posted June 30, 2012 Share Posted June 30, 2012 Hello guys, i'm new to scripting in lua (just started a few weeks ago) and I need some help with radius's. Let me explain in more depth. Let say there is a player E and the other players are in a separate team, how would I warn player E if the other players are in a nearby radius of 10m? and if player E dies, how would i be able to give money only players in the 10m radius if they are in a specific team? Can somebody please help me out? I've been trying to do this for a week now with no luck. Link to comment
Castillo Posted June 30, 2012 Share Posted June 30, 2012 You can create a colshape and attach it to the player, then get the players inside it. createColTube attachElements Link to comment
Imposter Posted June 30, 2012 Author Share Posted June 30, 2012 You can create a colshape and attach it to the player, then get the players inside it. createColTube attachElements Thank you Solidsnake14, but i tried that and the game lags really hard when the player starts to move, would i use a timer to do this or is there a better method?? Oh i understand what you mean, what i did before was make a collision object and when the player moves, it removes the object and creates it again, thank you so much for your assisstance!!!! Link to comment
Imposter Posted June 30, 2012 Author Share Posted June 30, 2012 What kind of eventhandler do i use? onVehicleEnter?? Link to comment
Imposter Posted June 30, 2012 Author Share Posted June 30, 2012 To do what? for the eventhandler to create the collision? please bear with me im a newb Link to comment
Castillo Posted June 30, 2012 Share Posted June 30, 2012 onColShapeHit onColShapeLeave These events are used for when a element hits/leaves a collision shape. Link to comment
Imposter Posted June 30, 2012 Author Share Posted June 30, 2012 onColShapeHitonColShapeLeave These events are used for when a element hits/leaves a collision shape. I understand that, but when do i create the collision object? do i need to put it in a function?what handler do i use for the function? could i use onVehicleEnter? here is what i have so far. function createZone () -- get the position of the source player local x, y, z = getElementPosition(source) -- create a collision object around the player local playerZone = createColTube ( x, y, z, 10.0, 100.0 ) -- attach the marker to the player with a vertical offset of 0 units attachElements ( playerZone, source, 0, 0, 0 ) -- tell player that its done outputChatBox("ITS DONE!!",source) end addEventHandler ( "onVehicleEnter", getRootElement(), createZone ) function zoneEnter () outputChatBox("Incomplete", source) end addEventHandler ( "onColShapeHit", getRootElement(), zoneEnter ) it only seams to work when i make it a command handler addCommandHandler ( "cz_cz", createZone ) instead of addEventHandler ( "onVehicleEnter", getRootElement(), createZone ) HELP?? 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