Jump to content

مساعدة في البرمجة


Recommended Posts

  
--server side 
local Marker, Started = createMarker( 2226.77954,1838.84619,9.82031, "cylinder", 1.5, 255, 250, 0, 100 ) 
  
local Positions = { 
    { 2220.82104, -1152.29944, 1025.79688 }, 
    { 2223.53076, -1146.58630, 1025.79688 }, 
    { 2228.42969, -1140.57678, 1029.79688 }, 
    { 2231.60132, -1150.41760, 1029.79688 }, 
    { 2237.60278, -1159.64636, 1029.79688 }, 
    { 2245.54712, -1189.38806, 1029.80432 }, 
    { 2240.68823, -1189.95288, 1033.79688 }, 
    { 2226.09644, -1181.82043, 1029.79688 }, 
    { 2209.90698, -1192.10559, 1029.79688 }, 
    { 2229.25854, -1188.43433, 1029.79688 }, 
    { 2241.62891, -1189.13782, 1029.79688 }, 
    { 2231.00024, -1170.52417, 1029.79688 }, 
    { 2203.62476, -1144.56409, 1033.71802 } 
} 
  
addEventHandler( "onMarkerHit", Marker, 
function( HitElement ) 
    if ( getElementType( HitElement ) == "player" ) then 
if ( Started ) then setElementInterior( HitElement, 15, unpack( Positions[math.random( #Positions )] ) ) end 
        outputChatBox( Started and "تم الدخول للمهمة|You Enter To Mission" or " The Mission Dont Started|لم تبدأ المهمة بعد", HitElement ) 
        setPlayerTeam ( HitElement, getTeamFromName ( "Mission" ) ) 
    end 
end ) 
  
  
function StartMission() 
    Started = true 
    if ( isTimer( DisablingMission ) ) then  killTimer( DisablingMission ) end 
    if ( isTimer( RestartMission ) ) then killTimer( RestartMission ) end 
    DisablingMission = setTimer( function() Started = false RestartMission = setTimer( StartMission, 1200000, 1 ) end, 120000, 1 ) 
end 
  
addCommandHandler( "start1mission", function( Player ) StartMission() outputChatBox("The Mission Started|بدأت مهمة الاست مان اشارة تنين اصفر بالخريطة", root, 255, 0, 0) end ) 
  
  
local Mission = "Mission" 
  
addEventHandler( "onPlayerWasted", root, function ( _,killer ) 
   if ( killer and killer ~= source and getElementType ( killer ) == "player" ) then 
    if ( getPlayerTeam ( killer ) and getPlayerTeam ( killer ) == getTeamFromName ( Mission ) and getPlayerTeam ( source ) and getPlayerTeam ( source ) == getTeamFromName ( Mission ) ) then 
        givePlayerMoney ( killer, 1000 ) 
    end 
  end 
  setPlayerTeam ( source , nil ) 
end ) 
  
  
createTeam ( Mission ,255,250,0) 
  
  
setTimer ( function ( ) 
for k,v in ipairs (getElementsByType("player")) do 
if ( getElementInterior ( v ) == 15 ) then 
setElementPosition(v,2202.63672,1846.10718,10.82031) 
outputChatBox("The Mission End|المهمة انتهت",v,250,255,0) 
       end 
    end 
end,600000,1) 
  
  
  
Timer = setTimer ( function (   ) 
for i,v in ipairs ( getPlayersInTeam(getTeamFromName('Mission')) ) do 
if ( #getPlayersInTeam ( getTeamFromName('Mission') ) <= 1 ) then 
givePlayerMoney ( v , 50000 ) 
killTimer ( Timer ) 
end 
end 
end,5000,0) 
  
createBlip(2221.13159,1841.59302,10.82031,44) 
  
addEventHandler ( "onResourceStart", resourceRoot, function (   ) 
  setTimer( function(  ) 
     outputChatBox("The Mission Started|بدأت مهمة الاست مان اذهب لاشارة التنين الاصفر",root,250,0,0) 
   end,1200000,1) 
end ) 
  

  
text = { 
{"x[Mission Last Man]x",2226.61743,1839.42468,10.82031, -- x,y,z pos 
255,0,255},-- r,g,b color 
}   
addEventHandler ( "onClientRender", root, 
function (v) 
for _,v in ipairs (text) do 
local x,y,z = getElementPosition ( localPlayer ) 
if ( getDistanceBetweenPoints3D (v[2],v[3],v[4], x,y,z ) ) < 50 then 
local pos = { getScreenFromWorldPosition ( v[2],v[3],v[4]) } 
if (isLineOfSightClear (v[2],v[3],v[4], x,y,z, true, true, false, true)) then 
if pos[1] and pos[2] then 
dxDrawText (v[1], pos[1],pos[2],pos[1],pos[2], tocolor(v[5],v[6],v[7]), 2, "default-bold" ) 
end 
end 
end 
end 
end) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...