waqaarali Posted July 13, 2013 Share Posted July 13, 2013 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
New programmer Posted July 13, 2013 Share Posted July 13, 2013 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
iMr.3a[Z]eF Posted July 13, 2013 Share Posted July 13, 2013 (edited) 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 July 13, 2013 by Guest Link to comment
waqaarali Posted July 13, 2013 Author Share Posted July 13, 2013 6ArHxiMr'3a[Z]eF your script don't work but New Programmers does Link to comment
iMr.3a[Z]eF Posted July 13, 2013 Share Posted July 13, 2013 lol ok i forget it's server side Link to comment
waqaarali Posted July 13, 2013 Author Share Posted July 13, 2013 Btw if its on that team how to give that team a weapon when onMarkerHit, giveWeapon how to do this? Please help. Link to comment
New programmer Posted July 13, 2013 Share Posted July 13, 2013 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
New programmer Posted July 13, 2013 Share Posted July 13, 2013 thnx again lol Welcome! Link to comment
waqaarali Posted July 13, 2013 Author Share Posted July 13, 2013 It dont work whats is ( hs, id, ammo ) what does hs mean .... Link to comment
iMr.3a[Z]eF Posted July 13, 2013 Share Posted July 13, 2013 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
waqaarali Posted July 13, 2013 Author Share Posted July 13, 2013 Nevert mind i got it to work 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
iMr.3a[Z]eF Posted July 13, 2013 Share Posted July 13, 2013 Nevert mind i got it to work 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
New programmer Posted July 13, 2013 Share Posted July 13, 2013 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
DNL291 Posted July 14, 2013 Share Posted July 14, 2013 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
New programmer Posted July 14, 2013 Share Posted July 14, 2013 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
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