Jump to content

مشكلة غريبة


Recommended Posts

عندي مودين بنكين مختلفت الاماكن ومختلف مكان توصيل شنطة البنك

لكن المشكلة اذا شغلت البنكين يتلبط الوقت وفي التوصيل يطلع مكانين

واذا شغلت أي واحد منهم الوقت مايتلخبط ويجي مكان واحد للتوصيل يعني 100% لكن كيف اسوي

ابغى اشغل الاثنين معى بعض

Link to comment

SERVER

TimerStart = {} 
TimerStop = {}
AllTable = {}
 
rRoot = getResourceRootElement(getThisResource())
r,g,b = 255,0,0 -- اللون
posX,posY = 0.2, 0.5 -- المكان على الشاشة
size = 2.0 -- الحجم
robbertimerStart = 1
robbertimerstop = 15
 
robbertime = robbertimerStart * 60 * 1000
robbertimeStop = robbertimerstop * 60 * 1000
 
function createTeamsOnStart ()
 
    TimerStart["timer"] = setTimer ( start_Roob, robbertime,1) ---time on start
    roobB = createObject (3095, 1521.9000244141, -2455.1000976563, -67, 0, 0, 186) 
    for i,player in ipairs(getElementsByType("player")) do
    setElementData(player, "Marker_destoy", 0)
        setElementData(player, "MiissoinStart", false) 
    end
    AllowUseFunctionRoob() 
end
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart)
 
addEvent ("roob", true)
function openRampLVSF ()
    setElementData( source, "Marker_destoy", tonumber( getElementData( source, "Marker_destoy" ) or 0 ) + 1 )
    textDisplayAddObserver ( RobberDisplay, source )
    setElementData(source, "Timeleft", 10)
    setPedAnimation (source, "ROB_BANK", "CAT_Safe_Rob" )
    setTimer(updateTimeLeft, 1000, getElementData(source, "Timeleft"), source)
end
addEventHandler ("roob", getRootElement(), openRampLVSF)
 
function updateTimeLeft(player)
    setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1)
    setTextRobber("Time remaining: [" .. getElementData(player, "Timeleft").. "] :الوقت المتبقي")
    playSoundFrontEnd ( player, 101 )  
    if tonumber(getElementData(player, "Timeleft")) == 0 then
        setPedAnimation (player, false)
        if isTimer(theTimer) and isTimer(theTime)  then
            killTimer(theTimer)
        end
        move()
        theTimer = setTimer(setTextRobber,50, 1 , "" ) 
    if tonumber(getElementData(player, "Marker_destoy")) == 6 then
    setElementData(player, "Marker_destoy", 0)
    makeobject(player)
    textDisplayAddObserver ( RobberDisplay, player )   
    end
    end
end
 
 
function makeobject(plr)
    notrolley = getAttachedElements ( plr )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
local x,y,z = getElementPosition ( plr )
object = createObject ( 1550, x, y, z )
if object then
attachElements ( object, plr, 0, -0.4, 0.4 )
--attachElements ( object, plr, -0.1, -0.20, 0.90, 0.000000, 45.000000, 0 )
local x,y,z = getElementPosition(plr)
setElementCollisionsEnabled(object, false)
end
Finsh_Missoin(plr)
end
 
function dd(plr)
notrolley = getAttachedElements ( plr )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
end
   
function player_Quit ()
    notrolley = getAttachedElements ( source )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
     if tonumber(getElementData(source, "Marker_destoy")) >= 1 then
     
     end
end
addEventHandler ( "onPlayerQuit", getRootElement(), player_Quit )
 
function move()
setTimer (moveObject, 2500, 1, roobB, 1000, 1521.9000244141, -2455.1000976563, -67) 
end    
 
 
 
function Doore ( player )
    if ( source == Doorentry ) then
        if ( getElementType ( player ) == "player" ) then
            fadeCamera ( player, false, 1, 0, 0, 0 )
            setTimer (
                function ( player )
                    if ( player and isElement ( player ) ) then
                        fadeCamera ( player, true, 1 )
                    end
                end
                ,1000, 1, player
            )
            --[[
              local Team = getPlayerTeam ( player )
            if ( Team == getTeamFromName ( "Police" ) ) then
            else
                setPlayerTeam ( player, getTeamFromName ( "Robber" ) )
                textDisplayAddObserver ( RobberDisplay, player )               
            end 
            --]]
        end
    end
end
addEventHandler ( "onMarkerHit", getRootElement(), Doore )
 
 
-- 390.7548828125, 173.8486328125, 1008.3828125
 
 
 
function Exitd( player )
    if (source == Exitdoor) then
        if getElementType(player) == "player" then
            fadeCamera ( player, false, 1, 0, 0, 0 )
            textDisplayRemoveObserver ( RobberDisplay, player )        
            setTimer ( fadeCamera, 1000, 1, player, true, 1 )
           
        end
    end
