Jump to content

add gun to marker


Recommended Posts

hi guyz. this is script which is to make marker and when player get in the will get full health and armor

but i want to add gun:M4 with ammo

local team = createTeam ( "TeamName", 0, 255, 0 ) 
local theMarker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) 
  
addEventHandler("onMarkerHit", theMarker, 
function (thePlayer) 
if ( getElementType ( thePlayer ) == 'player' ) then 
if ( getPlayerTeam ( thePlayer ) and getTeamName ( getPlayerTeam ( thePlayer ) ) == 'TeamName' ) then 
setElementHealth ( thePlayer, 100 ) 
setPedArmor ( thePlayer, 100 ) 
        end 
    end 
end 
) 
  

and here i can add the X, Y, Z for where the marker will be ?

local theMarker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) 

Link to comment
  
local team = createTeam ( "TeamName", 0, 255, 0 ) 
local theMarker = createMarker ( -711.68450927734, 957.69964599609, 12.388543128967, "cylinder", 1.5, 255, 255, 0, 170 ) 
  
addEventHandler("onMarkerHit", theMarker, 
function (thePlayer) 
if ( getElementType ( thePlayer ) == 'player' ) then 
if ( getPlayerTeam ( thePlayer ) and getTeamName ( getPlayerTeam ( thePlayer ) ) == 'TeamName' ) then 
    setElementHealth ( thePlayer, 100 ) 
    setPedArmor ( thePlayer, 100 ) 
    giveWeapon ( thePlayer, 31, 2000 ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), giveWeaponsOnSpawn ) 
    end 
end 
) 
  
  

Edited by Guest
Link to comment

I don't understand why this line is here?

addEventHandler ( "onPlayerSpawn", getRootElement(), giveWeaponsOnSpawn ) 

And you trying to give weapon to marker? The marker have no hand to carry the gun.

giveWeapon ( source, 31, 2000 ) 

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