Jump to content

اضافةة


Recommended Posts

هاذا مود حق مستر سعد

لوحة الشرطي

ابي اذا احد سجن ما يقدر يفتح لوحة الادمنية لو هو معه رتبة

--***********************************-- 
--            By MR.S3D             --
--            Server Side            --
--***************please dont remove********************--
 
----------------------
--Coordinates in the prison and outside prison
----------------------
 
------ This is Coordinates where the prison
 
local x, y, z = 198, 162, 1003
local interior_jail = 3
 
-- this is Coordinates to get out of prison
 
local interior_unjail = 0
local x1, y1, z1 = 780, -1327, 13
 
-------------------------------------------------
 
rRoot = getResourceRootElement(getThisResource())
local timeLeft = {}
local timeLeftText = {}
 
local mint = 60 -- this 1 min
local f = 120  -- this 2 min
local s3m = 180 -- this 3 min
local s4m = 240 -- this 4 min
local s5m = 300 -- this 5 min
local s1h = 3600 -- 1 hour
 
function RemoveFromVeh(plr)
     hisVeh = getPedOccupiedVehicle(plr)
             if hisVeh then
            removePedFromVehicle(plr)
        end
end
 
 
addEvent("jail",true) -- Jail
addEventHandler("jail",root,
function(isJailed,text)
if text == "1 min" then
        thePlayer = getPlayerFromName(isJailed)
        if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
        RemoveFromVeh(thePlayer)       
        setElementInterior ( thePlayer, interior_jail )      
        setElementPosition (thePlayer, x, y, z )
        toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
        toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false) 
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false) 
        setElementData(thePlayer, "Timeleft", tonumber(mint))
        showTimeLeft(thePlayer)
        setElementData(thePlayer,"isJailed",true)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 1 min",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "2 min" then
        thePlayer = getPlayerFromName(isJailed)
        if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
        RemoveFromVeh(thePlayer)               
        setElementInterior ( thePlayer, interior_jail )        
        setElementPosition (thePlayer, x, y, z )
        toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
        toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false) 
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)        
        setElementData(thePlayer, "Timeleft", tonumber(f))
        showTimeLeft(thePlayer)
        setElementData(thePlayer,"isJailed",true)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 2 min",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "3 min" then
        thePlayer = getPlayerFromName(isJailed)
        if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end
        RemoveFromVeh(thePlayer)               
        setElementInterior ( thePlayer, interior_jail )
        setElementPosition (thePlayer, x, y, z )
        toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
        toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false) 
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)        
        setElementData(thePlayer,"isJailed",true)
        setElementData(thePlayer, "Timeleft", tonumber(s3m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 3 min",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "4 min" then
        thePlayer = getPlayerFromName(isJailed)
        if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
        RemoveFromVeh(thePlayer)               
        setElementInterior ( thePlayer, interior_jail )        
        setElementPosition (thePlayer, x, y, z )
        toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
        toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false) 
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)        
        setElementData(thePlayer,"isJailed",true)
        setElementData(thePlayer, "Timeleft", tonumber(s4m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 4 min",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "5 min" then
        thePlayer = getPlayerFromName(isJailed)
        if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end  
        RemoveFromVeh(thePlayer)               
        setElementInterior ( thePlayer, interior_jail )        
        setElementPosition (thePlayer, x, y, z )
        toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
        toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false) 
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)        
        setElementData(thePlayer,"isJailed",true)
        setElementData(thePlayer, "Timeleft", tonumber(s5m))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 5 min",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
elseif text == "1 hour" then
        thePlayer = getPlayerFromName(isJailed)
        if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",isJailed,255,0,0) return end
        RemoveFromVeh(thePlayer)               
        setElementInterior ( thePlayer, interior_jail )        
        setElementPosition (thePlayer, x, y, z )
        toggleControl (thePlayer, "fire", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "previous_weapon", false)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", false)
        toggleControl (thePlayer, "weapon", false)
        toggleControl (thePlayer, "next_weapon", false)
        toggleControl (thePlayer, "vehicle_fire", false)
        toggleControl (thePlayer, "vehicle_secondary_fire", false) 
        showPlayerHudComponent (thePlayer, "ammo", false)
        showPlayerHudComponent (thePlayer, "weapon", false)        
        setElementData(thePlayer,"isJailed",true)
        setElementData(thePlayer, "Timeleft", tonumber(s1h))
        showTimeLeft(thePlayer)
        setElementData(getResourceRootElement(getThisResource()),"".. getPlayerSerial(thePlayer).."-j",true)
        outputChatBox("** You arrested [ "..getPlayerName(thePlayer).." #FFFF00]For 1 hour",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FF0000] Player has been arrested ",root,255,0,0,true)
    end
