Jump to content

تعديل كود .


Recommended Posts

  
  
Client : 
  
--***********************************-- 
--***********************************-- 
--            Jail System            -- 
--            By Al3grab             -- 
--            Client Side            -- 
--***********************************-- 
--***********************************-- 
  
--  1.0  Made At 3/9/2011 | 12:15 PM  -- 
--  2.0  Made At 3/2/2012 | 06:15 PM  -- 
--  2.1  Made At 22/5/2012 | 4:00 PM  -- 
  
lp = getLocalPlayer() 
rRoot = getResourceRootElement(getThisResource()) 
setElementData(lp,"jailed",false) 
------ 
addEventHandler("onClientResourceStart",rRoot,function() 
triggerServerEvent("getDataz",lp,lp) 
outputDebugString("Jail System v2.1 By Al3grab | Started") 
end ) 
desz = {} 
addEvent("sendDataz",true) 
addEventHandler("sendDataz",root,function(jTable,tTable) 
  
------ 
  
jWin = guiCreateWindow(460,172,445,416,"Jail System v2.1 | By Al3grab",false) 
--- Center Window --- 
local screenW,screenH=guiGetScreenSize() 
local windowW,windowH=guiGetSize(jWin,false) 
local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
guiSetPosition(jWin,x,y,false) 
----- Center Window ----- 
guiSetVisible(jWin,false) 
guiWindowSetSizable(jWin,false) 
------------------------- 
jBut = guiCreateButton(247,338,167,31,"Jail Him",false,jWin) 
tGrid = guiCreateGridList(240,184,190,144,false,jWin) 
guiGridListSetSelectionMode(tGrid,0) 
------- 
-- 
sEdit = guiCreateEdit(14,380,217,23,"Search ..",false,jWin) 
-- 
-------- 
local timeC = guiGridListAddColumn( tGrid, "Time", 0.85 ) 
if timeC then 
for k,v in ipairs ( tTable ) do 
local time = v[1] 
local des = v[2] 
local row = guiGridListAddRow ( tGrid ) 
desz[row] = des 
guiGridListSetItemText ( tGrid, row, timeC, time.." "..des, false, true ) 
end 
local row = guiGridListAddRow ( tGrid ) 
guiGridListSetItemText ( tGrid, row, timeC,"Other ..", false, true ) 
end 
-------- 
jGrid = guiCreateGridList(240,31,190,144,false,jWin) 
guiGridListSetSelectionMode(jGrid,0) 
-------- 
local jailC = guiGridListAddColumn( jGrid, "Jail", 0.85 ) 
for k,v in ipairs ( jTable ) do 
local name = v[1] 
local row = guiGridListAddRow ( jGrid ) 
guiGridListSetItemText ( jGrid, row, jailC, name, false, false ) 
end 
jcBut = guiCreateButton(246,378,172,24,"Close",false,jWin) 
  
function jailShow () 
    guiSetVisible(jWin,not guiGetVisible ( jWin ) ) 
    showCursor(guiGetVisible ( jWin ) ) 
    guiSetInputEnabled(guiGetVisible ( jWin ) ) 
    destroyElement(pList) 
    -- Players List 
         pList = guiCreateGridList(14,31,218,338,false,jWin)     
         column = guiGridListAddColumn( pList, "Player", 0.85 ) 
        if ( column ) then 
        for id, player in ipairs(getElementsByType("player")) do 
             row = guiGridListAddRow ( pList ) 
            guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
        end 
        end 
    -- Players List 
end 
addEvent("jailShow",true) 
addEventHandler("jailShow",root,jailShow) 
  
function changeText(button,state,x,y) 
        selectedRow, selectedCol = guiGridListGetSelectedItem( pList ) 
        sPlayer = guiGridListGetItemText( pList, selectedRow, selectedCol ) 
        local thePlr = getPlayerFromName(sPlayer) 
        if thePlr then 
            local isJailed = getElementData(thePlr,"jailed") 
            if isJailed == false then 
                guiSetText(jBut,"Jail Him") 
            elseif isJailed == true then 
                guiSetText(jBut,"Release Him") 
            end 
        end 
     
end 
addEventHandler("onClientGUIClick",root,changeText) 
  
function onClick (button, state, absoluteX, absoluteY) 
    selectedRow, selectedCol = guiGridListGetSelectedItem( pList ) 
        sPlayer = guiGridListGetItemText( pList, selectedRow, selectedCol ) 
        jail = guiGridListGetItemText ( jGrid, guiGridListGetSelectedItem ( jGrid ), 1 ) 
        time = guiGridListGetItemText ( tGrid, guiGridListGetSelectedItem ( tGrid ), 1 ) 
        timeDes = tostring(desz[guiGridListGetSelectedItem ( tGrid )]) 
    if ( source == jBut ) then 
        if guiGetText(jBut) == "Jail Him" then 
            if time ~= "Other .." then 
                triggerServerEvent("JailHimx",lp,sPlayer,jail,time,timeDes) 
            else 
                createTimeSelect(sPlayer,jail) 
            end 
        elseif guiGetText(jBut) == "Release Him" then 
            triggerServerEvent("unJailHim",lp,sPlayer) 
    end 
---------- 
elseif ( source == jcBut ) then 
    guiSetVisible (jWin, false) 
    showCursor (false) 
    guiSetInputEnabled(false) 
    end 
    end 
addEventHandler( "onClientGUIClick", root, onClick ) 
  
------------ 
end ) 
  
