Xwad Posted August 20, 2016 Share Posted August 20, 2016 The player blip is not working when the player spawns with id 21:/ server function setBlip(theSkin) if theSkin == 21 then outputChatBox("medic_blip") local blip_medic = createBlipAttachedTo ( source, 22 ) local team_axis = getTeamFromName(Axis) local players = getPlayersInTeam(team_axis) setElementVisibleTo(blip_medic, players, true) end end addEventHandler ( "onPlayerSpawn", getRootElement(), setBlip ) Link to comment
Hale Posted August 20, 2016 Share Posted August 20, 2016 function setBlip( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) if theSkin == 21 then outputChatBox("medic_blip", thePlayer, 255, 255 ,255) local blip_medic = createBlipAttachedTo ( source, 22 ) local players = getPlayersInTeam(theTeam) setElementVisibleTo(blip_medic, getRootElement(), true) end end addEventHandler ( "onPlayerSpawn", getRootElement(), setBlip ) Also, I don't see any 'createBlip' functions in your code? Link to comment
Gravestone Posted August 20, 2016 Share Posted August 20, 2016 function setBlip(_, _, _, _, _, theSkin) if theSkin == 21 then outputChatBox("medic_blip") local blip_medic = createBlipAttachedTo ( source, 22 ) local team_axis = getTeamFromName("Axis") local players = getPlayersInTeam(team_axis) for i, player in ipairs(players) do setElementVisibleTo(blip_medic, player, true) end end end addEventHandler ( "onPlayerSpawn", getRootElement(), setBlip ) Link to comment
Xwad Posted August 20, 2016 Author Share Posted August 20, 2016 ohh i thoguht createBlipAttachedTo would create a blip the wiki says: This function creates a blip that is attached to an element. So it creates the blip Link to comment
Xwad Posted August 20, 2016 Author Share Posted August 20, 2016 but its still not working Link to comment
Gravestone Posted August 20, 2016 Share Posted August 20, 2016 What is the error being shown in the debug? Link to comment
G-Stefan Posted August 20, 2016 Share Posted August 20, 2016 Try this(NOT TESTED): local medicsTeam = createTeam("Axis",255,0,0) function medicBlip() if getElementType(source) == "player" then if getElementModel(source) == 21 then setPlayerTeam(source,getTeamFromName("Axis")) local medics = getPlayersInTeam(getTeamFromName("Axis")) for i,v in pairs (medics) do createBlipAttachedTo(v,22) end end end end addEventHandler("onPlayerSpawn",root,medicBlip) addEventHandler("onElementModelChange",root,medicBlip) Link to comment
Xwad Posted August 20, 2016 Author Share Posted August 20, 2016 now its working but it has 2 bugs: The blip is visible to all teams. The blips icon is not 22:/ but i wrote 22 Link to comment
Xwad Posted August 20, 2016 Author Share Posted August 20, 2016 ohh i did not see your post G-Stefan. I gonna test it Link to comment
Xwad Posted August 20, 2016 Author Share Posted August 20, 2016 still has the same bugs:/ Link to comment
G-Stefan Posted August 20, 2016 Share Posted August 20, 2016 still has the same bugs:/ Explain me the bug EDIT:I tested the script and it works just perfect SERVER: local medicsTeam = createTeam("Axis",255,0,0) function medicBlip() if getElementType(source) == "player" then if getElementModel(source) == 21 then setPlayerTeam(source,getTeamFromName("Axis")) local medics = getPlayersInTeam(getTeamFromName("Axis")) for i,v in pairs (medics) do createBlipAttachedTo(v,22) end end end end addEventHandler("onPlayerSpawn",root,medicBlip) addEventHandler("onElementModelChange",root,medicBlip) META: Link to comment
Xwad Posted August 20, 2016 Author Share Posted August 20, 2016 Now it has only one bug: players from other teams can see the blip. I want to make that only teammates can see each other blips Link to comment
G-Stefan Posted August 20, 2016 Share Posted August 20, 2016 Now it has only one bug: players from other teams can see the blip. I want to make that only teammates can see each other blips Forgot to setElementVisibleTo local medicsTeam = createTeam("Axis",255,0,0) function medicBlip() if getElementType(source) == "player" then if getElementModel(source) == 21 then setPlayerTeam(source,getTeamFromName("Axis")) local medics = getPlayersInTeam(getTeamFromName("Axis")) for i,v in pairs (medics) do local blip = createBlipAttachedTo(v,22) for i,v in pairs(getElementsByType("player")) do local playerTeam = getTeamName(getPlayerTeam(v)) if playerTeam == "Axis" then setElementVisibleTo(blip,v,true) else setElementVisibleTo(blip,v,false) end end end end end end addEventHandler("onPlayerSpawn",root,medicBlip) addEventHandler("onElementModelChange",root,medicBlip) Link to comment
Gordon_G Posted August 23, 2016 Share Posted August 23, 2016 Humpf ... The createBlip or createBlipAttachedTo already got the "visibleto" createBlipAttachedTo ( element elementToAttachTo [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 99999.0, visibleTo = getRootElement( ) ] ) Try something like this : createBlipAttachedTo(v,22,2,255,0,0,255,0,99999.0,v) Instead of local blip = createBlipAttachedTo(v,22) for i,v in pairs(getElementsByType("player")) do local playerTeam = getTeamName(getPlayerTeam(v)) if playerTeam == "Axis" then setElementVisibleTo(blip,v,true) else setElementVisibleTo(blip,v,false) end end Link to comment
Xwad Posted August 23, 2016 Author Share Posted August 23, 2016 ok, i gonna try it thanks. Link to comment
Xwad Posted August 26, 2016 Author Share Posted August 26, 2016 now my problem is that no one can see the blips:/ function blip() if getElementType(source) == "player" then if getElementModel(source) == 20 or getElementModel(source) == 21 or getElementModel(source) == 22 or getElementModel(source) == 23 or getElementModel(source) == 24 then local players = getPlayersInTeam(getTeamFromName("Axis")) for i,v in pairs (players) do createBlipAttachedTo(v,58,2,255,0,0,255,0,99999.0,v) end end end end addEventHandler("onPlayerSpawn",root,blip) addEventHandler("onElementModelChange",root,blip) Link to comment
Ab-47 Posted August 26, 2016 Share Posted August 26, 2016 now my problem is that no one can see the blips:/ function blip() if getElementType(source) == "player" then if getElementModel(source) == 20 or getElementModel(source) == 21 or getElementModel(source) == 22 or getElementModel(source) == 23 or getElementModel(source) == 24 then local players = getPlayersInTeam(getTeamFromName("Axis")) for i,v in pairs (players) do createBlipAttachedTo(v,58,2,255,0,0,255,0,99999.0,v) end end end end addEventHandler("onPlayerSpawn",root,blip) addEventHandler("onElementModelChange",root,blip) local medicsTeam = createTeam("Axis",255,0,0) Link to comment
Xwad Posted August 26, 2016 Author Share Posted August 26, 2016 but in my script there are already a createTEam function Link to comment
Gordon_G Posted August 26, 2016 Share Posted August 26, 2016 but in my script there are already a createTEam function medicsTeam = createTeam("Axis",255,0,0) He's right. You should try with this first. Link to comment
Ab-47 Posted August 27, 2016 Share Posted August 27, 2016 but in my script there are already a createTEam function If the name of your team in your script is something other than "Axis" then change "Axis" to whatever the team is called. 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