end )
 
addEvent("unjail",true)-- unJail
addEventHandler("unjail",root,
function(isJailed)
    thePlayer = getPlayerFromName(isJailed)
        if thePlayer then
        if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",isJailed,255,0,0) return end
        setElementInterior ( thePlayer, interior_unjail )
        setElementPosition ( thePlayer, x1, y1, z1 )
        toggleControl (thePlayer, "fire", true)
        toggleControl (thePlayer, "next_weapon",true)
        toggleControl (thePlayer, "previous_weapon", true)
        toggleControl (thePlayer, "sprint", true)
        toggleControl (thePlayer, "aim_weapon", true)
        toggleControl (thePlayer, "weapon", true)
        toggleControl (thePlayer, "next_weapon", true)
        toggleControl (thePlayer, "vehicle_fire", true)
        toggleControl (thePlayer, "vehicle_secondary_fire", true)          
        setElementData(thePlayer, "Timeleft", false)
        setElementData(thePlayer,"isJailed",false)
        setElementData(thePlayer, "Timeleft", 0)       
        textDestroyDisplay(timeLeft[thePlayer])
        setElementData(rRoot,"".. getPlayerSerial(thePlayer).."-j",false)
        outputChatBox("** You are Now out of prison [ "..getPlayerName(thePlayer).." #FFFF00] Please respect the rule of server",source,255,255,0,true)
        outputChatBox("** [ "..getPlayerName(thePlayer).." #FFFF00]  has been out of prison ",root,255,255,0,true)
end
end)
   
addEventHandler("onPlayerSpawn",root, -- Check If He Is isJailed [ OnSpawn ]
function()
if getElementData(source,"isJailed") == true then
setElementInterior ( source, interior_jail )        
setElementPosition (source, x, y, z )
RemoveFromVeh(thePlayer)
end
end)
 
addEventHandler("onPlayoin",root, -- Check If He Is isJailed - By IP [ OnJoin ]
function()
if getElementData(rRoot,""..getPlayerSerial(source).."-j") == true then
setElementData(source,"isJailed",true)
setElementInterior ( source, interior_jail )        
setElementPosition (source, x, y, z )
end
end)
 
function showTimeLeft(player)
    timeLeft[player] = textCreateDisplay()
    textDisplayAddObserver(timeLeft[player], player)
    timeLeftText[player] = textCreateTextItem("Time Left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255)
    textDisplayAddText(timeLeft[player], timeLeftText[player])
    setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player)
end
 
function updateTimeLeft(player)
    local name = getPlayerName(player)
    setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1)
    textItemSetText(timeLeftText[player], "Time Left: " .. getElementData(player, "Timeleft"))
   
    if tonumber(getElementData(player, "Timeleft")) == 0 then
        textDestroyDisplay(timeLeft[player])
        setElementInterior ( player, interior_unjail )
        setElementPosition(player, x1, y1, z1)
        outputChatBox("** [ "..name.." #FFFF00]  has been out of prison ",root,255,255,0,true)
        setElementData(rRoot,"".. getPlayerSerial(thePlayer).."-j",false)
        setElementData (player, "isJailed",false)
        toggleControl (player, "fire", true)
       
Link to comment
setElementData 
getElementData 

وعدل على الكوماند لـ فتح اللوحة واظنة حسب علمي .. admin_server.lua

command admin أو شيء كذآ .. :mrgreen:

موفقين .. :P

اعتقد ان مايحتاج

setElementData

لأن مود سعد فيه

setElementData(source,'isJailed',true)

فـ يعني ماعليك الا انك تستخدم

مثال *

addCommandHandler('jail',function(me) 
    if getElementData(me,'isJailed') then 
        outputChatBox('* انت مسجون',me) 
    else 
        outputChatBox('* انت غير مسجون',me) 
    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...