Dentos Posted September 20, 2014 Share Posted September 20, 2014 So i been trying load this resource for player blip but as much as try it wont load here it is playerblips.lua local pBlips = { } addEventHandler("onResourceStart", resourceRoot, function() for index, player in ipairs(getElementsByType("player")) do addTeamBlip(player) end end ) function addTeamBlip(player) if ( pBlips[player] ) then return false end -- Adding a prevention of duplicate blips local pAccount = getPlayerAccount(player) local theGang = ( pAccount and isGuestAccount(pAccount) and false ) or exports["gang_system"]:getAccountGang(pAccount) if ( theGang ) then local r, g, b = getPlayerNametagColor( player ) local theBlip = createBlipAttachedTo( player, 0, 2, r, g, b ) -- Change visibility to only the team members setElementVisibleTo( theBlip, root, false ) for index, value in ipairs ( exports["gang_system"]:getGangMembers(theGang) ) do setElementVisibleTo( theBlip, value, true ) end pBlips[player] = theBlip end end function destroyBlip(element) local theElement = source or element if ( theElement ) then destroyElement(pBlips[theElement]) pBlips[theElement] = nil -- Just in-case... end end -- Events addEventHandler ( "onPlayerSpawn", root, addTeamBlip ) -- onPlayerSpawn will now add a teamBlip addEventHandler ( "onPlayerQuit", root, destroyBlip ) addEventHandler ( "onPlayerWasted", root, destroyBlip )] meta.xml Ive tried doing refresh on console and everything but server wont load it please help other resources load just fine Link to comment
DakiLLa Posted September 20, 2014 Share Posted September 20, 2014 First what you have to do is check /debugscript 3 and tell us if there are any errors popped up there. Link to comment
Anubhav Posted September 20, 2014 Share Posted September 20, 2014 local pBlips = { } addEventHandler("onResourceStart", resourceRoot, function() for index, player in ipairs(getElementsByType("player")) do addTeamBlip(player) end end ) function addTeamBlip(player) if ( pBlips[player] ) then return false end -- Adding a prevention of duplicate blips local pAccount = getPlayerAccount(player) local theGang = ( pAccount and isGuestAccount(pAccount) == false ) or exports["gang_system"]:getAccountGang(pAccount) if ( theGang ) then local r, g, b = getPlayerNametagColor( player ) local theBlip = createBlipAttachedTo( player, 0, 2, r, g, b ) -- Change visibility to only the team members setElementVisibleTo( theBlip, root, false ) for index, value in ipairs ( exports["gang_system"]:getGangMembers(theGang) ) do setElementVisibleTo( theBlip, value, true ) end pBlips[player] = theBlip end end function destroyBlip(element) local theElement = source or element if ( theElement ) then destroyElement(pBlips[theElement]) pBlips[theElement] = nil -- Just in-case... end end -- Events addEventHandler ( "onPlayerSpawn", root, addTeamBlip ) -- onPlayerSpawn will now add a teamBlip addEventHandler ( "onPlayerQuit", root, destroyBlip ) addEventHandler ( "onPlayerWasted", root, destroyBlip ) @Dakilla: Read his script properly and see the last line. An ] and one more thing he did at line 14 Link to comment
Dentos Posted September 20, 2014 Author Share Posted September 20, 2014 Sorry the ] was for closing [ /lua ] added an extra by accident I dont think it recognizes as a resource since in console after refresh I dont get failed to load Link to comment
Anubhav Posted September 20, 2014 Share Posted September 20, 2014 It loads perfect for me. Please see if the meta.xml exists in the folder where script is. 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