sckatchof Posted December 16, 2011 Share Posted December 16, 2011 hello, why this code does not work ! WARNIG: TNS/Police/gate.lua:5: bad 'player' pointer @ 'getplayerteam'<1> WARNIG: TNS/Police/gate.lua:11: bad argument @ ''getplayerteam' local MarkerPolice = createMarker( 1588.4000244141, -1637, 11.39999961853, 'corona', 12.0, 0, 0, 255, 0) local Policegate1 = createObject(980, 1590.1999511719, -1638.4000244141, 15.199999809265, 0, 0, 0) function MarkerHit1 ( hitElement, matchingDimension ) if ( getPlayerTeam(hitElement) and getPlayerTeam(hitElement) == getTeamFromName("Police") ) then moveObject(Policegate1, 2000, 1598.1999511719, -1638.4000244141, 15.199999809265 ) end end function MarkerLeave1( leaveElement, matchingDimension ) if ( getPlayerTeam(leaveElement) and getPlayerTeam(leaveElement) == getTeamFromName("Police") ) then moveObject(Policegate1, 2000, 1590.1999511719, -1638.4000244141, 15.199999809265 ) end end addEventHandler( "onMarkerHit", MarkerPolice, MarkerHit1 ) addEventHandler( "onMarkerLeave", MarkerPolice, MarkerLeave1 ) Link to comment
myonlake Posted December 16, 2011 Share Posted December 16, 2011 First of all, are you sure the script is fixed already? Errors are saying different functions, which are basically already fixed in your script. However, you had doublecheck on the team section. You don't need to check the team and the name in seperate. When you check the name, it checks if the player is in the team anyways. local MarkerPolice = createMarker( 1588.4000244141, -1637, 11.39999961853, 'corona', 12.0, 0, 0, 255, 0) local Policegate1 = createObject(980, 1590.1999511719, -1638.4000244141, 15.199999809265, 0, 0, 0) function MarkerHit1(hitElement, matchingDimension) if getElementType(hitElement) == "player" then if (getPlayerTeam(hitElement) == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1598.1999511719, -1638.4000244141, 15.199999809265) end end end function MarkerLeave1(leaveElement, matchingDimension) if getElementType(hitElement) == "player" then if (getPlayerTeam(leaveElement) == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1590.1999511719, -1638.4000244141, 15.199999809265) end end end addEventHandler("onMarkerHit", MarkerPolice, MarkerHit1) addEventHandler("onMarkerLeave", MarkerPolice, MarkerLeave1) Link to comment
sckatchof Posted December 16, 2011 Author Share Posted December 16, 2011 (edited) The gate move its work thanks but there is some errors in cosole Edited December 16, 2011 by Guest Link to comment
mjau Posted December 16, 2011 Share Posted December 16, 2011 i think this happesn if you are not in a team... Link to comment
sckatchof Posted December 16, 2011 Author Share Posted December 16, 2011 i think this happesn if you are not in a team... I am in the 'Police' team !! Link to comment
myonlake Posted December 16, 2011 Share Posted December 16, 2011 What errors they are, mind giving me the errors? Link to comment
sckatchof Posted December 16, 2011 Author Share Posted December 16, 2011 What errors they are, mind giving me the errors? The gate move its work thanks but there is some errors in cosole Link to comment
Al3grab Posted December 16, 2011 Share Posted December 16, 2011 * line 13 : hitElement should be leaveElement local MarkerPolice = createMarker( 1588.4000244141, -1637, 11.39999961853, 'corona', 12.0, 0, 0, 255, 0) local Policegate1 = createObject(980, 1590.1999511719, -1638.4000244141, 15.199999809265, 0, 0, 0) addCommandHandler("1",function(plr) setElementPosition(plr,1588.4000244141+2, -1637, 11.39999961853 ) end ) function MarkerHit1(hitElement, matchingDimension) if getElementType(hitElement) == "player" then playerTeam = getPlayerTeam(hitElement) if playerTeam then if (playerTeam == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1598.1999511719, -1638.4000244141, 15.199999809265) end end end end function MarkerLeave1(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then playerTeam = getPlayerTeam(leaveElement) if playerTeam then if (getPlayerTeam(leaveElement) == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1590.1999511719, -1638.4000244141, 15.199999809265) end end end end addEventHandler("onMarkerHit", MarkerPolice, MarkerHit1) addEventHandler("onMarkerLeave", MarkerPolice, MarkerLeave1) Link to comment
sckatchof Posted December 16, 2011 Author Share Posted December 16, 2011 * line 13 : hitElement should be leaveElement local MarkerPolice = createMarker( 1588.4000244141, -1637, 11.39999961853, 'corona', 12.0, 0, 0, 255, 0) local Policegate1 = createObject(980, 1590.1999511719, -1638.4000244141, 15.199999809265, 0, 0, 0) addCommandHandler("1",function(plr) setElementPosition(plr,1588.4000244141+2, -1637, 11.39999961853 ) end ) function MarkerHit1(hitElement, matchingDimension) if getElementType(hitElement) == "player" then playerTeam = getPlayerTeam(hitElement) if playerTeam then if (playerTeam == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1598.1999511719, -1638.4000244141, 15.199999809265) end end end end function MarkerLeave1(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then playerTeam = getPlayerTeam(leaveElement) if playerTeam then if (getPlayerTeam(leaveElement) == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1590.1999511719, -1638.4000244141, 15.199999809265) end end end end addEventHandler("onMarkerHit", MarkerPolice, MarkerHit1) addEventHandler("onMarkerLeave", MarkerPolice, MarkerLeave1) thanksss it's work Link to comment
S3M Posted March 27, 2012 Share Posted March 27, 2012 * line 13 : hitElement should be leaveElement local MarkerPolice = createMarker( 1588.4000244141, -1637, 11.39999961853, 'corona', 12.0, 0, 0, 255, 0) local Policegate1 = createObject(980, 1590.1999511719, -1638.4000244141, 15.199999809265, 0, 0, 0) addCommandHandler("1",function(plr) setElementPosition(plr,1588.4000244141+2, -1637, 11.39999961853 ) end ) function MarkerHit1(hitElement, matchingDimension) if getElementType(hitElement) == "player" then playerTeam = getPlayerTeam(hitElement) if playerTeam then if (playerTeam == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1598.1999511719, -1638.4000244141, 15.199999809265) end end end end function MarkerLeave1(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then playerTeam = getPlayerTeam(leaveElement) if playerTeam then if (getPlayerTeam(leaveElement) == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1590.1999511719, -1638.4000244141, 15.199999809265) end end end end addEventHandler("onMarkerHit", MarkerPolice, MarkerHit1) addEventHandler("onMarkerLeave", MarkerPolice, MarkerLeave1) thanksss it's work Lol i find the same problem with the same script, I had a topic on here opened today https://forum.multitheftauto.com/viewtopic.php?f=91&t=41715 Link to comment
sckatchof Posted March 27, 2012 Author Share Posted March 27, 2012 i make a different script for gates 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