Jump to content

setVehicleLocked تصحيح كود | Thx To MR.S3D !


Recommended Posts

شباب وين الخطأ في الكود .. ؟

server side --

addEvent ( "lockcar", true ) 
function lockcar ( thePlayer ) 
    playervehicle = getPlayerOccupiedVehicle ( thePlayer )    
    if ( playervehicle ) then                                 
        if isVehicleLocked ( playervehicle ) then             
            setVehicleLocked ( playervehicle, true )        
        else                                                    
        end 
    end 
end 
addEventHandler( "lockcar", root, lockcar ) 
  
addEvent ( "lockcar2", true ) 
function lockcar ( thePlayer ) 
    playervehicle = getPlayerOccupiedVehicle ( thePlayer )    
    if ( playervehicle ) then                                 
        if isVehicleLocked ( playervehicle ) then             
            setVehicleLocked ( playervehicle, false )        
        else                                                    
        end 
    end 
end 
addEventHandler( "lockcar2", root, lockcar2 ) 

Edited by Guest
Link to comment

فيه تكمله للكود كلنت ولا سيرفر؟

+ كودك تقدر تختصره كذا

addEvent ( "lockcar", true ) 
function lockcar ( thePlayer ) 
    playervehicle = getPlayerOccupiedVehicle ( thePlayer )   
    if ( playervehicle ) then                                 
        if isVehicleLocked ( playervehicle ) then             
            setVehicleLocked(playervehicle,true)       
        else 
       setVehicleLocked(playervehicle,false) 
        end 
    end 
end 
addEventHandler( "lockcar", root, lockcar ) 

Link to comment

المشكلة اثنينكم ملخبطين في تحقيق الشرط ..

if isVehicleLocked ( playervehicle ) then -- إذا تحقق الشرط ان السيارة مقفلة            
    setVehicleLocked ( playervehicle, true ) -- يقفلها مرة ثانية ..... حشيش <@> 

Link to comment

ذآ الترايقر

client side --

  
  
  
addEventHandler("onClientGUIClick", root, 
function() 
  
if ( source ==  GUIEditor.button[1] ) then  
  
triggerServerEvent("lockcar",getLocalPlayer())  
  
elseif ( source ==  GUIEditor.button[2] ) then  
  
triggerServerEvent("lockcar2",getLocalPlayer())  
  
end  
  
end  
) 

:roll:

Link to comment

او لازم يكون الترايقر كذا .. ؟

  
  
  
addEventHandler("onClientGUIClick", root, 
function( thePlayer ) 
  
if ( thePlayer ==  GUIEditor.button[1] ) then  
  
triggerServerEvent("lockcar",getLocalPlayer())  
  
elseif ( thePlayer ==  GUIEditor.button[2] ) then  
  
triggerServerEvent("lockcar2",getLocalPlayer())  
  
end  
  
end  
) 

Link to comment

--Client--

addEventHandler("onClientGUIClick", root, 
function()  
if ( source ==  GUIEditor.button[1] ) then 
triggerServerEvent("lockcar",getLocalPlayer()) 
         end 
end) 

--Server--

addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
function() 
    playervehicle = getPlayerOccupiedVehicle ( source )   
    if ( playervehicle ) then                                       
            setVehicleLocked ( playervehicle, false )       
        else            
            if isVehicleLocked ( playervehicle ) then 
            setVehicleLocked ( playervehicle, true ) 
        end 
    end 
end) 
Link to comment
  
  
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
function() 
    playervehicle = getPlayerOccupiedVehicle ( source )  
    if ( playervehicle ) then -- يتأكد انه في السيارة                                      
            setVehicleLocked ( playervehicle, false )      -- يفتح السيارة 
        else          -- اذا ماكان في سيارة 
            if isVehicleLocked ( playervehicle ) then -- يتأكد ان مخ اللاعب مقفل 
            setVehicleLocked ( playervehicle, true ) --- يقفله له مره ثانيه 
        end 
    end 
end 
  

ياسلام عليك :lol:

Link to comment

addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
function() 
    playervehicle = getPlayerOccupiedVehicle ( source )   
    if ( playervehicle ) then                                       
            setVehicleLocked ( playervehicle, true )       
        else           
            if isVehicleLocked ( playervehicle ) then 
            setVehicleLocked ( playervehicle, false ) 
        end 
    end 
end) 

تلخبطت بالفالس والترو

Link to comment

التصحيح --

  
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
    function() 
        local playervehicle = getPlayerOccupiedVehicle ( source )  
        if ( playervehicle ) then     
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle )) 
        end 
    end 
) 
  
  

Link to comment

طيب , لين جيت أبي افك القفل ..؟

انا مسوي لوحة فيها زرين

زر يخلي السيارة مقفلة

وزر يفك القفل

بكذا زر الي يفك القفل مامنه فايدة و اللاعب ادا أقفل السيارة مايقدر يفتحها مرة ثانية !!

><

Link to comment
التصحيح --
  
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
    function() 
        local playervehicle = getPlayerOccupiedVehicle ( source )  
        if ( playervehicle ) then     
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle )) 
        end 
    end 
) 
  
  

العجيب انه مافي فالس وترو وشغال هه,

طيب , لين جيت أبي افك القفل ..؟

انا مسوي لوحة فيها زرين

زر يخلي السيارة مقفلة

وزر يفك القفل

بكذا زر الي يفك القفل مامنه فايدة و اللاعب ادا أقفل السيارة مايقدر يفتحها مرة ثانية !!

><

الكود راح يقفل السيارة ويفتحها بنفس الزر,

Link to comment
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
function(   ) 
    playervehicle = getPlayerOccupiedVehicle ( source )  
    if ( playervehicle ) then                                   
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle ) )     
    end 
end 
) 
  

Link to comment
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
function(   ) 
    playervehicle = getPlayerOccupiedVehicle ( source )  
    if ( playervehicle ) then                                   
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle ) )     
    end 
end 
) 
  

التصحيح --
  
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
    function() 
        local playervehicle = getPlayerOccupiedVehicle ( source )  
        if ( playervehicle ) then     
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle )) 
        end 
    end 
) 
  
  

Link to comment

كلنت

  
addEventHandler("onClientGUIClick", root, 
    function() 
        if ( source ==  GUIEditor.button[1] ) then 
            triggerServerEvent("lockcar",getLocalPlayer(),true) 
        elseif ( source ==  GUIEditor.button[2] ) then  
            triggerServerEvent("lockcar",getLocalPlayer(),false) 
        end 
    end 
) 
  

سيرفر

  
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
    function(bole) 
        local playervehicle = getPlayerOccupiedVehicle ( source )  
        if ( playervehicle ) then 
            if bole and isVehicleLocked ( playervehicle ) then return end 
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle )) 
        end 
    end 
) 
  

Link to comment
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
function(   ) 
    playervehicle = getPlayerOccupiedVehicle ( source )  
    if ( playervehicle ) then                                   
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle ) )     
    end 
end 
) 
  

التصحيح --
  
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
    function() 
        local playervehicle = getPlayerOccupiedVehicle ( source )  
        if ( playervehicle ) then     
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle )) 
        end 
    end 
) 
  
  

اوهـ / = احسبة صفحة وحدهـ -.- ماعليه خخ

Link to comment
كلنت
  
addEventHandler("onClientGUIClick", root, 
    function() 
        if ( source ==  GUIEditor.button[1] ) then 
            triggerServerEvent("lockcar",getLocalPlayer(),true) 
        elseif ( source ==  GUIEditor.button[2] ) then  
            triggerServerEvent("lockcar",getLocalPlayer(),false) 
        end 
    end 
) 
  

سيرفر

  
addEvent ( "lockcar", true ) 
addEventHandler( "lockcar", root, 
    function(bole) 
        local playervehicle = getPlayerOccupiedVehicle ( source )  
        if ( playervehicle ) then 
            if bole and isVehicleLocked ( playervehicle ) then return end 
            setVehicleLocked ( playervehicle, not isVehicleLocked ( playervehicle )) 
        end 
    end 
) 
  

Thx !

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