Jump to content

اضافة كود


Recommended Posts

Posted

جرب

function lockcar(thePlayer) 
    playervehicle=getPlayerOccupiedVehicle(thePlayer); 
    if(playervehicle) then 
        if(isVehicleLocked(playervehicle)) then 
            setVehicleLocked(playervehicle,false); 
            outputChatBox("#006400Vehicle Unlocked",thePlayer,255,0,0); 
        else 
            setVehicleLocked(playervehicle,true); 
            outputChatBox("#FF0000Vehicle Locked",thePlayer,255,0,0); 
        end 
    end 
end 
  
function exit(player,seat,jacked) 
    if(isVehicleLocked(source)) then 
        setVehicleLocked(source,false); 
        outputChatBox("Vehicle Unlocked",player,255,0,0); 
    end 
end 
  
bindKey ( "l", "down", lockcar ); 
addEventHandler("onVehicleExit",getRootElement(),exit); 
  

Posted (edited)
    function lockcar(thePlayer) 
        playervehicle=getPlayerOccupiedVehicle(thePlayer); 
        if(playervehicle) then 
            if(isVehicleLocked(playervehicle)) then 
                setVehicleLocked(playervehicle,false); 
                outputChatBox("* Vehicle Unlocked",thePlayer,0,0,255); 
            else 
                setVehicleLocked(playervehicle,true); 
                outputChatBox("* Vehicle Locked",thePlayer,255,0,0); 
            end 
        end 
    end 
      
    function exit(player,seat,jacked) 
        if(isVehicleLocked(source)) then 
            setVehicleLocked(source,false); 
            outputChatBox("* Vehicle Unlocked",player,0,0,255); 
        end 
    end 
      
function 
bindKey("l","down",lockcar) 
    end 
) 
    addEventHandler("onVehicleExit",getRootElement(),exit); 
      

لم يتم التجربة

Edited by Guest
Posted
ماشتغل :oops:

مااتوقع فيه اخطاء

ركبه زين وتأكد انه سيرفر + تأكد من الميتا انه سيرفر

وتأكد من الميتا لا يكون فيه اخطاء

واسم المود لا يكون عربي او فيه مسافات وحروف غير انجليزية

Posted

الاكواد خطأ الكود سيرفر و الـ :

bindKey :

bindKey ( player thePlayer, string key, string keyState, function handlerFunction,  [ var arguments, ... ] ) 

فـ الكود يصير كذآ :

-- # Server Side ~ 
  
addEventHandler('onResourceStart',resourceRoot, 
    function (      ) 
        for _,v in ipairs ( getElementsByType ( 'player' ) ) do 
            bindKey ( v,'l','down',aLockHandler ) 
    end 
end 
) 
  
addEventHandler('onPlayerJoin',root, 
    function (      ) 
        bindKey ( source,'l','down',aLockHandler ) 
    end 
) 
  
function aLockHandler ( player ) 
    if isElement ( player ) then 
        if getPlayerOccupiedVehicle ( player ) then 
            if not isVehicleLocked ( getPlayerOccupiedVehicle ( player ) ) then 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),true ) 
                outputChatBox ( 'Vehicle Locked',player,0,255,0 ) 
            else 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),false ) 
                outputChatBox ( 'Vehicle UnLocked',player,255,0,0 ) 
                end 
            else 
                outputChatBox ( 'You Must Be With a Vehicle',player,255,0,0 ) 
        end 
    end 
end 
  
function aUnLockHandler (  ) 
    if isVehicleLocked ( source ) then 
        setVehicleLocked ( source,false ) 
    end 
end 
addEventHandler('onVehicleExit',root,aUnLockHandler) 

.. عموما لم يتم التجربة المفترض يشتغل بـ اذن الله ..

  

Posted
الاكواد خطأ الكود سيرفر و الـ :

bindKey :

bindKey ( player thePlayer, string key, string keyState, function handlerFunction,  [ var arguments, ... ] ) 

فـ الكود يصير كذآ :

-- # Server Side ~ 
  
addEventHandler('onResourceStart',resourceRoot, 
    function (      ) 
        for _,v in ipairs ( getElementsByType ( 'player' ) ) do 
            bindKey ( v,'l','down',aLockHandler ) 
    end 
end 
) 
  
addEventHandler('onPlayerJoin',root, 
    function (      ) 
        bindKey ( source,'l','down',aLockHandler ) 
    end 
) 
  
