DRW Posted May 16, 2015 Share Posted May 16, 2015 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 ) Link to comment
WhoAmI Posted May 16, 2015 Share Posted May 16, 2015 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 ) Link to comment
DRW Posted May 16, 2015 Author Share Posted May 16, 2015 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 Link to comment
xXMADEXx Posted May 16, 2015 Share Posted May 16, 2015 Try replacing line 2 with this: medicTeam = { ['Médicos']=true } Link to comment
DRW Posted May 16, 2015 Author Share Posted May 16, 2015 Try replacing line 2 with this: medicTeam = { ['Médicos']=true } Still doesn`t allow the team to enter to the vehicle Link to comment
Mr.unpredictable. Posted May 16, 2015 Share Posted May 16, 2015 Try replacing line 2 with this: medicTeam = { ['Médicos']=true } Still doesn`t allow the team to enter to the vehicle Post your code Link to comment
DRW Posted May 16, 2015 Author Share Posted May 16, 2015 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 ) Link to comment
ALw7sH Posted May 16, 2015 Share Posted May 16, 2015 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 ) Link to comment
Walid Posted May 16, 2015 Share Posted May 16, 2015 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 ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now