Jump to content

[PROBLEM]


gghvcffcv

Recommended Posts

I have a problem with this script, i want that if the player is in the Gang (Castillo system) can get in the car, and if he is not to restrict the car

vehicle = createVehicle ( 411, 1852, -1391, 13, 0, 0, 90 ) 
state = setVehicleDoorState ( vehicle, 1, 1 ) 
setVehicleDamageProof ( vehicle, true ) 
  
function  lockPrivate( player, seat, jacked ) 
     if ( getElementData ( player, "gang" ) == "SWAT" ) then  
        cancelEvent ( ) 
        outputChatBox ( "This car is Locked For SWAT!", player, 0, 245, 82, false ) 
    else 
        outputChatBox ( "Welcome!", player, 0, 255, 0, false ) 
end 
end 
addEventHandler ( "onVehicleStartEnter", vehicle, lockPrivate ) 
  

Link to comment

The condition is not correct. If the player's gang is SWAT, ban him from using the car, else, he's welcome.

Should be this I think:

vehicle = createVehicle ( 411, 1852, -1391, 13, 0, 0, 90 ) 
state = setVehicleDoorState ( vehicle, 1, 1 ) 
setVehicleDamageProof ( vehicle, true ) 
  
function  lockPrivate( player, seat, jacked ) 
     if ( getElementData ( player, "gang" ) == "SWAT" ) then 
        outputChatBox ( "Welcome!", player, 0, 255, 0, false ) 
    else 
        cancelEvent ( ) 
        outputChatBox ( "This car is Locked For SWAT!", player, 0, 245, 82, false ) 
end 
end 
addEventHandler ( "onVehicleStartEnter", vehicle, lockPrivate ) 
  

Link to comment
The condition is not correct. If the player's gang is SWAT, ban him from using the car, else, he's welcome.

Should be this I think:

vehicle = createVehicle ( 411, 1852, -1391, 13, 0, 0, 90 ) 
state = setVehicleDoorState ( vehicle, 1, 1 ) 
setVehicleDamageProof ( vehicle, true ) 
  
function  lockPrivate( player, seat, jacked ) 
     if ( getElementData ( player, "gang" ) == "SWAT" ) then 
        outputChatBox ( "Welcome!", player, 0, 255, 0, false ) 
    else 
        cancelEvent ( ) 
        outputChatBox ( "This car is Locked For SWAT!", player, 0, 245, 82, false ) 
end 
end 
addEventHandler ( "onVehicleStartEnter", vehicle, lockPrivate ) 
  

Working, Thanks you!

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