mrspeedycat Posted May 28, 2012 Posted May 28, 2012 Hi guys! i have a problem, when i start the server the console say : "deuren.lua:60: Bad argument @ 'getPlayerTeam'" here is the deuren.lua: CarGarageDeur = createObject ( 11416, -2626.72, 1375.19, 8.04, 0, 0, 0 ) CarGarageDeur2= createObject ( 11327, -2610.13, 1386.20, 8.844, 0, 0, 142.63 ) PoliceGarageDeur1 = createObject ( 980, -1636.26, 688.45, 8.9, 0, 0, 180 ) PoliceGarageDeur2 = createObject ( 980, -1624.78, 688.45, 8.9, 0, 0, 0 ) PolitieBarrier1 = createObject ( 968, -1572.23, 658.88, 6.74, 0, -90, 270 ) PolitieBarrier2 = createObject ( 968, -1701.49, 687.60, 24.73, 0, 90, 270 ) jaildoor = createObject ( 3109, -1618.52, 680.93, 7.38, 0, 0, 0 ) autogarage_autodeur = createObject ( 10182, -1494.76, 722.49, 7.89, 0, 0, 270 ) autogarage_deur = createObject ( 1506, -1529.26, 722.85, 6.35, 0, 0, 0 ) SandroGarageDeur = createObject ( 17951, -2678.49, -279.23, 8.02, 0, 0, 315.24 ) function doorsOpen (thePlayer, command, garageID) local hetteam = getPlayerTeam ( thePlayer ) if garageID == "1" then if ( hetteam == teammechanic ) then moveObject (CarGarageDeur, 5000, -2626.72, 1375.19, 4, 0, 0, 0 ) end end if garageID == "2" then if ( hetteam == teammechanic ) then moveObject (CarGarageDeur2, 5000, -2610.13, 1386.20, 4.74, 0, 0, 0 ) end end if garageID == "1" then if ( hetteam == teampolice ) then moveObject (PoliceGarageDeur1, 10000, -1647.26, 688.45, 8.9, 0, 0, 0 ) moveObject (PoliceGarageDeur2, 10000, -1613.78, 688.45, 8.9, 0, 0, 0 ) end end if garageID == "2" then if ( hetteam == teampolice ) then moveObject (jaildoor, 500, -1618.52, 680.93, 9.63, 0, 0, 0 ) end end if garageID == "1" then if ( hetteam == teamhippie ) then moveObject (autogarage_autodeur, 5000, -1494.76, 722.49, 4.69, 0, 0, 0 ) end end if garageID == "2" then if ( hetteam == teamhippie ) then moveObject (autogarage_deur, 500, -1529.26, 722.85, 3.80, 0, 0, 0 ) end end if garageID == "palladiostraat47" then moveObject (SandroGarageDeur, 1000, -2678.49, -279.23, 4.47, 0, 0, 0 ) end if garageID == false then outputChatBox("Failed to open garage.",thePlayer) end end addCommandHandler ( "open", doorsOpen ) function doorsClose (thePlayer, command, garageID) local hetteam = getPlayerTeam ( thePlayer ) if garageID == "1" then if ( hetteam == teammechanic ) then moveObject (CarGarageDeur, 5000, -2626.72, 1375.19, 8.04, 0, 0, 0 ) end end if garageID == "2" then if ( hetteam == teammechanic ) then moveObject (CarGarageDeur2, 5000, -2610.13, 1386.20, 8.844, 0, 0, 0 ) end end if garageID == "1" then if ( hetteam == teampolice ) then moveObject (PoliceGarageDeur1, 10000, -1636.26, 688.45, 8.9, 0, 0, 0 ) moveObject (PoliceGarageDeur2, 10000, -1624.78, 688.45, 8.9, 0, 0, 0 ) end end -- if garageID == "1" then -- if ( hetteam == teampolice ) then -- moveObject (PolitieBarrier1, 1000, -1572.23, 658.88, 6.74, 0, -90, 0 ) -- end -- end -- if garageID == "2" then -- if ( hetteam == teampolice ) then -- moveObject (PolitieBarrier2, 1000, -1701.49, 687.60, 24.73, 0, 90, 0 ) -- end -- end if garageID == "2" then if ( hetteam == teampolice ) then moveObject (jaildoor, 500, -1618.52, 680.93, 7.38, 0, 0, 0 ) end end if garageID == "1" then if ( hetteam == teamhippie ) then moveObject (autogarage_autodeur, 5000, -1494.76, 722.49, 7.89, 0, 0, 0 ) end end if garageID == "2" then if ( hetteam == teamhippie ) then moveObject (autogarage_deur, 500, -1529.26, 722.85, 6.35, 0, 0, 0 ) end end if garageID == "palladiostraat47" then moveObject (SandroGarageDeur, 1000, -2678.49, -279.23, 8.02, 0, 0, 0 ) end if garageID == false then outputChatBox("Failed to close garage.",thePlayer) end end addCommandHandler ( "close", doorsClose ) setTimer (doorsClose, 50, 120000) -- automatische poortjes marker1 = createMarker ( -1572.29, 662.37, 7.18, "cylinder", 12, 130, 130, 130, 0, getRootElement () ) marker2 = createMarker ( -1700.84, 684.15, 24.09, "cylinder", 12, 130, 130, 130, 0, getRootElement () ) function openPoliceBarrier1 () moveObject (PolitieBarrier1, 1000, -1572.23, 651.88, 6.74, 0, 0, 0 ) end function closePoliceBarrier1 () moveObject (PolitieBarrier1, 1000, -1572.23, 658.88, 6.74, 0, 0, 0 ) end addEventHandler ("onMarkerHit", marker1, openPoliceBarrier1 ) addEventHandler ("onMarkerLeave", marker1, closePoliceBarrier1 ) function openPoliceBarrier2 () moveObject (PolitieBarrier2, 1000, -1701.49, 694.60, 24.73, 0, 0, 0 ) end function closePoliceBarrier2 () moveObject (PolitieBarrier2, 1000, -1701.49, 687.60, 24.73, 0, 0, 0 ) end addEventHandler ("onMarkerHit", marker2, openPoliceBarrier2 ) addEventHandler ("onMarkerLeave", marker2, closePoliceBarrier2 ) Can someone help me, pls?
abu5lf Posted May 28, 2012 Posted May 28, 2012 local gPT = getPlayerTeam ( player ) local gTN = getTeamName ( gPT ) if ( gTN == teammechanic ) then
Guest Guest4401 Posted May 28, 2012 Posted May 28, 2012 function doorsClose (thePlayer, command, garageID) In line 109 you have used command handler "close" and when you type /close it will work fine because first parameter is thePlayer for command. But in line 110 you have setTimer which repeats the function...thePlayer is nil that time. That's why it's showing error.
mrspeedycat Posted May 28, 2012 Author Posted May 28, 2012 when i settimer 1 console said below 50 how to fix it?
Alpha Posted May 28, 2012 Posted May 28, 2012 The second argument of setTimer which is the timeInterval must be 50 or higher.
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