Jump to content

مساعد بكود المنطقة الخضراء


#STZ

Recommended Posts

السلام عليكم و رحمة الله و بركاته

معي كود

يسوي منطقة خضراء علي الخريطة

يسوي

  • اذا احد دخل بسيارة تنسحب
  • اذا احد دخل جوا ما يقدر يضرب بسلاح
  • كمان اذا هو جوا ما يموت

 

 

لاكن مدري ما يشتغل و فيه مشاكل

اتمني تساعدوني

 

-- Client
addEvent("enableGodMode", true)
addEvent("disableGodMode", true)
addEventHandler ("enableGodMode", getRootElement(), 
function()
  addEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent)
end)

addEventHandler ("disableGodMode", getRootElement(), 
function()
  removeEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent)
end)

function cancelEventEvent () cancelEvent() end 
-- Server
sezi = 120 -- الحجم  --,  
x,y,z = -3392.42163, -3047.39087, 100 -- الطول + الاحداثيات
Col = createColRectangle (x,y,z,sezi)
Radar = createRadarArea (x,y,z,sezi,0,255,0,255,root)


 
 

addEventHandler("onColShapeHit",Col,function (HitElement)
if getElementType(HitElement) == "vehicle" then
destroyElement( HitElement )
elseif getElementType(HitElement) == "player" then
outputChatBox("انت الان داخل الحماية",HitElement,255,0,0,true)
 toggleControl (hitElement, "fire", false)
    toggleControl (hitElement, "next_weapon", false)
    toggleControl (hitElement, "previous_weapon", false)
    toggleControl (hitElement, "aim_weapon", false)
    toggleControl (hitElement, "vehicle_fire", false)
    showPlayerHudComponent (hitElement, "ammo", false)
    showPlayerHudComponent (hitElement, "weapon", false)
    triggerClientEvent (hitElement, "enableGodMode", hitElement)
end
end)
addEventHandler("onColShapeLeave",Col,function (LeaveElement)
if getElementType(LeaveElement) == "player"  then
outputChatBox("*انت الان خارج الحماية",LeaveElement,0,255,0,true)
 toggleControl (hitElement, "fire", false)
    toggleControl (hitElement, "next_weapon", false)
    toggleControl (hitElement, "previous_weapon", false)
    toggleControl (hitElement, "aim_weapon", false)
    toggleControl (hitElement, "vehicle_fire", false)
    showPlayerHudComponent (hitElement, "ammo", false)
    showPlayerHudComponent (hitElement, "weapon", false)
    triggerClientEvent (hitElement, "disableGodMode", hitElement)
end
end)
 

 

Link to comment
12 minutes ago, MR.NaiF-MTA said:

السلام عليكم و رحمة الله و بركاته

معي كود

يسوي منطقة خضراء علي الخريطة

يسوي

  • اذا احد دخل بسيارة تنسحب
  • اذا احد دخل جوا ما يقدر يضرب بسلاح
  • كمان اذا هو جوا ما يموت

 

 

لاكن مدري ما يشتغل و فيه مشاكل

اتمني تساعدوني

 


-- ClientaddEvent("enableGodMode", true)addEvent("disableGodMode", true)addEventHandler ("enableGodMode", getRootElement(), function()  addEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent)end)addEventHandler ("disableGodMode", getRootElement(), function()  removeEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent)end)function cancelEventEvent () cancelEvent() end 

-- Serversezi = 120 -- الحجم  --,  x,y,z = -3392.42163, -3047.39087, 100 -- الطول + الاحداثياتCol = createColRectangle (x,y,z,sezi)Radar = createRadarArea (x,y,z,sezi,0,255,0,255,root)  addEventHandler("onColShapeHit",Col,function (HitElement)if getElementType(HitElement) == "vehicle" thendestroyElement( HitElement )elseif getElementType(HitElement) == "player" thenoutputChatBox("انت الان داخل الحماية",HitElement,255,0,0,true) toggleControl (hitElement, "fire", false)    toggleControl (hitElement, "next_weapon", false)    toggleControl (hitElement, "previous_weapon", false)    toggleControl (hitElement, "aim_weapon", false)    toggleControl (hitElement, "vehicle_fire", false)    showPlayerHudComponent (hitElement, "ammo", false)    showPlayerHudComponent (hitElement, "weapon", false)    triggerClientEvent (hitElement, "enableGodMode", hitElement)endend)addEventHandler("onColShapeLeave",Col,function (LeaveElement)if getElementType(LeaveElement) == "player"  thenoutputChatBox("*انت الان خارج الحماية",LeaveElement,0,255,0,true) toggleControl (hitElement, "fire", false)    toggleControl (hitElement, "next_weapon", false)    toggleControl (hitElement, "previous_weapon", false)    toggleControl (hitElement, "aim_weapon", false)
    toggleControl (hitElement, "vehicle_fire", false)
    showPlayerHudComponent (hitElement, "ammo", false)
    showPlayerHudComponent (hitElement, "weapon", false)
    triggerClientEvent (hitElement, "disableGodMode", hitElement)
end
end)
 

 

اتوقع اخوي لو بدلت ذي بالمصدر يكون افضل يعني تخليها كذا

 


addEventHandler("onColShapeLeave",Col,function (LeaveElement)
    هذي لو تبدلها كذا يكون افضل
    
    
addEventHandler("onColShapeLeave",Col,function (source)

 

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...