Monument 0 Posted March 28 Share Posted March 28 (edited) addEventHandler("onColShapeHit", group, function (thePlayer) local team = getPlayerTeam( thePlayer ); -- Here Bad Arg if getElementType ( thePlayer ) == "player" then CN = getElementData(source, "name") for i = 1, #C do if source == C[i] then if getTeamName(team) == "1" then outputChatBox ("1", getRootElement(), 255, 0, 0, true ) else if getTeamName(team) == "2" then outputChatBox ("2", getRootElement(), 255, 0, 0, true ) end end end end end end end, true) this Function Start when player hit colshape i want when hit colshape Check if Player in Team "1" then outputChatBox "1" if player in Team "2" then outputChatBox "2" if not 1 or 2 then ourpurChatBox " 3 " Thx For @Tekken Edited March 28 by Monument Link to post
Tekken 146 Posted March 28 Share Posted March 28 First of all you should move the getPlayetTeam after the getElementType function so you make sure it's a player: This should do it: addEventHandler("onColShapeHit", group, function(hitElement) if getElementType(hitElement) == "player" then local team = getPlayerTeam(hitElement) or false; local CN = getElementData(source, "name"); --?? for i = 1, #C do if source == C[i] then if team then outputChatBox(getTeamName(team), hitElement, 255, 0, 0, true); end end end end end); Link to post
Monument 0 Posted March 28 Author Share Posted March 28 1 hour ago, Tekken said: First of all you should move the getPlayetTeam after the getElementType function so you make sure it's a player: This should do it: addEventHandler("onColShapeHit", group, function(hitElement) if getElementType(hitElement) == "player" then local team = getPlayerTeam(hitElement) or false; local CN = getElementData(source, "name"); --?? for i = 1, #C do if source == C[i] then if team then outputChatBox(getTeamName(team), hitElement, 255, 0, 0, true); end end end end end); Thank you but i don't know how to make it for a specific team only if Team " 1 " do someting if Team "2" do other someting i said outputchatbox for exmaple only Link to post
Tekken 146 Posted March 28 Share Posted March 28 It’s simple: local name = getTeamName(team); if name == "1" then -- do something elseif name == "2" then -- do something else else -- do something else else.. end And so on and so forth. This is just an idea you can make it even better with tables and stuff much faster/better. Link to post
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