myonlake Posted July 10, 2013 Posted July 10, 2013 Do you mean you want to make a marker visible only for a team and no one else? In that case you should refer to the last optional argument of createMarker -function.
ali Posted July 10, 2013 Author Posted July 10, 2013 function createTeams() teamhunt = createTeam ("Treasure Hunter", 255,255,255 ) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createTeams) local randomX, randomY, randomZ = unpack(markers[math.random(#markers)]) local theMarker = createMarker ( randomX, randomY, randomZ, "cylinder", 1.5, 0, 255, 255, 170, teamhunt) like this?
isa_Khamdan Posted July 10, 2013 Posted July 10, 2013 (edited) Try this local theMarker = createMarker ( x, y, z, 'cylinder', 2.0, 75, 182, 76, 150 ) addEventHandler('onClientMarkerHit',theMarker, function ( hit ) if hit == localPlayer then if getPlayerTeam ( hit ) and not isPedInVehicle ( hit ) then if getTeamName ( getPlayerTeam ( hit ) ) == 'TeamName' then setElementPosition( hit , x, y, z) end end end end,false ) Edited July 10, 2013 by Guest
myonlake Posted July 10, 2013 Posted July 10, 2013 Yes, should work as far as I know. Try and let us know.
ali Posted July 10, 2013 Author Posted July 10, 2013 (edited) farmerW = guiCreateWindow(336, 191, 601, 353, " Hunter Window", false) guiWindowSetSizable(farmerW, false) guiSetAlpha(farmerW, 1.00) guiSetProperty(farmerW, "CaptionColour", "FF3D49C1") accept = guiCreateButton(19, 251, 183, 58, "Accept", false, farmerW) guiSetFont(accept, "default-bold-small") farmmemo = guiCreateMemo(9, 27, 582, 175, "Treasure Hunter Job :- \n\nOnce you accept you will see a marker once you will see blips follow the blip and you will see a marker there once you enter the marker, if you are lucky you will find either money or gun bullets", false, farmerW) decline = guiCreateButton(398, 251, 183, 58, "Cancel", false, farmerW) guiSetFont(decline, "default-bold-small") guiSetVisible(farmerW,false) showCursor(false) function visi() guiSetVisible(farmerW,true) showCursor(true) end addEvent("go",true) addEventHandler("go", getLocalPlayer(), visi) addEventHandler("onClientGUIClick", root, function() if (source == accept ) then triggerServerEvent("setTeam",getLocalPlayer()) guiSetVisible(farmerW,false) showCursor(false) elseif (source == decline) then guiSetVisible(farmerW,false) showCursor(false) end end ) client farmerMarker = createMarker(0, 0, 0,"cylinder") createBlipAttachedTo(farmerMarker,25) local markers = { {-712.28870, 959.58148, 12.33588}, {-721.93903, 938.94037, 12.13281}, } function createTeams() teamhunt = createTeam ("Treasure Hunter", 255,255,255 ) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createTeams) function visi(hitElement) triggerClientEvent(hitElement,"go",hitElement) end addEventHandler("onMarkerHit", farmerMarker, visi) function setHunter() team = getPlayerTeam(source) if not (team == teamhunt) then k = setPlayerTeam(source,teamhunt) setPlayerNametagColor(source, 0,255,255) local randomX, randomY, randomZ = unpack(markers[math.random(#markers)]) local theMarker = createMarker ( randomX, randomY, randomZ, "cylinder", 1.5, 0, 255, 255, 170, teamhunt) createBlipAttachedTo(theMarker,0) end end addEvent("setTeam",true) addEventHandler("setTeam",getRootElement(),setHunter) server this script s not complete butproblem how to make markers visible for the team Edited July 11, 2013 by Guest
ali Posted July 10, 2013 Author Posted July 10, 2013 nvm about gui at start its just because marker co ordinates are 0 0 0
Moderators IIYAMA Posted July 11, 2013 Moderators Posted July 11, 2013 how to make markers available for the team the gui comes at playerjoin I don't understand the problem. Markers only for one team? and gui will be visible when a player joins?
ali Posted July 11, 2013 Author Posted July 11, 2013 (edited) no forget about the gui just the marker visible for one team Edited July 11, 2013 by Guest
PaiN^ Posted July 11, 2013 Posted July 11, 2013 addEventHandler( "onClientMarkerHit", marker, function( player ) if player == localPlayer then local playerTeam = getPlayerTeam( player ) if playerTeam and playerTeam == getTeamFromName( "Team Name" ) then -- do what you want end end end ) You mean like this ??
PaiN^ Posted July 11, 2013 Posted July 11, 2013 Oh, Will You can make a function to get the players in the team, and then make the marker visible only for them . local myTeam = createTeam( ... ) function getTeamRootElement( team ) if team and isElement( team ) and getElementType( team ) == "team" then for k,v in ipairs( getPlayersInTeam( team ) ) do return v end end return false end local marker = createMarker( x, y, z, "cylinder", 1, 255, 0, 0, 255, getTeamRootElement( myTeam ) )
ali Posted July 11, 2013 Author Posted July 11, 2013 (edited) now its visible to everyone, not what i wanted Edited July 11, 2013 by Guest
Moderators IIYAMA Posted July 11, 2013 Moderators Posted July 11, 2013 https://wiki.multitheftauto.com/wiki/Se ... tVisibleTo
ali Posted July 11, 2013 Author Posted July 11, 2013 farmerMarker = createMarker(0, 0, 0,"cylinder") createBlipAttachedTo(farmerMarker,25) local markers = { {-712.28870, 959.58148, 12.33588}, {-721.93903, 938.94037, 12.13281}, } function createTeams() teamhunt = createTeam ("Treasure Hunter", 255,255,255 ) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createTeams) function visi(hitElement) triggerClientEvent(hitElement,"go",hitElement) end addEventHandler("onMarkerHit", farmerMarker, visi) function setHunter() team = getPlayerTeam(source) if not (team == teamhunt) then k = setPlayerTeam(source,teamhunt) setPlayerNametagColor(source, 0,255,255) local randomX, randomY, randomZ = unpack(markers[math.random(#markers)]) local theMarker = createMarker ( randomX, randomY, randomZ, "cylinder", 1.5, 0, 255, 255, 170, teamhunt) createBlipAttachedTo(theMarker,0) setElementVisibleTo ( theMarker, teamhunt, true ) end end addEvent("setTeam",true) addEventHandler("setTeam",getRootElement(),setHunter) this still didnt work
Moderators IIYAMA Posted July 11, 2013 Moderators Posted July 11, 2013 setElementVisibleTo ( theMarker, root, false ) local teamHuntPlayers = getPlayersInTeam (teamhunt) for i=1,#teamHuntPlayers do setElementVisibleTo ( theMarker,teamHuntPlayers[i], true ) end or create markers at client side. Maybe better.
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