Jump to content

Vehicle team restriction


DRW

Recommended Posts

Posted

I'm editing the https://community.multitheftauto.com/index.php?p= ... ls&id=4058 resource so I can use it in my server.

It's supposed to check two vehicles' models and then if a player is not in the team "Médicos" then it won't be able to enter, the problem is that it doesn't even allow people from "Médicos" to enter. What's wrong?

medicVehicles = { [416]=true }  
medicVehicles2 = { [563]=true }  
medicTeam = { [Médicos]=true } 
  
function medicenterVehicle ( player, seat, jacked ) 
    if ( medicVehicles[getElementModel ( source )] ) and --Here is the wrong thing ( not medicTeam[getPlayerTeam ( player )] ) and ( seat == 0 ) then  
            cancelEvent() 
        outputChatBox ( "Debes de ser un médico para poder entrar al vehículo.", player )  
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), medicenterVehicle ) 

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
medicVehicles = { [416]=true, [563]=true } 
medicTeam = { [Médicos]=true } 
  
function medicenterVehicle ( player, seat, jacked ) 
    if ( medicVehicles[getElementModel ( source )] and ( not medicTeam[getPlayerTeam ( player )] ) and seat == 0 ) then 
         cancelEvent() 
        outputChatBox ( "Debes de ser un médico para poder entrar al vehículo.", player ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), medicenterVehicle ) 

Posted
medicVehicles = { [416]=true, [563]=true } 
medicTeam = { [Médicos]=true } 
  
function medicenterVehicle ( player, seat, jacked ) 
    if ( medicVehicles[getElementModel ( source )] and ( not medicTeam[getPlayerTeam ( player )] ) and seat == 0 ) then 
         cancelEvent() 
        outputChatBox ( "Debes de ser un médico para poder entrar al vehículo.", player ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), medicenterVehicle ) 

It said ']' expected near ' so i removed the é and now it says table index is nil

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
Try replacing line 2 with this:
medicTeam = { ['Médicos']=true } 

Still doesn`t allow the team to enter to the vehicle

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
  
medicVehicles = { [416]=true, [563]=true } 
medicTeam = { ['Médicos']=true } 
  
function medicenterVehicle ( player, seat, jacked ) 
    if ( medicVehicles[getElementModel ( source )] and ( not medicTeam[getPlayerTeam ( player )] ) and seat == 0 ) then 
         cancelEvent() 
        outputChatBox ( "Debes de ser un médico para poder entrar al vehículo.", player ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), medicenterVehicle ) 

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
medicVehicles = { [416]=true, [563]=true } 
medicTeam = { ['Médicos']=true } 
  
function medicenterVehicle ( player, seat, jacked ) 
    if ( medicVehicles[getElementModel ( source )] and ( medicTeam[getPlayerTeam ( player )] ) and seat == 0 ) then 
         cancelEvent() 
        outputChatBox ( "Debes de ser un médico para poder entrar al vehículo.", player ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), medicenterVehicle ) 

Posted

it should work

medicVehicles = {[416]=true, [563]=true } 
medicTeam = { ['Médicos']=true } 
  
function medicenterVehicle ( player, seat, jacked ) 
    local model = getElementModel ( source ) 
    local medic = getTeamName(getPlayerTeam (player)) 
    if ( medicVehicles[model] and ( not medicTeam[medic] ) and seat == 0 ) then 
        cancelEvent() 
        outputChatBox ( "Debes de ser un médico para poder entrar al vehículo.", player,255,0,0) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), medicenterVehicle ) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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