end 
addEventHandler ("onMarkerHit", getRootElement() ,Exitd )
 
function close()
setTimer (moveObject, 500, 1, roobB, 1000, 1521.9000244141, -2295.1000976563, -67) 
end
 
function startRobber ()
    if isTimer(TimerStart["timer"]) then killTimer(TimerStart["timer"]) end --kill timee
    --TimerStop["timer"] =  setTimer ( stop_Roob, robbertimeStop,1) -- time stop
    if marker then
    destroyElement ( marker )   
    end
    close() 
    marker = createMarker ( 1521.8994140625, -2296.599609375, -65.400001525879, "cylinder", 3, 0, 0, 0, 0 )
    addEventHandler("onMarkerHit", marker,onHit)   
end
 
function AllowUseFunctionRoob()
    bindRoob = 1
end
 
function onHit(hitter)
    if bindRoob == 1 then
    if ( hitter and getElementType(hitter) == "player" ) then
       
        bind_key( hitter )
        bindRoob = 0     
        setTimer(AllowUseFunctionRoob, 90000, 1)   
    end
    end
end
 
 
function bind_key ( player )
    bindKey ( player, "Tab", "down", "open_dooor" )
end
 
function unbind_key ( player )
    unbindKey ( player, "Tab", "down", "open_dooor" )
end
 
function updateTimeLeftDoor(player)
    setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1)
    setTextRobber("Will try to open the door:[" .. getElementData(player, "Timeleft").. "] :سيتم محاولة تحريك المصعد")
    playSoundFrontEnd ( player, 101 )  
    if tonumber(getElementData(player, "Timeleft")) == 0 then
        setElementData(player, "Timeleft", 0)      
        if isTimer(theTimer) and isTimer(theTime)  then
            killTimer(theTimer)
        end
        move()
        triggerClientEvent(player,"Make_Marker",root)      
   
        theTimer = setTimer(setTextRobber,50, 1 , "" )
        if isTimer(TimerStop["timer"]) then killTimer(TimerStop["timer"]) end --kill timee
        TimerStop["timer"] =  setTimer ( stop_Roob, robbertimeStop,1) -- time stop     
    end
end
 
function key_bind (player)
if marker then
removeEventHandler("onMarkerHit", marker,onHit)
destroyElement ( marker )
end
triggerClientEvent(root,"roob_bank",root)
exports['topbarchat']:sendClientMessage ( "* * * * * * * * * * * * * * *", root, 255, 000, 000, true )
exports['topbarchat']:sendClientMessage ( "#C0C0C0 يقوم بسرقه البنك الأحمر [" .. getPlayerName(player) .. "] #C0C0C0 اللاعب", root, 255, 000, 000, true )
 
exports['topbarchat']:sendClientMessage ( "* * * * * * * * * * * * * * *", root, 255, 000, 000, true )
setElementData(player, "MiissoinStart", true)
textDisplayAddObserver ( RobberDisplay, player )
setElementData(player, "Timeleft", 10)
setPlayerWantedLevel ( player, 6 )
setTimer(updateTimeLeftDoor, 1000, getElementData(player, "Timeleft"), player)
end
 
addEventHandler("onPlayerWasted", root,
    function()
    local missin = getElementData(source, "MiissoinStart")
    if missin then
    notrolley = getAttachedElements ( source )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
    textDisplayRemoveObserver ( RobberDisplay, source )
    if dropMarker and dropBlip then
    destroyElement ( dropMarker )
    destroyElement ( dropBlip )
    end
    removeEventHandler("onMarkerHit",dropMarker,onDrop) 
    local x,y,z = getElementPosition ( source )
    object_wast = createObject ( 1550, x, y, z )       
    marker_wast = createMarker ( x, y, z, "cylinder", 3, 0, 0, 0, 0 )   
    addEventHandler("onMarkerHit", marker_wast,onHiter) 
    setElementData(source, "MiissoinStart", false) 
        end
    end
)
 
function onHiter(hitter)
    if ( hitter and getElementType(hitter) == "player" ) then
        removeEventHandler("onMarkerHit",dropMarker,onDrop)
        destroyElement ( source )      
        wasted(hitter,true) 
    end
end
 
Link to comment

أنت فاهم علي ايش اقصد بأسم الألمنت داتا و التريقر؟

شوف مثلاً

Timeleft اسم الألمنت داتا هنا

setElementData(source, "Timeleft", 10) 

المشكلة عندك ان اسم الألمنت داتا في المودين نفس الشي

لازم تغير اسم الالمنت داتا عشان ما يسبب لك مشاكل

مثلاً المود الأول تضيف فيه رقم 1

setElementData(source, "Timeleft1", 10) 

و المود الثاني تضيف فيه رقم 2

setElementData(source, "Timeleft2", 10) 

