SoMoRay Posted June 16, 2013 Posted June 16, 2013 hi guys what wrong he did't create blips to team police for _, playersP in ipairs ( getPlayersInTeam ( getTeamFromName ( "Police" ) ) ) do createBlipAttachedTo ( playerP , 0 , 2 , 0 , 0 , 255 , 255 ) end
DNL291 Posted June 16, 2013 Posted June 16, 2013 for _, playersP in ipairs ( getPlayersInTeam ( getTeamFromName ( "Police" ) ) ) do createBlipAttachedTo ( playersP , 0 , 2 , 0 , 0 , 255 , 255 ) end You had put 'playerP' instead of 'playersP'.
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 for _, playersP in ipairs ( getPlayersInTeam ( getTeamFromName ( "Police" ) ) ) do createBlipAttachedTo ( playersP , 0 , 2 , 0 , 0 , 255 , 255 ) end You had put 'playerP' instead of 'playersP'. still not do blips for it's ! (
Jaysds1 Posted June 16, 2013 Posted June 16, 2013 It seems as if the team "Police" isn't valid or maybe it's like this "police".
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 see guys this is the full code for createTeam with the blip addEventHandler("onResourceStart",resourceRoot, function() Team2 = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( Team2, false ) for _, playersP in ipairs ( getPlayersInTeam ( getTeamFromName ( "Police" ) ) ) do createBlipAttachedTo ( playersP , 0 , 2 , 0 , 0 , 255 , 255 ) end end) Edit : there is no any bug in debugscript i be crazy with him I saw non eror but I don't know why he didn't work fine ! .
PaiN^ Posted June 16, 2013 Posted June 16, 2013 The script should work just fine, Make sure that there are players in the "Police" team .
Jaysds1 Posted June 16, 2013 Posted June 16, 2013 try this: addEventHandler("onResourceStart",resourceRoot,function() if source~=resource then return end local policeTeam = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( policeTeam, false ) local players = getPlayersInTeam ( getTeamFromName ( "Police" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 0 , 2 , 0 , 0 , 255 , 255 ) end end)
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 try this:addEventHandler("onResourceStart",resourceRoot,function() if source~=resource then return end local policeTeam = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( policeTeam, false ) local players = getPlayersInTeam ( getTeamFromName ( "Police" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 0 , 2 , 0 , 0 , 255 , 255 ) end end) same proplem not make blip
iPrestege Posted June 16, 2013 Posted June 16, 2013 Change blip id 0 > 5 or anything you want and try.
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 Change blip id 0 > 5 or anything you want and try. same Proplem
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 Post what you did. local Team = createTeam ( "Alone", 255, 0, 0 ) setTeamFriendlyFire ( Team, false ) local policeTeam = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( policeTeam, false ) addEventHandler("onResourceStart",resourceRoot,function() if source~=resource then return end setTeamFriendlyFire ( Team, false ) local players = getPlayersInTeam ( getTeamFromName ( "Alone" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 58 , 2 , 255 , 0 , 0 , 255 ) end end) -------------------- police addEventHandler("onResourceStart",resourceRoot,function() if source~=resource then return end local players = getPlayersInTeam ( getTeamFromName ( "Police" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 58 , 2 , 0 , 0 , 255 , 255 ) end end)
iPrestege Posted June 16, 2013 Posted June 16, 2013 That's because the blip will shown for how have a police team when the resource start use a timer : setTimer
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 That's because the blip will shown for how have a police team when the resource start use a timer : setTimer Are You Main I Do Like that ? : local Team = createTeam ( "Alone", 255, 0, 0 ) setTeamFriendlyFire ( Team, false ) local policeTeam = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( policeTeam, false ) addEventHandler("onResourceStart",resourceRoot, function () setTimer(BlipT,1000,1) setTimer(BlipP,1000,1) end ) function BlipT() if source~=resource then return end setTeamFriendlyFire ( Team, false ) local players = getPlayersInTeam ( getTeamFromName ( "Alone" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 58 , 2 , 255 , 0 , 0 , 255 ) end end -------------------- police function BlipP() if source~=resource then return end local players = getPlayersInTeam ( getTeamFromName ( "Police" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 58 , 2 , 0 , 0 , 255 , 255 ) end end
iPrestege Posted June 16, 2013 Posted June 16, 2013 setTimer(BlipT,1000,0) setTimer(BlipP,1000,0) Remove if source~=resource line . And please tell us if there's a error or anything in the debug .
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 setTimer(BlipT,1000,0) setTimer(BlipP,1000,0) Remove if source~=resource line . And please tell us if there's a error or anything in the debug . no error debug and not work
SoMoRay Posted June 16, 2013 Author Posted June 16, 2013 Post the whole script. local Team = createTeam ( "Alone", 255, 0, 0 ) setTeamFriendlyFire ( Team, false ) local policeTeam = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( policeTeam, false ) addEventHandler("onResourceStart",resourceRoot, function () setTimer(BlipT,1000,0) setTimer(BlipP,1000,0) end ) function BlipT() if source~=resource then return end setTeamFriendlyFire ( Team, false ) local players = getPlayersInTeam ( getTeamFromName ( "Alone" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 0 , 2 , 255 , 0 , 0 , 255 ) end end -------------------- police function BlipP() if source~=resource then return end local players = getPlayersInTeam ( getTeamFromName ( "Police" ) ) if #players == 0 then return end --ends the script if there's no players on the police team for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 0 , 2 , 0 , 0 , 255 , 255 ) end end addEvent ( "spawnPed", true ) addEventHandler ( "spawnPed", root, function ( thePed ) if ( thePed == 2 ) then spawnPlayer ( source, 1485.0311279297, -2234.9086914063, 13.546875, 0, 2, 0, 0, Team ) setCameraTarget ( source, source ) elseif ( thePed == 280 ) then spawnPlayer ( source, 1568.5963134766, -1691.4530029297, 5.890625, 0, 280, 0, 0, policeTeam ) setCameraTarget ( source, source ) end end ) ------------------------------- kill ------------------------------------ function commitSuicide ( sourcePlayer ) killPed ( sourcePlayer, sourcePlayer ) end addCommandHandler ( "kill", commitSuicide ) ------------------------------------
iPrestege Posted June 16, 2013 Posted June 16, 2013 I said remove these lines : if source~=resource then return end if source~=resource then return end And there's no need to set a timer for team fire. Because it's not defined anywhere ( resource ) - ( source ) .
Castillo Posted June 16, 2013 Posted June 16, 2013 There's no need to use two timers, you can use just one. addEventHandler ( "onResourceStart", resourceRoot, function ( ) setTimer ( blips, 1000, 0 ) Team = createTeam ( "Alone", 255, 0, 0 ) setTeamFriendlyFire ( Team, false ) policeTeam = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( policeTeam, false ) end ) function blips ( ) local players = getPlayersInTeam ( getTeamFromName ( "Alone" ) ) if ( #players > 0 ) then for _, player in ipairs ( players ) do createBlipAttachedTo ( player, 0, 2 , 255 , 0 , 0 , 255 ) end end local players = getPlayersInTeam ( getTeamFromName ( "Police" ) ) if ( #players > 0 ) then for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 0 , 2 , 0 , 0 , 255 , 255 ) end end end addEvent ( "spawnPed", true ) addEventHandler ( "spawnPed", root, function ( thePed ) if ( thePed == 2 ) then spawnPlayer ( source, 1485.0311279297, -2234.9086914063, 13.546875, 0, 2, 0, 0, Team ) setCameraTarget ( source, source ) elseif ( thePed == 280 ) then spawnPlayer ( source, 1568.5963134766, -1691.4530029297, 5.890625, 0, 280, 0, 0, policeTeam ) setCameraTarget ( source, source ) end end ) ------------------------------- kill ------------------------------------ function commitSuicide ( sourcePlayer ) killPed ( sourcePlayer, sourcePlayer ) end addCommandHandler ( "kill", commitSuicide )
iPrestege Posted June 16, 2013 Posted June 16, 2013 There's no need to use two timers, you can use just one. addEventHandler ( "onResourceStart", resourceRoot, function ( ) setTimer ( blips, 1000, 0 ) Team = createTeam ( "Alone", 255, 0, 0 ) setTeamFriendlyFire ( Team, false ) policeTeam = createTeam ( "Police", 0, 0, 255 ) setTeamFriendlyFire ( policeTeam, false ) end ) function blips ( ) setTeamFriendlyFire ( Team, false ) local players = getPlayersInTeam ( getTeamFromName ( "Alone" ) ) if ( #players > 0 ) then for _, player in ipairs ( players ) do createBlipAttachedTo ( player, 0, 2 , 255 , 0 , 0 , 255 ) end end local players = getPlayersInTeam ( getTeamFromName ( "Police" ) ) if ( #players > 0 ) then for _, player in ipairs ( players ) do createBlipAttachedTo ( player , 0 , 2 , 0 , 0 , 255 , 255 ) end end end addEvent ( "spawnPed", true ) addEventHandler ( "spawnPed", root, function ( thePed ) if ( thePed == 2 ) then spawnPlayer ( source, 1485.0311279297, -2234.9086914063, 13.546875, 0, 2, 0, 0, Team ) setCameraTarget ( source, source ) elseif ( thePed == 280 ) then spawnPlayer ( source, 1568.5963134766, -1691.4530029297, 5.890625, 0, 280, 0, 0, policeTeam ) setCameraTarget ( source, source ) end end ) ------------------------------- kill ------------------------------------ function commitSuicide ( sourcePlayer ) killPed ( sourcePlayer, sourcePlayer ) end addCommandHandler ( "kill", commitSuicide ) There's no need to use setTeamFriendlyFire At blips function .
Castillo Posted June 16, 2013 Posted June 16, 2013 Well, it was on his code, so, I just left it as he made it.
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