Jump to content

question


ali

Recommended Posts

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?

Link to comment

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 by Guest
Link to comment
  
  
  
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 by Guest
Link to comment
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 ??

Link to comment

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 ) ) 

Link to comment
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

Link to comment
  • Moderators
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.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...