و التريقر نفس الشي

roob_bank اسم التريقر هنا

triggerClientEvent(root,"roob_bank",root) 

Link to comment

ممكن طلب تغير لي في الكود هذا الالمنت والداتا

لان في بعضها بلير ومدري وش ومتكرر اكثر من مرة ابغى تغير هذا واشوف التغيير

واطبقة في الثاني

انا ترى خذيت الاسم حق الداتا مثلا

bank

وسيوت له استبدال الكل

bank1

ينفع ؟؟

Link to comment

جرب

TimerStart = {} 
TimerStop = {}
AllTable = {}
 
rRoot = getResourceRootElement(getThisResource())
r,g,b = 255,0,0 -- اللون
posX,posY = 0.2, 0.5 -- المكان على الشاشة
size = 2.0 -- الحجم
robbertimerStart = 1
robbertimerstop = 15
 
robbertime = robbertimerStart * 60 * 1000
robbertimeStop = robbertimerstop * 60 * 1000
 
function createTeamsOnStart ()
 
    TimerStart["timer"] = setTimer ( start_Roob, robbertime,1) ---time on start
    roobB = createObject (3095, 1521.9000244141, -2455.1000976563, -67, 0, 0, 186)
    for i,player in ipairs(getElementsByType("player")) do
    setElementData(player, "Marker_destoy", 0)
        setElementData(player, "MiissoinStart", false)
    end
    AllowUseFunctionRoob()
end
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart)
 
addEvent ("roob", true)
function openRampLVSF ()
    setElementData( source, "Marker_destoy", tonumber( getElementData( source, "Marker_destoy" ) or 0 ) + 1 )
    textDisplayAddObserver ( RobberDisplay, source )
    setElementData(source, "Timeleft1", 10)
    setPedAnimation (source, "ROB_BANK", "CAT_Safe_Rob" )
    setTimer(updateTimeLeft1, 1000, getElementData(source, "Timeleft1"), source)
end
addEventHandler ("roob", getRootElement(), openRampLVSF)
 
function updateTimeLeft1(player)
    setElementData(player, "Timeleft1", getElementData(player, "Timeleft1") - 1)
    setTextRobber("Time remaining: [" .. getElementData(player, "Timeleft1").. "] :الوقت المتبقي")
    playSoundFrontEnd ( player, 101 )  
    if tonumber(getElementData(player, "Timeleft1")) == 0 then
        setPedAnimation (player, false)
        if isTimer(theTimer) and isTimer(theTime)  then
            killTimer(theTimer)
        end
        move()
        theTimer = setTimer(setTextRobber,50, 1 , "" )
    if tonumber(getElementData(player, "Marker_destoy")) == 6 then
    setElementData(player, "Marker_destoy", 0)
    makeobject(player)
    textDisplayAddObserver ( RobberDisplay, player )  
    end
    end
end
 
 
function makeobject(plr)
    notrolley = getAttachedElements ( plr )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
local x,y,z = getElementPosition ( plr )
object = createObject ( 1550, x, y, z )
if object then
attachElements ( object, plr, 0, -0.4, 0.4 )
--attachElements ( object, plr, -0.1, -0.20, 0.90, 0.000000, 45.000000, 0 )
local x,y,z = getElementPosition(plr)
setElementCollisionsEnabled(object, false)
end
Finsh_Missoin(plr)
end
 
function dd(plr)
notrolley = getAttachedElements ( plr )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
end
   
function player_Quit ()
    notrolley = getAttachedElements ( source )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
     if tonumber(getElementData(source, "Marker_destoy")) >= 1 then
     
     end
end
addEventHandler ( "onPlayerQuit", getRootElement(), player_Quit )
 
function move()
setTimer (moveObject, 2500, 1, roobB, 1000, 1521.9000244141, -2455.1000976563, -67)
end    
 
 
 
function Doore ( player )
    if ( source == Doorentry ) then
        if ( getElementType ( player ) == "player" ) then
            fadeCamera ( player, false, 1, 0, 0, 0 )
            setTimer (
                function ( player )
                    if ( player and isElement ( player ) ) then
                        fadeCamera ( player, true, 1 )
                    end
                end
                ,1000, 1, player
            )
            --[[
              local Team = getPlayerTeam ( player )
            if ( Team == getTeamFromName ( "Police" ) ) then
            else
                setPlayerTeam ( player, getTeamFromName ( "Robber" ) )
                textDisplayAddObserver ( RobberDisplay, player )              
            end
            --]]
        end
    end
end
addEventHandler ( "onMarkerHit", getRootElement(), Doore )
 
 
-- 390.7548828125, 173.8486328125, 1008.3828125
 
 
 
