S3M Posted March 27, 2012 Posted March 27, 2012 This script is from resource named "door" made by DakiLLa. Now I have been trying to try that player need police skin or needed police team then the door goes open onmarkerhit. I have tried many ways to add that feature, but until now no good result I have multiple doors I would like to add this feature. Someone who can fix this feature? If this has been fixed then I can the rest of the doors on my map also, it would be awesome. checkGateMarker = createMarker ( 1588.455078125, -1638.328125, 13.391061782837, "corona", 10, 0, 0, 255, 0 ) function createGate () gatePolice = createObject ( 10558, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 89.000000 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 18.5, 0.000000, 0.000000, 0.000000 ) end addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) function onLeave ( thePlayer, matchingDimension ) setTimer ( movingBackPolice, 3000, 1, thePlayer ) end addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) function movingBackPolice () moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 0.000000 ) end createBlip ( 1588.455078125, -1638.328125, 13.391061782837, 37 ) Thanks.
GanJaRuleZ Posted March 27, 2012 Posted March 27, 2012 local team = getTeamFromName("Police") checkGateMarker = createMarker ( 1588.455078125, -1638.328125, 13.391061782837, "corona", 10, 0, 0, 255, 0 ) function createGate () gatePolice = createObject ( 10558, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 89.000000 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) local pteam = getPlayerTeam(thePlayer) if ( pteam == team ) then moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 18.5, 0.000000, 0.000000, 0.000000 ) else -- code end addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) function onLeave ( thePlayer, matchingDimension ) local pteam = getPlayerTeam(thePlayer) if ( pteam == team ) then setTimer ( movingBackPolice, 3000, 1, thePlayer ) else --code end addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) function movingBackPolice () moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 0.000000 ) end createBlip ( 1588.455078125, -1638.328125, 13.391061782837, 37 ) Hope i helped.
S3M Posted March 27, 2012 Author Posted March 27, 2012 local team = getTeamFromName("Police") checkGateMarker = createMarker ( 1588.455078125, -1638.328125, 13.391061782837, "corona", 10, 0, 0, 255, 0 ) function createGate () gatePolice = createObject ( 10558, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 89.000000 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) local pteam = getPlayerTeam(thePlayer) if ( pteam == team ) then moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 18.5, 0.000000, 0.000000, 0.000000 ) else -- code end addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) function onLeave ( thePlayer, matchingDimension ) local pteam = getPlayerTeam(thePlayer) if ( pteam == team ) then setTimer ( movingBackPolice, 3000, 1, thePlayer ) else --code end addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) function movingBackPolice () moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 0.000000 ) end createBlip ( 1588.455078125, -1638.328125, 13.391061782837, 37 ) Hope i helped. Thx for help me out, but now there is a error on line 184, it says: 'end' expected (to close 'function')
Castillo Posted March 27, 2012 Posted March 27, 2012 function createGate ( ) gatePolice = createObject ( 10558, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 89.000000 ) team = getTeamFromName ( "Police" ) checkGateMarker = createMarker ( 1588.455078125, -1638.328125, 13.391061782837, "corona", 10, 0, 0, 255, 0 ) createBlipAttachedTo ( checkGateMarker, 37 ) addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) end addEventHandler ( "onResourceStart", resourceRoot, createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) local pteam = getPlayerTeam ( thePlayer ) if ( pteam == team ) then moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 18.5, 0.000000, 0.000000, 0.000000 ) else -- code end end function onLeave ( thePlayer, matchingDimension ) local pteam = getPlayerTeam ( thePlayer ) if ( pteam == team ) then setTimer ( movingBackPolice, 3000, 1, thePlayer ) else --code end end function movingBackPolice ( ) moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 0.000000 ) end
S3M Posted March 27, 2012 Author Posted March 27, 2012 function createGate ( ) gatePolice = createObject ( 10558, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 89.000000 ) team = getTeamFromName ( "Police" ) checkGateMarker = createMarker ( 1588.455078125, -1638.328125, 13.391061782837, "corona", 10, 0, 0, 255, 0 ) createBlipAttachedTo ( checkGateMarker, 37 ) addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) end addEventHandler ( "onResourceStart", resourceRoot, createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) local pteam = getPlayerTeam ( thePlayer ) if ( pteam == team ) then moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 18.5, 0.000000, 0.000000, 0.000000 ) else -- code end end function onLeave ( thePlayer, matchingDimension ) local pteam = getPlayerTeam ( thePlayer ) if ( pteam == team ) then setTimer ( movingBackPolice, 3000, 1, thePlayer ) else --code end end function movingBackPolice ( ) moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 0.000000 ) end Its working now with player on team police, but it give this warning to: Bad 'player' pointer @ 'getPlayerTeam'(1) on that scrip at line180
S3M Posted March 27, 2012 Author Posted March 27, 2012 function createGate ( ) gatePolice = createObject ( 10558, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 89.000000 ) team = getTeamFromName ( "Police" ) checkGateMarker = createMarker ( 1588.455078125, -1638.328125, 13.391061782837, "corona", 10, 0, 0, 255, 0 ) createBlipAttachedTo ( checkGateMarker, 37 ) addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) end addEventHandler ( "onResourceStart", resourceRoot, createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) local pteam = getPlayerTeam ( thePlayer ) if ( pteam == team ) then moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 18.5, 0.000000, 0.000000, 0.000000 ) else -- code end end function onLeave ( thePlayer, matchingDimension ) local pteam = getPlayerTeam ( thePlayer ) if ( pteam == team ) then setTimer ( movingBackPolice, 3000, 1, thePlayer ) else --code end end function movingBackPolice ( ) moveObject ( gatePolice, 3000, 1588.9000244141, -1638.4000244141, 14.5, 0.000000, 0.000000, 0.000000 ) end Its working now with player on team police, but it give this warning to: Bad 'player' pointer @ 'getPlayerTeam'(1) on that scrip at line180 I was wrong, there is a problem with line 14 and 23. warning Bad 'player' pointer @ 'getPlayerTeam'(1)
S3M Posted March 27, 2012 Author Posted March 27, 2012 okay thanks for the attention, I found the solution on another topic it was about the same problem and script.
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