Reinhard Posted February 2, 2017 Share Posted February 2, 2017 When im alone in the server it works. but when there are many players it doesn't why does it still show the blip to the people not in the "Survivors" team? help please! function scheck() local team = getPlayerTeam(source) if getTeamName(team) == "Survivors" then blips[vehicles] = createBlipAttachedTo(vehicle, 51) return end destroyElement(blips[vehicles]) end addEventHandler("onPlayerSpawn", getRootElement(), scheck) function createVehicles ( ) loc = math.random ( #vehicles ) vehicle = createVehicle ( 609, vehicles[loc][1], vehicles[loc][2], vehicles[loc][3], 0, 0, 0) addEventHandler ( "onVehicleEnter", vehicle, start ) addEventHandler ( "onVehicleExit", vehicle, removedata2 ) addEventHandler ( "onVehicleExplode", vehicle, fail ) local theTeam = getTeamFromName("Survivors") if not theTeam then return end for k,v in ipairs(getPlayersInTeam(theTeam)) do blips[vehicles] = createBlipAttachedTo(vehicle, 51) outputChatBox("[Weapon Delivery] Weapon delivery truck available!", v, 100, 0, 0, true) end end Link to comment
Yazir Posted February 2, 2017 Share Posted February 2, 2017 (edited) It is serverside script, yes? if getTeamName(team) == "Survivors" then blips[vehicles] = createBlipAttachedTo(vehicle, 51, nil,nil,nil,nil,nil,nil,nil,getPlayersInTeam("Survivors")) return end Replace line 3. Edited February 2, 2017 by Yazir Link to comment
Reinhard Posted February 3, 2017 Author Share Posted February 3, 2017 (edited) it works at the first time but the second time it doesnt... expected element at argument 10: got table, at line 3 e.e createBlipAttachedTo the problem is in the getPlayersInTeam it's arg 10. i tried this and it doesn't give the error anymore and it works.. but when there are many players in the server will it still work?? if getTeamName(team) == "Survivors" then blips[vehicles] = createBlipAttachedTo(vehicle, 51, nil,nil,nil,nil,nil,nil,nil,getPlayersInTeam("Survivors")) return end when i keep respawning over and over again with different teams it still shows the blip.... Edited February 3, 2017 by Reinhard Link to comment
Reinhard Posted February 3, 2017 Author Share Posted February 3, 2017 (edited) any help Edited February 3, 2017 by Reinhard Link to comment
Reinhard Posted February 3, 2017 Author Share Posted February 3, 2017 (edited) 1 hour ago, Reinhard said: when i keep respawning over and over again with different teams it still shows the blip.... found solution on this one. Edited February 3, 2017 by Reinhard Link to comment
Reinhard Posted February 3, 2017 Author Share Posted February 3, 2017 (edited) why am i getting destroyElement expected element at argument 1 warning???? it's pretty annoying. when i spawn as different teams over and over again... function scheck() if source and getElementType ( source ) == 'player' then local team = getPlayerTeam(source) local teamname = getTeamFromName("Survivors") if getTeamName(team) == "Survivors" then setTimer(function() blips[vehicles] = createBlipAttachedTo(vehicle, 51, nil,nil,nil,nil,nil,nil,nil,nil) end , 1000, 1) end if not blips[vehicles] then return end destroyElement(blips[vehicles]) end end addEventHandler("onPlayerSpawn", getRootElement(), scheck) Edited February 3, 2017 by Reinhard 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