اخي شوف المشكلة
بطلع بس ما بترجعلما اطلع من الماركر
local x, y, z = 1544.69921875,-1630.7998046875,13.300000190735
local teamName = "Police"
local Object = createObject ( 968, 1544.69921875,-1630.7998046875,13.300000190735,0,90,90)
local Marker = createMarker ( x, y, z, "cylinder", 5,255,255,50)
function countPlayersInMarker ( marker )
local players = 0,9
if marker and getElementType(marker) == "marker" then
for i,player in ipairs(getElementsByType("player")) do
if isElementWithinMarker(player,marker) then
players = players + 1
end
end
end
return players
end
function MoveObject ( theElm )
if ( getElementType ( theElm ) == "player" ) then
if ( eventName == "onMarkerHit" ) then
local team = getPlayerTeam ( theElm )
if ( team ) and ( getTeamName ( team ) == teamName ) and ( countPlayersInMarker ( Marker ) <= 1 ) then
moveObject ( Object, 2000, 544.69921875,-1630.7998046875,13.300000190735,0,0,90)
end
else
if ( countPlayersInMarker ( Marker ) == 0 ) then
moveObject ( Object, 2000,544.69921875,-1630.7998046875,13.300000190735,0,90,90)
end
end
end
end
addEventHandler ( "onMarkerHit", Marker, MoveObject )
addEventHandler ( "onMarkerLeave", Marker, MoveObject )
addEventHandler ( "onPlayerQuit", root,
function ( )
if ( isElementWithinMarker ( source, Marker ) ) and ( countPlayersInMarker ( Marker ) == 0 ) then
moveObject ( Object, 2000,544.69921875,-1630.7998046875,13.300000190735,0,90,90 )
end
end
)