Jump to content

[HELP] What Wrong With Script


#Al-Ha[J]aRii

Recommended Posts

Posted

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 
) 

Try a little harder to be a little better

I Can Made To You Any Script For $

Skype : alhajarii-mtasa

Posted (edited)

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

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted
Is this the full script???

Because the Lock-Unlock isn't defined!

it's for panel :lol:

in button Lock-Unlock

this is not full of the my script

just the code lock unlock Car

Try a little harder to be a little better

I Can Made To You Any Script For $

Skype : alhajarii-mtasa

Posted
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

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

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

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

  

Posted
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

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted (edited)

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

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
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

Try a little harder to be a little better

I Can Made To You Any Script For $

Skype : alhajarii-mtasa

Posted

Your Welcome Dont Forget to Copy My Last Post :D

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

Samer i think because you forget this Part

if vehicle then

--Code

And Jaysd1 it's Alredy sloved .

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

Mr.Pres[T]ege

My Script Worked But it's Stupied if you lock it and out and want to get in car you cant lol

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

Yeah Tha'ts Right He Should make an bind key or you know what i will make it right now .

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

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