5150 Posted October 16, 2015 Share Posted October 16, 2015 im going to post this one more time, because i feel like i didnt explain it well enough last time... does anyone have a script where when you start the resource, blips and nametags for one specific team become invisible, and when you stop the resource, the blips/tags are returned? i want to use it as a stealth feature for my gang. basically i want everyone elses blip/tag to stay the same, but i want the blips/tags for Psycho Mans Gang members to disappear from the map on resource start Thanks for your help Link to comment
alberto2345 Posted October 16, 2015 Share Posted October 16, 2015 I've tested the code to see if it throws any errors (which it doesnt), but I'm not sure if it fully works with multiple people, so if it doesn't, please let me know. And I've commented it as best I can to help explain what it does for your benefit. Client: --Created client side as it doesnt NEED to be on the server side function removeBlipAndNametag() --Check if the player is in a team if (getPlayerTeam(localPlayer)) then --Check if the client is in the team "Psycho Mans Gang" if (getTeamName(getPlayerTeam(localPlayer)) == "Psycho Mans Gang") then --Disable/hide the players nametag setPlayerNametagShowing(localPlayer, false) --Loop through the table of all the elements of the player --We want to find the blip element attached to them for i, blip in pairs(getAttachedElements(localPlayer)) do --Check if an element in the table is a blip if (getElementType(blip) == "blip") then --Destroy the blip destroyElement(blip) outputChatBox("Destroyed") end end end end end --Activated once the resource starts addEventHandler("onClientResourceStart", root, removeBlipAndNametag) Server: --Created this on the server side so that all people on the server can see the blip that is created function addBackBlipAndNametag() --Loop through the table of players found in the team "Psycho Mans Gang" for i, players in pairs(getPlayersInTeam(getTeamFromName("Psycho Mans Gang"))) do --Enable/show the nametag of all the players in the team setPlayerNametagShowing(players, true) --Attach a blip thats of size 2 and red to all the players in the team createBlipAttachedTo(players, 0, 2, 255, 0, 0, 255) end end --Activates when the resource stops addEventHandler("onResourceStop", root, addBackBlipAndNametag) Meta: Link to comment
5150 Posted October 16, 2015 Author Share Posted October 16, 2015 man youre awesome and just to be sure, the whole server will not see PMGs blips or tags when i start this? Link to comment
alberto2345 Posted October 16, 2015 Share Posted October 16, 2015 man youre awesome and just to be sure, the whole server will not see PMGs blips or tags when i start this? Try it and see if it does what you want it to do, otherwise let me know. Link to comment
5150 Posted October 16, 2015 Author Share Posted October 16, 2015 ok it will be several hours before i can test it so just keep an eye on this post and i will tell you if it works Link to comment
5150 Posted October 16, 2015 Author Share Posted October 16, 2015 just tried it. i saw the destroyed output in chat but nothing happened Link to comment
alberto2345 Posted October 16, 2015 Share Posted October 16, 2015 just tried it. i saw the destroyed output in chat but nothing happened Are you using freeroam? If you are, then I think thats the reason why it wont destroy it for some reason. However when I tested it and created a blip using runcode, when I started the script it destroyed it. Oh, and you can remove the output if you want to, it was only there for when I was testing it Link to comment
5150 Posted October 16, 2015 Author Share Posted October 16, 2015 ill probably remove the output lol. so it doesnt work on freeroam? 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