Jump to content

Help Me! With Simple Job Script!


Recommended Posts

local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function onMarkerHit (source, onMarkerHit, teamName) 
setPlayerTeam ( source, teamALSPD) 
end 
addEventHandler("onClientMarkerHit",marker) 
  

I scripted the code but when i enter the marker i don't get set to team please help someone!

I am still learning scripting ;)

Link to comment
local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( hS ) 
setPlayerTeam ( hS, teamALSPD ) 
end 
addEventHandler("onMarkerHit", marker, omh) 

Link to comment

Client Side #!

local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 ) 
  
function createTeamsOnStart () 
    local teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onClientResourceStart", resourceRoot, createTeamsOnStart) 
  
addEventHandler("onClientMarkerHit", marker 
    function onMarkerHit(player) 
        if not isPedInVehicle(player) then 
            if getElementType(player) == "player" then 
            setPlayerTeam ( player, teamALSPD) 
            end 
        end  
    end  
) 

Edited by Guest
Link to comment
Btw if its on that team how to give that team a weapon when onMarkerHit, giveWeapon how to do this?

Please help.

local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( hS ) 
setPlayerTeam ( hS, teamALSPD ) 
giveWeapon( hs, id, ammo ) -- set id and ammo 
giveWeapon( hs, id, ammo ) -- set id and ammo 
end 
addEventHandler("onMarkerHit", marker, omh) 

you can get id from

https://wiki.multitheftauto.com/wiki/Weapon

Link to comment
Btw if its on that team how to give that team a weapon when onMarkerHit, giveWeapon how to do this?

Please help.

local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( hS ) 
setPlayerTeam ( hS, teamALSPD ) 
giveWeapon( hs, id, ammo ) -- set id and ammo 
giveWeapon( hs, id, ammo ) -- set id and ammo 
end 
addEventHandler("onMarkerHit", marker, omh) 

you can get id from

https://wiki.multitheftauto.com/wiki/Weapon

Why giving weapon twice?

Link to comment

Nevert mind i got it to work :D

local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 )

function createTeamsOnStart ()

teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 )

end

addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart)

function omh ( source )

setPlayerTeam ( source, teamALSPD )

giveWeapon( source, 31, 1000 ) -- set id and ammo

giveWeapon( source, 31, 1000 ) -- set id and ammo

end

addEventHandler("onMarkerHit", marker, omh)

Link to comment
Nevert mind i got it to work :D
local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( source ) 
setPlayerTeam ( source, teamALSPD ) 
giveWeapon( source, 31, 1000 ) -- set id and ammo 
giveWeapon( source, 31, 1000 ) -- set id and ammo 
end 
addEventHandler("onMarkerHit", marker, omh) 

local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( source ) 
setPlayerTeam ( source, teamALSPD ) 
giveWeapon( source, 31, 1000 ) -- set id and ammo 1 time 
end 
addEventHandler("onMarkerHit", marker, omh) 

Link to comment
local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1.3, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( hS ) 
setPlayerTeam ( hS, teamALSPD ) 
giveWeapon( source, 31, 1000 ) 
end 
addEventHandler("onMarkerHit", marker, omh) 

Link to comment
local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1.3, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( hS ) 
setPlayerTeam ( hS, teamALSPD ) 
giveWeapon( source, 31, 1000 ) 
end 
addEventHandler("onMarkerHit", marker, omh) 

The source of the onMarkerHit event is the marker that got hit by the element.

Also, check if hS is a player element with getElementType.

Link to comment
local marker = createMarker ( 1545, -1669.6999511719, 12.60000038147, "cylinder", 1.3, 255, 255, 0, 165 ) 
function createTeamsOnStart () 
    teamALSPD = createTeam ( "Los Santos Police Department", 0, 255, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) 
  
function omh ( hS ) 
    if getElementType(hS) == 'player' then 
        setPlayerTeam ( hS, teamALSPD ) 
        giveWeapon( hS, 31, 1000 ) 
    end 
end 
addEventHandler("onMarkerHit", marker, omh) 

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