Jump to content

[HELP] What Wrong With Script


#Al-Ha[J]aRii

Recommended Posts

hi all

what wrong with this

script

it's for window button Lock-Unlock

    addEventHandler( "onClientGUIClick", root, 
  
    function () 
  
        if ( source == Lock-UnLock ) then 
  
        local playervehicle = getPedOccupiedVehicle ( thePlayer ) 
  
        if playervehicle then 
  
        setVehicleLocked ( playervehicle, true ) 
         
        outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) 
        else 
         
        setVehicleLocked ( playervehicle, false ) 
         
        outputChatBox ( " Your Vehicle UnLock !",255, 0, 0, true ) 
  
  
    end  
        end 
end 
) 

Link to comment

Edited Thank's Fhoode :D

addEventHandler( "onClientGUIClick", root, 
function () 
        if ( source == Lock-UnLock ) then 
        if (isPedInVehicle ) then 
        local playervehicle = getPedOccupiedVehicle(localPlayer) 
        if(isVehicleLocked ( playervehicle )) then 
        setVehicleLocked ( playervehicle, false ) 
        outputChatBox ( "Your Vehicle UnLocked !",255, 0, 0, true ) 
        else 
        setVehicleLocked ( playervehicle, true ) 
        outputChatBox( " Your  Vehicle Locked  !", 255, 0, 0 , true) 
      end 
    end 
   end 
end 
) 

Edited by Guest
Link to comment
addEventHandler( "onClientGUIClick", Lock-UnLock, 
function () 
        local vehicle = getPedOccupiedVehicle(localPlayer) 
        setVehicleLocked ( vehicle, true ) 
        outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) 
       else 
        setVehicleLocked ( vehicle, false ) 
        outputChatBox ( "Your Vehicle unLock !",255, 0, 0, true ) 
    end 
) 

Link to comment
If You Use - Syntax The Script Won't Work And The Code Isn't Right .

if you use - as a Button Name

well say error

But if You Use it in onClientGUIClick wont say anyting :D

Yes That's Right @ Max Also You're Script Won't Open The Vehilce After Locked It You Should To Check if isVehicleLocked or Not .

Link to comment
addEventHandler( "onClientGUIClick", Lock-UnLock, 
function () 
        local vehicle = getPedOccupiedVehicle(localPlayer) 
        setVehicleLocked ( vehicle, true ) 
        outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) 
       else 
        setVehicleLocked ( vehicle, false ) 
        outputChatBox ( "Your Vehicle unLock !",255, 0, 0, true ) 
    end 
) 

:lol: Samer shortcut for it

Link to comment

try this:

addEventHandler( "onClientGUIClick",guiRoot,function() 
     if ( source == Lock-UnLock ) then 
          local playervehicle = getPedOccupiedVehicle (localPlayer) 
          if playervehicle then 
               if isVehicleLocked(playervehicle) then 
                    setVehicleLocked ( playervehicle, false ) 
                    outputChatBox ( " Your Vehicle UnLock !",255, 0, 0, true ) 
               else 
                    setVehicleLocked ( playervehicle, true ) 
                    outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) 
               end 
          else 
               outputChatBox("Sorry, but you aren't in a vehicle!",255,0,0,true) 
          end 
     end 
end) 

Edited by Guest
Link to comment
addEventHandler( "onClientGUIClick", Lock-UnLock, 
function () 
        local vehicle = getPedOccupiedVehicle(localPlayer) 
        setVehicleLocked ( vehicle, true ) 
        outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) 
       else 
        setVehicleLocked ( vehicle, false ) 
        outputChatBox ( "Your Vehicle unLock !",255, 0, 0, true ) 
    end 
) 

lol ur code wrong samer

thanx max and all

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