function aLockHandler ( player ) 
    if isElement ( player ) then 
        if getPlayerOccupiedVehicle ( player ) then 
            if not isVehicleLocked ( getPlayerOccupiedVehicle ( player ) ) then 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),true ) 
                outputChatBox ( 'Vehicle Locked',player,0,255,0 ) 
            else 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),false ) 
                outputChatBox ( 'Vehicle UnLocked',player,255,0,0 ) 
                end 
            else 
                outputChatBox ( 'You Must Be With a Vehicle',player,255,0,0 ) 
        end 
    end 
end 
  
function aUnLockHandler (  ) 
    if isVehicleLocked ( source ) then 
        setVehicleLocked ( source,false ) 
    end 
end 
addEventHandler('onVehicleExit',root,aUnLockHandler) 

.. عموما لم يتم التجربة المفترض يشتغل بـ اذن الله ..

لقد اتى الخبير

:D

Posted
شكرا برستيج

لما اشوف اكوادك استريح نفسينا والله العظيم

مشكلة لما اخليه مغلق كل واحد يركب مايتغلق :|:|

لانة يوم ينزل اي لاعب من السيارة بدون مآينزل مع الباب بـ حدث ستارت ينفتح القفل

  

Posted
الكود اشتغل ؟

باين من كلامه

من اكوادك استريح نفسينا والله العظيم

فـ

99%

انه اشتغل

:lol::lol::lol:

Posted
function aUnLockHandler (  ) 
    if isVehicleLocked ( source ) then 
        setVehicleLocked ( source,false ) 
    end 
end 
addEventHandler('onVehicleExit',root,aUnLockHandler) 

شل هالجزء وجرب

  

Posted
شكرا برستيج

لما اشوف اكوادك استريح نفسينا والله العظيم

مشكلة لما اخليه مغلق كل واحد يركب مايتغلق :|:|

جرب هذا

-- # Server Side ~ 
  
addEventHandler('onResourceStart',resourceRoot, 
    function (      ) 
        for _,v in ipairs ( getElementsByType ( 'player' ) ) do 
            bindKey ( v,'l','down',aLockHandler ) 
    end 
end 
) 
  
addEventHandler('onPlayerJoin',root, 
    function (      ) 
        bindKey ( source,'l','down',aLockHandler ) 
    end 
) 
  
function aLockHandler ( player ) 
    if isElement ( player ) then 
        if getPlayerOccupiedVehicle ( player ) then 
            if not isVehicleLocked ( getPlayerOccupiedVehicle ( player ) ) then 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),true ) 
                outputChatBox ( 'Vehicle Locked',player,0,255,0 ) 
            else 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),false ) 
                outputChatBox ( 'Vehicle UnLocked',player,255,0,0 ) 
                end 
            else 
                outputChatBox ( 'You Must Be With a Vehicle',player,255,0,0 ) 
        end 
    end 
end 
  
function aUnLockHandler (  ) 
    if isVehicleLocked ( source ) then 
        setVehicleLocked ( source,false ) 
    end 
end 
addEventHandler('onVehicleExit',root,aUnLockHandler) 
addEventHandler('onVehicleEnter',root,aUnLockHandler) 

Posted
-- # Server Side ~ 
  
addEventHandler('onResourceStart',resourceRoot, 
    function (      ) 
        for _,v in ipairs ( getElementsByType ( 'player' ) ) do 
            bindKey ( v,'l','down',aLockHandler ) 
    end 
end 
) 
  
addEventHandler('onPlayerJoin',root, 
    function (      ) 
        bindKey ( source,'l','down',aLockHandler ) 
    end 
) 
  
function aLockHandler ( player ) 
    if isElement ( player ) then 
        if getPlayerOccupiedVehicle ( player ) then 
            if not isVehicleLocked ( getPlayerOccupiedVehicle ( player ) ) then 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),true ) 
                outputChatBox ( 'Vehicle Locked',player,0,255,0 ) 
            else 
                setVehicleLocked ( getPlayerOccupiedVehicle ( player ),false ) 
                outputChatBox ( 'Vehicle UnLocked',player,255,0,0 ) 
                end 
            else 
                outputChatBox ( 'You Must Be With a Vehicle',player,255,0,0 ) 
        end 
    end 
end 

  

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