function Exitd( player )
    if (source == Exitdoor) then
        if getElementType(player) == "player" then
            fadeCamera ( player, false, 1, 0, 0, 0 )
            textDisplayRemoveObserver ( RobberDisplay, player )        
            setTimer ( fadeCamera, 1000, 1, player, true, 1 )
           
        end
    end
end
addEventHandler ("onMarkerHit", getRootElement() ,Exitd )
 
function close()
setTimer (moveObject, 500, 1, roobB, 1000, 1521.9000244141, -2295.1000976563, -67)
end
 
function startRobber ()
    if isTimer(TimerStart["timer"]) then killTimer(TimerStart["timer"]) end --kill timee
    --TimerStop["timer"] =  setTimer ( stop_Roob, robbertimeStop,1) -- time stop
    if marker then
    destroyElement ( marker )  
    end
    close()
    marker = createMarker ( 1521.8994140625, -2296.599609375, -65.400001525879, "cylinder", 3, 0, 0, 0, 0 )
    addEventHandler("onMarkerHit", marker,onHit)  
end
 
function AllowUseFunctionRoob()
    bindRoob = 1
end
 
function onHit(hitter)
    if bindRoob == 1 then
    if ( hitter and getElementType(hitter) == "player" ) then
       
        bind_key( hitter )
        bindRoob = 0    
        setTimer(AllowUseFunctionRoob, 90000, 1)  
    end
    end
end
 
 
function bind_key ( player )
    bindKey ( player, "Tab", "down", "open_dooor" )
end
 
function unbind_key ( player )
    unbindKey ( player, "Tab", "down", "open_dooor" )
end
 
function updateTimeLeft1Door(player)
    setElementData(player, "Timeleft1", getElementData(player, "Timeleft1") - 1)
    setTextRobber("Will try to open the door:[" .. getElementData(player, "Timeleft1").. "] :سيتم محاولة تحريك المصعد")
    playSoundFrontEnd ( player, 101 )  
    if tonumber(getElementData(player, "Timeleft1")) == 0 then
        setElementData(player, "Timeleft1", 0)      
        if isTimer(theTimer) and isTimer(theTime)  then
            killTimer(theTimer)
        end
        move()
        triggerClientEvent(player,"Make_Marker",root)      
   
        theTimer = setTimer(setTextRobber,50, 1 , "" )
        if isTimer(TimerStop["timer"]) then killTimer(TimerStop["timer"]) end --kill timee
        TimerStop["timer"] =  setTimer ( stop_Roob, robbertimeStop,1) -- time stop    
    end
end
 
function key_bind (player)
if marker then
removeEventHandler("onMarkerHit", marker,onHit)
destroyElement ( marker )
end
triggerClientEvent(root,"roob_bank1",root)
exports['topbarchat']:sendClientMessage ( "* * * * * * * * * * * * * * *", root, 255, 000, 000, true )
exports['topbarchat']:sendClientMessage ( "#C0C0C0 يقوم بسرقه البنك الأحمر [" .. getPlayerName(player) .. "] #C0C0C0 اللاعب", root, 255, 000, 000, true )
 
exports['topbarchat']:sendClientMessage ( "* * * * * * * * * * * * * * *", root, 255, 000, 000, true )
setElementData(player, "MiissoinStart", true)
textDisplayAddObserver ( RobberDisplay, player )
setElementData(player, "Timeleft1", 10)
setPlayerWantedLevel ( player, 6 )
setTimer(updateTimeLeft1Door, 1000, getElementData(player, "Timeleft1"), player)
end
 
addEventHandler("onPlayerWasted", root,
    function()
    local missin = getElementData(source, "MiissoinStart")
    if missin then
    notrolley = getAttachedElements ( source )
    for k,v in pairs(notrolley) do
        if getElementType ( v ) == "object" then
            destroyElement ( v )
        end
    end
    textDisplayRemoveObserver ( RobberDisplay, source )
    if dropMarker and dropBlip then
    destroyElement ( dropMarker )
    destroyElement ( dropBlip )
    end
    removeEventHandler("onMarkerHit",dropMarker,onDrop)
    local x,y,z = getElementPosition ( source )
    object_wast = createObject ( 1550, x, y, z )      
    marker_wast = createMarker ( x, y, z, "cylinder", 3, 0, 0, 0, 0 )  
    addEventHandler("onMarkerHit", marker_wast,onHiter)
    setElementData(source, "MiissoinStart", false)
        end
    end
)
 
function onHiter(hitter)
    if ( hitter and getElementType(hitter) == "player" ) then
        removeEventHandler("onMarkerHit",dropMarker,onDrop)
        destroyElement ( source )      
        wasted(hitter,true)
    end
end
 
Link to comment

خخ poor طلعت ذكي

Timeleft بس ترا انا اقصد كل الألمنت داتا الي بالمود مو بس

المود الثاني مو لازم تعدل فيه بس اهم شي الألمنت داتا و التريقر في المودين مختلفين عن بعض

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