Mark0 Posted September 19, 2012 Share Posted September 19, 2012 how to set that gate open only for Ex: Swat checkGateMarker = createMarker ( 216.22926330566, 1875.0806884766, 7.4616560935974, "corona", 10.0, 0, 0, 255, 0 ) function onPoliceShapeHit ( thePlayer, matchingDimension ) if ( getElementType ( thePlayer ) == "player" ) then outputChatBox ( "You have entered Police Base zone!", thePlayer, 0, 0, 255 ) end end addEventHandler ( "onColShapeHit", policeColShape, onPoliceShapeHit ) function createGate () gatePolice = createObject ( 976, 209.8828125, 1875.8419189453, 12.372331619263 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) moveObject ( gatePolice, 976, 218.11740112305, 1875.3406982422, 12.372331619263 ) end addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) function onLeave ( thePlayer, matchingDimension ) setTimer ( movingBackPolice, 3000, 1, thePlayer ) end addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) function movingBackPolice () moveObject ( gatePolice, 3000, 209.8828125, 1875.8419189453, 12.372331619263 ) end Link to comment
Baseplate Posted September 19, 2012 Share Posted September 19, 2012 use this getPlayerTeam Link to comment
Mark0 Posted September 19, 2012 Author Share Posted September 19, 2012 can u add it inside the script i don't know how to add it i'm a learner Link to comment
Castillo Posted September 19, 2012 Share Posted September 19, 2012 We help you understand here, we don't make stuff for you. Read about: getPlayerTeam and getTeamName Link to comment
Mark0 Posted September 19, 2012 Author Share Posted September 19, 2012 Yes i know but when you add it i can understand it better Link to comment
Baseplate Posted September 19, 2012 Share Posted September 19, 2012 But if we put it inside the script, you won't learn anything so I suggest to do what Solidsnake said Link to comment
Castillo Posted September 19, 2012 Share Posted September 19, 2012 Is it that hard to try at least doing it? Link to comment
Mark0 Posted September 19, 2012 Author Share Posted September 19, 2012 for you it's not hard but for me yes i'm learner @ samer insade the script i will understand it but like this i can't there is some words not needed om my script getPlayerTeam Link to comment
Castillo Posted September 19, 2012 Share Posted September 19, 2012 https://wiki.multitheftauto.com/wiki/GetPlayerTeam https://wiki.multitheftauto.com/wiki/GetTeamName Both have examples, read them and try to understand. Link to comment
Baseplate Posted September 19, 2012 Share Posted September 19, 2012 Lolz mate, DO IT!! I'm learning too lol...just click on that "getPlayerTeam". Link to comment
Mark0 Posted September 19, 2012 Author Share Posted September 19, 2012 i create this but don't work checkGateMarker = createMarker ( 216.22926330566, 1875.0806884766, 7.4616560935974, "corona", 10.0, 0, 0, 255, 0 ) function onPoliceShapeHit ( thePlayer, matchingDimension ) if ( getElementType ( thePlayer ) == "player" ) then outputChatBox ( "You have entered Police Base zone!", thePlayer, 0, 0, 255 ) end end addEventHandler ( "onColShapeHit", policeColShape, onPoliceShapeHit ) function show() if getPlayerTeam(getLocalPlayer()) == getTeamFromName("Medic") then moveObject ( gatePolice, 976, 218.11740112305, 1875.3406982422, 12.372331619263 ) end end addEventHandler ( "onMarkerHit", checkGateMarker, onLeave ) function createGate () gatePolice = createObject ( 976, 209.8828125, 1875.8419189453, 12.372331619263 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function gateCheckingTeam ( thePlayer, matchingDimension ) moveObject ( gatePolice, 976, 218.11740112305, 1875.3406982422, 12.372331619263 ) end addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) function onLeave ( thePlayer, matchingDimension ) setTimer ( movingBackPolice, 3000, 1, thePlayer ) end addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) function movingBackPolice () moveObject ( gatePolice, 3000, 209.8828125, 1875.8419189453, 12.372331619263 ) end Link to comment
Castillo Posted September 19, 2012 Share Posted September 19, 2012 getLocalPlayer is client side only, you must define the element that hit the marker, like this: function show ( thePlayer ) -- The first argument of this event is the element that hit it. if ( getPlayerTeam ( thePlayer ) == getTeamFromName ( "Medic" ) ) then moveObject ( gatePolice, 976, 218.11740112305, 1875.3406982422, 12.372331619263 ) end end addEventHandler ( "onMarkerHit", checkGateMarker, onLeave ) Link to comment
TAPL Posted September 19, 2012 Share Posted September 19, 2012 Also you need to use getElementType to make sure that what hit the marker is player. Link to comment
Mark0 Posted September 19, 2012 Author Share Posted September 19, 2012 not work i do exlacly what you say Link to comment
TAPL Posted September 19, 2012 Share Posted September 19, 2012 not work i do exlacly what you say function name is wrong here addEventHandler ( "onMarkerHit", checkGateMarker, onLeave ) should be: addEventHandler ( "onMarkerHit", checkGateMarker, show ) 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