Hassam Posted March 29, 2014 Posted March 29, 2014 Hello, I need help, the problem is I can't set my job to team (it's only work for Occupation). local job = {} createTheJobs = function() for a,b in ipairs(jobs) do marker = createMarker(b.markerX, b.markerY, b.markerZ, "cylinder", markerSize or 2, b.markerColorR, b.markerColorG, b.markerColorB) blip = createBlipAttachedTo(marker,b.blip) setElementVisibleTo (blip, root, b.alpha) setBlipVisibleDistance(blip, 500) setElementData(marker, "title", b.jobTitle) setElementData(marker, "group", b.group) setElementData(marker, "team", b.team) job[marker] = b.group setElementData(marker, "info", b.information) setElementData(marker, "skins", b.skins) addEventHandler("onMarkerHit", marker, handleJobMarkerHit) end end addEventHandler("onResourceStart", resourceRoot, createTheJobs) handleJobMarkerHit = function(player) local role = getElementData(source,"group") if (getElementType(player) == "player") then if (getElementData(player, dataToFindPlayersJob) == role or role == "ALL") then if isPedInVehicle(player) then return end local info= getElementData(source, "info") local skin= getElementData(source, "skins") triggerClientEvent(player, "jobsystem.showJobGUI", root, getElementData(source, "title"), skin, info) else exports["TopBarChat"]:sendClientMessage("This marker is allowed for only "..role.." group.", player, 255, 0, 0) end end end onPlayerAcceptJob = function(job, skin) setElementModel(client, skin) setElementData(client, "Occupation", job) exports["TopBarChat"]:sendClientMessage("You're working as "..job, client, 0, 255, 0) setPlayerNametagColor (client, getMarkerColor(marker)) local team = getElementData(source, "team") if getTeamName(team) == true then setPlayerTeam(client, team) end end addEvent("onPlayerAcceptJob", true) addEventHandler("onPlayerAcceptJob", root, onPlayerAcceptJob) I tried getTeamName and getTeamFromName.
Castillo Posted March 29, 2014 Posted March 29, 2014 What does "team" element data contain? Edit: You do understand that the "marker" variable is being overwritten everytime? you should store the job marker using the job name in a table. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Hassam Posted March 29, 2014 Author Posted March 29, 2014 What does "team" element data contain?Edit: You do understand that the "marker" variable is being overwritten everytime? you should store the job marker using the job name in a table. ahh okay, it's like marker[1], marker[2], etc..? Markers= [1] - "BlaBla", [2] - "Bla",
.:HyPeX:. Posted March 29, 2014 Posted March 29, 2014 No. Markers = {} Marker[1] = "BlaBla" Marker[2] = "Bla" etc.. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Castillo Posted March 29, 2014 Posted March 29, 2014 local job = {} local markers = { } createTheJobs = function() for a,b in ipairs(jobs) do marker = createMarker(b.markerX, b.markerY, b.markerZ, "cylinder", markerSize or 2, b.markerColorR, b.markerColorG, b.markerColorB) markers [ b.jobTitle ] = marker blip = createBlipAttachedTo(marker,b.blip) setElementVisibleTo (blip, root, b.alpha) setBlipVisibleDistance(blip, 500) setElementData(marker, "title", b.jobTitle) setElementData(marker, "group", b.group) setElementData(marker, "team", b.team) job[marker] = b.group setElementData(marker, "info", b.information) setElementData(marker, "skins", b.skins) addEventHandler("onMarkerHit", marker, handleJobMarkerHit) end end addEventHandler("onResourceStart", resourceRoot, createTheJobs) handleJobMarkerHit = function(player) local role = getElementData(source,"group") if (getElementType(player) == "player") then if (getElementData(player, dataToFindPlayersJob) == role or role == "ALL") then if isPedInVehicle(player) then return end local info= getElementData(source, "info") local skin= getElementData(source, "skins") triggerClientEvent(player, "jobsystem.showJobGUI", root, getElementData(source, "title"), skin, info) else exports["TopBarChat"]:sendClientMessage("This marker is allowed for only "..role.." group.", player, 255, 0, 0) end end end onPlayerAcceptJob = function(job, skin) setElementModel(client, skin) setElementData(client, "Occupation", job) exports["TopBarChat"]:sendClientMessage("You're working as "..job, client, 0, 255, 0) local marker = markers [ job ] if ( marker ) then setPlayerNametagColor ( client, getMarkerColor(marker)) local team = getElementData(marker, "team") local team = getTeamFromName ( team ) if ( team ) then setPlayerTeam(client, team) end end addEvent("onPlayerAcceptJob", true) addEventHandler("onPlayerAcceptJob", root, onPlayerAcceptJob) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted March 29, 2014 Posted March 29, 2014 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Hassam Posted March 29, 2014 Author Posted March 29, 2014 ahhh, I need another help, I can't take the job with my group handleJobMarkerHit = function(player) local role = getElementData(source,"group") if (getElementType(player) == "player") then if (not exports.groupsys:checkGroupAccess(player, 16)) then return end if (getElementData(player, dataToFindPlayersJob) == role or role == "ALL") then if isPedInVehicle(player) then return end local info= getElementData(source, "info") local skin= getElementData(source, "skins") triggerClientEvent(player, "jobsystem.showJobGUI", root, getElementData(source, "title"), skin, info) else exports["TopBarChat"]:sendClientMessage("This marker is allowed for only "..role.." group.", player, 255, 0, 0) end end end
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