ali Posted July 10, 2013 Posted July 10, 2013 How to make a marker available for a team LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
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. If I helped you, please click the like button on the right Thanks!
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? LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
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. If I helped you, please click the like button on the right Thanks!
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 LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
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 LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
ali Posted July 11, 2013 Author Posted July 11, 2013 bump LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
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? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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 LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
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 ?? " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
ali Posted July 11, 2013 Author Posted July 11, 2013 Well i mean to make a marker visible for a team LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
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 ) ) " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
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 LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
Moderators IIYAMA Posted July 11, 2013 Moderators Posted July 11, 2013 https://wiki.multitheftauto.com/wiki/Se ... tVisibleTo Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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 LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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