Jump to content

اضافة كود


Recommended Posts

جرب

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); 
  

Link to comment
    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
Link to comment
ماشتغل :oops:

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

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

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

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

Link to comment

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

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) 

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

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

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

Link to comment
شكرا برستيج

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

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

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

Link to comment
شكرا برستيج

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

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

جرب هذا

-- # 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) 

Link to comment
-- # 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 

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