HairyMeets Posted January 16, 2018 Share Posted January 16, 2018 Hi, I want to create a simple event with a check I wrote down two local variables that create a team In the spawn function of the player specified setPlayerTeam If the player hit the marker, then a message is shown in the chat, if, of course, he is in this team Also I tried this function getPlayerTeam But as far as I understand it is not required here, I hope I'm not mistaken Well, I'm hoping for your help. Link to comment
KaMi Posted January 16, 2018 Share Posted January 16, 2018 local marker = createMarker ( x, y , z, "cylinder", 1.5, 255, 255, 0, 170 ) function team(player) local pt = getPlayerTeam( player ) if (pt) then outputChatBox(player, "You are in team") else outputChatBox(player, "You need a team") end end addEventHandler("onMarkerHit", marker, team) Link to comment
Awang Posted January 16, 2018 Share Posted January 16, 2018 Or in clientside: addEventHandler("onClientMarkerHit",theMarker,function(hitPlayer, matchingDimension) if matchingDimension and hitPlayer == localPlayer then if getPlayerTeam(localPlayer) == team1 then outputChatbox("You are in team 1") elseif getPlayerTeam(localPlayer) == team2 then outputChatbox("You are in team 2") elseif getPlayerTeam(localPlayer) == false then outputChatbox("You are not member of any team") end end end) Link to comment
HairyMeets Posted January 16, 2018 Author Share Posted January 16, 2018 31 minutes ago, <~KaMiKaZe~> said: local marker = createMarker ( x, y , z, "cylinder", 1.5, 255, 255, 0, 170 ) function team(player) local pt = getPlayerTeam( player ) if (pt) then outputChatBox(player, "You are in team") else outputChatBox(player, "You need a team") end end addEventHandler("onMarkerHit", marker, team) 30 minutes ago, Awang said: Or in clientside: addEventHandler("onClientMarkerHit",theMarker,function(hitPlayer, matchingDimension) if matchingDimension and hitPlayer == localPlayer then if getPlayerTeam(localPlayer) == team1 then outputChatbox("You are in team 1") elseif getPlayerTeam(localPlayer) == team2 then outputChatbox("You are in team 2") elseif getPlayerTeam(localPlayer) == false then outputChatbox("You are not member of any team") end end end) Thanks guys Link to comment
ShayF2 Posted January 18, 2018 Share Posted January 18, 2018 addEventHandler('onMarkerHit',root,function(player) -- replace root with marker or if you use multiple markers please use the code below local name = getTeamName(getPlayerTeam(player)) or 'None' outputChatBox('You are in team: '..name,player,0,255,255) end) local markers = {} addEventHandler('onMarkerHit',root,function(player) for i=1,#markers do if source == markers[i] then local name = getTeamName(getPlayerTeam(player)) or 'None' outputChatBox('You are in team: '..name,player,0,255,255) end end end) 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