addEventHandler("onClientPlayerDamage",root,function(at) 
if getElementData(source,"jailed") == true then 
if at then cancelEvent() end 
end 
end ) 
  
------- 
  
addEventHandler("onClientGUIClick",root,function() 
if source == sEdit then 
    guiSetText(sEdit,"") 
    --[[ 
else 
    guiSetText(sEdit,"Search ..") 
    --]] 
end end ) 
  
addEventHandler("onClientGUIChanged",root,function() 
if source == sEdit then 
    ------ 
    guiGridListClear(pList) 
    for k,v in ipairs ( getElementsByType("player") ) do 
        local name = string.lower(getPlayerName(v)) 
        if name then 
            if string.find (name,string.lower(guiGetText(sEdit)) ) then 
                row = guiGridListAddRow ( pList ) 
                guiGridListSetItemText ( pList, row, column, getPlayerName ( v ), false, false ) 
                end 
            end 
        end 
    end 
    ------ 
end ) 
------ 
function createTimeSelect(theJailed,theJail) 
    if not tostring(theJailed) then outputChatBox("** #FFFF00Please Select a Player !",255,0,0,true) return  end 
    if not tostring(theJail) then outputChatBox("** #FFFF00Please Select a Jail !",255,0,0,true) return end  
    if isElement(TimeSelect_Window) then return end  
    TimeSelect_Window = guiCreateWindow(550,397,270,125,"Enter Time",false) 
    -- 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(TimeSelect_Window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(TimeSelect_Window,x,y,false) 
    -- 
--  guiSetVisible(jWin,false) 
    -- 
    TimeSelect_Edit = guiCreateEdit(15,37,89,26,"",false,TimeSelect_Window) 
    TimeSelect_Label = guiCreateLabel(110,41,10,15,"in",false,TimeSelect_Window) 
    TimeSelect_Grid = guiCreateGridList(126,31,130,95,false,TimeSelect_Window) 
    guiGridListSetSelectionMode(TimeSelect_Grid,2) 
    --- 
    column = guiGridListAddColumn( TimeSelect_Grid, "", 0.80 ) 
    r1 = guiGridListAddRow(TimeSelect_Grid) 
    r2 = guiGridListAddRow(TimeSelect_Grid) 
    r3 = guiGridListAddRow(TimeSelect_Grid) 
    guiGridListSetItemText ( TimeSelect_Grid , r1, column, "Hours", false, false ) 
    guiGridListSetItemText ( TimeSelect_Grid , r2, column,"Minutes", false, false ) 
    guiGridListSetItemText ( TimeSelect_Grid , r3, column, "Seconds", false, false ) 
    TimeSelect_Button = guiCreateButton(14,72,91,40,"OK",false,TimeSelect_Window) 
    -- 
    function onOk() 
    if source == TimeSelect_Button then 
        -- 
        removeEventHandler("onClientGUIClick",root,onOk) 
        -- 
        ---------------- 
        theTime = guiGetText(TimeSelect_Edit) 
        timeType = guiGridListGetItemText ( TimeSelect_Grid, guiGridListGetSelectedItem ( TimeSelect_Grid ) ) 
        -- 
        destroyElement(TimeSelect_Window) 
        jailShow () 
        -- 
        if tonumber(theTime) then 
            if tostring(timeType) then 
                triggerServerEvent("JailHimx",lp,theJailed,theJail,theTime.." "..timeType,timeType,true) 
            else 
                outputChatBox("** #FFFF00Please Select , Hours or Minutes or Seconds !",255,0,0,true) 
            end 
        else 
            outputChatBox("** #FFFF00Please Enter a Number !",255,0,0,true) 
        end 
        ---------------- 
    end 
    end 
    addEventHandler("onClientGUIClick",root,onOk) 
end 

  
 
Server :
 
--***********************************--
--***********************************--
--            Jail System            --
--            By Al3grab             --
--            Server Side            --
--***********************************--
--***********************************--
Command = get("command") -- getTheCommand
 
rRoot = getResourceRootElement(getThisResource())
------
function getData(to)
    local file = xmlLoadFile("data.xml")
         jTable = {}
         tTable = {}
    if file then
        for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(file,"Jails",0)))do
            local name = xmlNodeGetAttribute(v,"name")
            local posX,posY,posZ = xmlNodeGetAttribute(v,"posX"),xmlNodeGetAttribute(v,"posY"),xmlNodeGetAttribute(v,"posZ")
            local int = xmlNodeGetAttribute(v,"int")
            local dim = xmlNodeGetAttribute(v,"dim")
            table.insert(jTable, {name,posX,posY,posZ,int,dim})
        end
        for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(file,"time",0)))do
            local times = xmlNodeGetAttribute(v,"times")
                for i =1,50 do
                    local iTime = gettok ( times, i, string.byte(',') )
                    if iTime then
                    -- 
                    if tonumber(iTime) > 59.5 then
                        iTime = math.floor(iTime / 60)
                        iTimeDes = "Minutes"
                            if iTime > 59.5 then
                                iTime = math.floor(iTime / 60)
                                iTimeDes = "Hours"
                            end
                    else
                        iTimeDes = "Seconds"
                    end
                        table.insert(tTable,{iTime,iTimeDes})
                    end
                end
        end
    end
    triggerClientEvent(to,"sendDataz",to,jTable,tTable) -- sending to client event
end
addEvent("getDataz",true)
addEventHandler("getDataz",root,getData)
 
 
addCommandHandler ( Command, -- Adding The Command Handler
    function ( player, cmd )
        if hasObjectPermissionTo ( player, "function.banPlayer" ) then
            triggerClientEvent(player,"jailShow",player)
        else
        outputChatBox(" Access Denied ",player,255,0,0)
    end
end
)
 
anims = {
    "F_smklean_loop",
    "M_smklean_loop",
    "M_smkstnd_loop",
    "M_smk_drag",
    "M_smk_in",
    "M_smk_loop",
    "M_smk_out",
    "M_smk_tap" ,
}
 
function removeVehicle(thePlayer)
    if isPedInVehicle(thePlayer) then destroyElement(getPedOccupiedVehicle(thePlayer)) end
end
function JailHim(jailed,theJails,time,timeDes,showWho,timeReady)
        thePlayer = getPlayerFromName(jailed)
        if not thePlayer then outputChatBox("** #FFFF00Please Select a Player !",source,255,0,0,true) return end
        removePedFromVehicle(thePlayer)
        for k,v in ipairs (  jTable  ) do
                if theJails == v[1] then
                    theJail = v
                end
        end
        if theJail  then
        if tostring(time) then
            if timeReady == true then
              theTimex = tonumber(time)
            else
             theTimex = gettok ( time, 1, string.byte(timeDes) )
            end
            if timeDes == "Hours" then
                theTimex = math.floor(theTimex*60*60*1000)
                elseif timeDes == "Minutes" then
                theTimex = math.floor(theTimex*60*1000)
                elseif timeDes == "Seconds" then
                theTimex = math.floor(theTimex*1000)
            end
            startJailTimer ( thePlayer , theTimex )
        local x,y,z = theJail[2],theJail[3],theJail[4]
        local int = theJail[5]
        local dim = theJail[6]
        setElementInterior ( thePlayer, int )
        setElementDimension ( thePlayer, dim )
        setElementPosition (thePlayer,x,y,z )
        setElementData(thePlayer,"jailed",true)
        setElementData(rRoot,""..getPlayerSerial(thePlayer).."-j",true)
        toggleControl(thePlayer,"fire",false)
        if showWho ~= true then
        outputChatBox("** #FFFF00You Jailed [ "..getPlayerName(thePlayer).." #FFFF00] at "..theJail[1].." For "..time,source,255,0,0,true)
        outputChatBox("** #FFFF00You Have Been Jailed By [ "..getPlayerName(source).." #FFFF00] at "..theJail[1].." For "..time,thePlayer,255,0,0,true)
        end
        outputChatBox("** #FFFF00[ "..getPlayerName(thePlayer).." #FFFF00] Has Been Jailed For "..time,root,255,0,0,true)
        local randomAnim
        setPedAnimation(thePlayer,"SMOKING",anims[math.random(#anims)],theTimex/2)
        else
        outputChatBox("** #FFFF00Please Select Time !",source,255,0,0,true)
        end
        else
        outputChatBox("** #FFFF00Please Select a Jail !",source,255,0,0,true)
        end
end 
addEvent("JailHimx",true)
addEventHandler("JailHimx",root,JailHim)
 
function unJailHim(jailed,showWho)
    thePlayer = getPlayerFromName(jailed)
    if not thePlayer then outputChatBox("** #FFFF00Please Select a Player !",source,255,0,0,true) return end
--if getElementData(thePlayer,"jailed") == true then
        setElementInterior ( thePlayer, 0)
        setElementDimension ( thePlayer, 0 )
        setElementPosition ( thePlayer, 1552.9108886719, -1675.5844726563, 16.1953125)
        setElementData(thePlayer,"jailed",false)
        setElementData(rRoot,""..getPlayerSerial(thePlayer).."-j",false)
        if showWho ~= true then
        outputChatBox("** #FFFF00You Released [ "..getPlayerName(thePlayer).." #FFFF00]",source,255,0,0,true)
        outputChatBox("** #FFFF00You Have Been Released by [ "..getPlayerName(source).." #FFFF00]",thePlayer,255,0,0,true)
        end
        outputChatBox("** #FFFF00[ "..getPlayerName(thePlayer).." #FFFF00] Has Been Released ",root,255,0,0,true)
        setPedAnimation(thePlayer)
        stopJailTimer(Player)
        toggleControl(thePlayer,"fire",true)
    --  setTimer(killPed,1500,1,thePlayer)
--else
    --  outputChatBox("The Player is Not Jailed !",source,255,0,0,true)
--end
end 
addEvent("unJailHim",true)-- unJail
addEventHandler("unJailHim",root,unJailHim)
 
addEvent("onJailEnd",true)
addEventHandler("onJailEnd",root,function(player)
unJailHim(getPlayerName(player),true)
end )
 
addEventHandler("onPlayerSpawn",root, -- Check If He Is Jailed [ OnSpawn ]
function()
if getElementData(source,"jailed") == true then
 randomJail = jTable[math.random(#jTable)]
if randomJail then
    x,y,z = randomJail[2],randomJail[3],randomJail[4]
    int = randomJail[5]
    dim = randomJail[6]
    setElementInterior ( source, int )
    setElementDimension(source,dim)
    setElementPosition (source,x,y,z )
end
end
end)
 
addEventHandler("onPlayerJoin",root, -- Check If He Is Jailed - By Serial [ OnJoin ]
function()
if getElementData(rRoot,""..getPlayerSerial(source).."-j") == true then
 
 randomJail = jTable[math.random(#jTable)]
if randomJail then
    x,y,z = randomJail[2],randomJail[3],randomJail[4]
    int = randomJail[5]
    dim = randomJail[6]
    setElementInterior ( source, int )
    setElementDimension(source,dim)
    setElementPosition (source,x,y,z )
    --
    time = getElementData(rRoot,""..getPlayerSerial(source).."-t",time) or 5 * 1000
    startJailTimer(source,time)
    setElementData(source,"jailed",true)
end
end
end )
 
----
 
function startJailTimer(Player,theTime) -- to start mission timer ..
    if Player then
        TimerDisplay = textCreateDisplay()
        m,s,cs = msToTimeStr(theTime)
        fullTime = m..":"..s
        TimerText = textCreateTextItem ( "Time Left : "..tostring(fullTime).."", 0.39, 0.7 ,"medium",0,255,0,255,2.0,"left","center",255)
        textDisplayAddText ( TimerDisplay, TimerText )
        textDisplayAddObserver ( TimerDisplay, Player )
        sortTimerShit(Player,TimerText,theTime)
    end
end
 
--Robbed from JailTimerr resource , and it was robbed from arc_
function msToTimeStr(ms)
    if not ms then
        return ''
    end
   
    if ms < 0 then
        return "0","00","00"
    end
   
    local centiseconds = tostring(math.floor(math.fmod(ms, 1000)/10))
    if #centiseconds == 1 then
        centiseconds = '0' .. centiseconds
    end
    local s = math.floor(ms / 1000)
    local seconds = tostring(math.fmod(s, 60))
    if #seconds == 1 then
        seconds = '0' .. seconds
    end
    local minutes = tostring(math.floor(s / 60))
   
    return minutes, seconds, centiseconds
end
 
function sortTimerShit(plr,timer,time) -- to sort timer's shit ..
    if timer and time then
            if isTimer(timerShitTimer) then
        killTimer(timerShitTimer)
    end
        timerShitTimer = setTimer(function(plr)
                time = time - 70
                m,s,cs = msToTimeStr(time)
                fullTime = m..":"..s
                textItemSetText(timer,"Time Left : "..tostring(fullTime).."")
                if plr then
                setElementData(rRoot,""..getPlayerSerial(plr).."-t",time)
                end
                if ( tonumber(m) <= 0 and tonumber(s) <= 0 and tonumber(cs) <= 0 ) then
                    onTimerFinish(plr,timer)
                end
        end , 50 , 0 ,plr )
    end
end
 
Link to comment
الحين وش نوع سيرفرك؟

يعني اف1 الفري روم ولا كيف؟

+ استخدم الداتا,

setElementData -- اذا انسجن تحط له داتا # 
getElementData -- تجيب الداتا # 

فري رومَ , ممكن تحط لي مثال؟ ,

Link to comment

مثال getElementData

function addPlayerCustomTag ( thePlayer, command, newTag ) 
    --Let's make sure the newTag param has been entered... 
    if ( newTag ) then 
        --Grab their current playername for saving. 
        local sPlayerNickname = getPlayerName ( thePlayer ) 
        --Create their new nickname with their tag 
        local sNewPlayerNickname = newTag .. " " .. sPlayerNickname 
  
        --Let's first load the element data, see if it's there already 
        --The reason for this is that if a player were to do /addtag twice, 
        --the tag would be prepended a second time 
        local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
        if ( sOldNick == false ) then 
            --Save their orignal nickname in their element data 
            setElementData ( thePlayer, "tempdata.originalnick", sPlayerNickname ) 
        end 
  
        --Set their new nickname globally 
        setPlayerName ( thePlayer, sNewPlayerNickname ) 
  
        --Tell them it's done 
        outputChatBox ( "Your new nickname has been set, to put it back to its original state you can use /deltag", thePlayer ) 
    else 
        --The newTag param was not entered, give an error message 
        outputChatBox ( "/addtag - Incorrect syntax, Correct: /addtag ", thePlayer ) 
    end 
end 
addCommandHandler ( "addtag", addPlayerCustomTag ) 
  
function removePlayerCustomTag ( thePlayer, command ) 
    --We first need to check that they have already used /addtag, let's do that now 
    local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
    if ( sOldNick ) then 
        --Great, they have a tag added, let's reset them 
  
        --First we will want to reset the element data back to its default (that being false) 
        setElementData ( thePlayer, "tempdata.originalnick", false ) 
  
        --Now set the client name back 
        setClientName ( thePlayer, sOldNick ) 
  
        --Notify them 
        outputChatBox ( "Your old nickname has been set", thePlayer ) 
    end 
end 
addCommandHandler ( "deltag", removePlayerCustomTag ) 
  

مثال setElementData

function joinTime ( ) 
    setElementData ( source, "joinTime", getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime' 
end 
-- Make our 'joinTime' function be called when a player joins 
addEventHandler ( "onPlayerJoin", getRootElement(), joinTime ) 
  
function showJoinTime ( source, commandName, playerName ) 
    if ( playerName ) then -- see if a player was specified 
        thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player 
        if ( thePlayer ) then -- if one was found... 
            local timeOnline = (getTickCount() - getElementData ( thePlayer, "joinTime" )) / 1000 -- calculates the time since join 
            outputChatBox ( getPlayerName ( thePlayer ).." joined "..timeOnline.." seconds ago", source ) -- output the player's join time 
        else 
            outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) -- display an error 
        end 
    else 
        -- display when the player who used the function joined and inform how to see other people's join time 
        local timeOnline = (getTickCount() - getElementData ( source, "joinTime" )) / 1000 -- calculate the time since join 
        outputChatBox ( "You joined " ..timeOnline.." seconds ago", source ) 
        outputChatBox ( "Use 'join_time ' to see other people's join time", source ) 
    end 
end 
-- Add a console command joinTime, that takes an optional parameter of a player's name 
addCommandHandler ( "joinTime", showJoinTime ) 
  

Edited by Guest
Link to comment
الحين وش نوع سيرفرك؟

يعني اف1 الفري روم ولا كيف؟

+ استخدم الداتا,

setElementData -- اذا انسجن تحط له داتا # 
getElementData -- تجيب الداتا # 

فري رومَ , ممكن تحط لي مثال؟ ,

قصده ادا انت خال نوعيه السيرفر play

الفري روم تقدر تبنده اسمه freerome

Link to comment
function addPlayerCustomTag ( thePlayer, command, newTag ) 
    --Let's make sure the newTag param has been entered... 
    if ( newTag ) then 
        --Grab their current playername for saving. 
        local sPlayerNickname = getPlayerName ( thePlayer ) 
        --Create their new nickname with their tag 
        local sNewPlayerNickname = newTag .. " " .. sPlayerNickname 
  
        --Let's first load the element data, see if it's there already 
        --The reason for this is that if a player were to do /addtag twice, 
        --the tag would be prepended a second time 
        local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
        if ( sOldNick == false ) then 
            --Save their orignal nickname in their element data 
            setElementData ( thePlayer, "tempdata.originalnick", sPlayerNickname ) 
        end 
  
        --Set their new nickname globally 
        setPlayerName ( thePlayer, sNewPlayerNickname ) 
  
        --Tell them it's done 
        outputChatBox ( "Your new nickname has been set, to put it back to its original state you can use /deltag", thePlayer ) 
    else 
        --The newTag param was not entered, give an error message 
        outputChatBox ( "/addtag - Incorrect syntax, Correct: /addtag ", thePlayer ) 
    end 
end 
addCommandHandler ( "addtag", addPlayerCustomTag ) 
  
function removePlayerCustomTag ( thePlayer, command ) 
    --We first need to check that they have already used /addtag, let's do that now 
    local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
    if ( sOldNick ) then 
        --Great, they have a tag added, let's reset them 
  
        --First we will want to reset the element data back to its default (that being false) 
        setElementData ( thePlayer, "tempdata.originalnick", false ) 
  
        --Now set the client name back 
        setClientName ( thePlayer, sOldNick ) 
  
        --Notify them 
        outputChatBox ( "Your old nickname has been set", thePlayer ) 
    end 
end 
addCommandHandler ( "deltag", removePlayerCustomTag ) 
  

function joinTime ( ) 
    setElementData ( source, "joinTime", getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime' 
end 
-- Make our 'joinTime' function be called when a player joins 
addEventHandler ( "onPlayerJoin", getRootElement(), joinTime ) 
  
function showJoinTime ( source, commandName, playerName ) 
    if ( playerName ) then -- see if a player was specified 
        thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player 
        if ( thePlayer ) then -- if one was found... 
            local timeOnline = (getTickCount() - getElementData ( thePlayer, "joinTime" )) / 1000 -- calculates the time since join 
            outputChatBox ( getPlayerName ( thePlayer ).." joined "..timeOnline.." seconds ago", source ) -- output the player's join time 
        else 
            outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) -- display an error 
        end 
    else 
        -- display when the player who used the function joined and inform how to see other people's join time 
        local timeOnline = (getTickCount() - getElementData ( source, "joinTime" )) / 1000 -- calculate the time since join 
        outputChatBox ( "You joined " ..timeOnline.." seconds ago", source ) 
        outputChatBox ( "Use 'join_time ' to see other people's join time", source ) 
    end 
end 
-- Add a console command joinTime, that takes an optional parameter of a player's name 
addCommandHandler ( "joinTime", showJoinTime ) 
  

آنا أبي اغلق لفري رومَ أذآ انسجن لاعب + الاكوأد ذي لشنو !؟

Link to comment

ضيف سطر جديد في سيرفر تحت سطر 114

و حط فيه

triggerEvent("onPlayerJail",thePlayer) 

و حط ذا في اول سطر

addEvent("onPlayerJail",true) 

افتح فري روم

افتح ملف

fr_server.lua

اكتب في اخر سطر

addEventHandler("onPlayerJail",root, 
function () 
triggerClientEvent(source,"PlayerJail",source) 
end 
) 
addEventHandler("onJailEnd",root, 
function () 
triggerClientEvent(source,"PlayerUnJail",source) 
end 
) 

ضيف في

fr_client.lua

اول السطر

addEvent("PlayerJail",true) 
addEvent("PlayerUnJail",true) 
addEventHandler("PlayerJail",root, 
function () 
 unbindKey('f1', 'down', toggleFRWindow) 
end 
) 
addEventHandler("PlayerUnJail",root, 
function () 
bindKey('f1', 'down', toggleFRWindow) 
end 
) 

و ضيف سطر جديد تحت سطر 1577

و حط فيه

if not getElementData(rRoot,""..getPlayerSerial(localPlayer).."-j") then 

و ضيف اند سطر

1579

Link to comment
ضيف سطر جديد في سيرفر تحت سطر 114

و حط فيه

triggerEvent("onPlayerJail",thePlayer) 

و حط ذا في اول سطر

addEvent("onPlayerJail",true) 

افتح فري روم

افتح ملف

fr_server.lua

اكتب في اخر سطر

addEventHandler("onPlayerJail",root, 
function () 
triggerClientEvent(source,"PlayerJail",source) 
end 
) 
addEventHandler("onJailEnd",root, 
function () 
triggerClientEvent(source,"PlayerUnJail",source) 
end 
) 

ضيف في

fr_client.lua

اول السطر

addEvent("PlayerJail",true) 
addEvent("PlayerUnJail",true) 
addEventHandler("PlayerJail",root, 
function () 
 unbindKey('f1', 'down', toggleFRWindow) 
end 
) 
addEventHandler("PlayerUnJail",root, 
function () 
bindKey('f1', 'down', toggleFRWindow) 
end 
) 

و ضيف سطر جديد تحت سطر 1577

و حط فيه

if not getElementData(rRoot,""..getPlayerSerial(localPlayer).."-j") then 

و ضيف اند سطر

1579

جربتَ طريقتك ماضبطت معيَ .

Link to comment

مدري وين كود السجن -_-,

بعطيك مثال للداتا ,

-- Server Side #

Data = true 
  
addCommandHandler('Check', 
function(player) 
    if Data then 
        setElementData(player,'Data','Cannot') 
        outputChatBox('You Cannot Open Freeroam window now !',player) 
        Data = false 
   else 
        setElementData(player,'Data','Can') 
        outputChatBox('You Can Open Freeroam window now !',player) 
        Data = true 
        end 
    end 
) 

fr_client.lua وفي ملف

تقريبا في سطر 1598,

function toggleFRWindow() 
    if getElementData(g_Me,'Data') == 'Cannot' then return false end 
    if isWindowOpen(wndMain) then 
        showCursor(false) 
        hideAllWindows() 
        colorPicker.closeSelect() 
    else 
        showCursor(true) 
        showAllWindows() 
    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...