m4rsje Posted July 3, 2010 Share Posted July 3, 2010 (edited) - Edited July 3, 2010 by Guest Link to comment
x86 Posted July 3, 2010 Share Posted July 3, 2010 local root = getRootElement() addEventHandler("onVehicleEnter", root, function(player) -- local vehicle = source local team = getPlayerTeam(player) if team then local teamName = getTeamName(team) if teamName == "Medic" then outputChatBox("* Don't abuse your lights! *", player) else removePedFromVehicle(player) outputChatBox("* You are not allowed to get in here! *", player) end end end ) Link to comment
m4rsje Posted July 3, 2010 Author Share Posted July 3, 2010 its still not solved. you can still drive away without having the team script: local root = getRootElement() addEventHandler("onVehicleEnter", root, function(player) local vehicle = source local id = getElementModel(vehicle) if id == 416 then local team = getPlayerTeam(player) if team then local teamName = getTeamName(team) if (teamName) == "Medic" then outputChatBox("((* Don't abuse your lights! *))", player) else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end end elseif id == 420 then local team = getPlayerTeam(player) if team then local teamName = getTeamName(team) if (teamName) == "Taxi" then outputChatBox("((pickup people and bring them to their chosen place))", player) else removePedFromVehicle(player) outputChatBox("((*You are not allowed to get in here*))", player) end end end end ) thx <3 Link to comment
m4rsje Posted July 3, 2010 Author Share Posted July 3, 2010 any1?-.-" im like out of idea's right now. Link to comment
dzek (varez) Posted July 3, 2010 Share Posted July 3, 2010 debug? on every step put some outputChatBox that will print every variable Link to comment
m4rsje Posted July 3, 2010 Author Share Posted July 3, 2010 it doesn't give me any errors Link to comment
dzek (varez) Posted July 3, 2010 Share Posted July 3, 2010 im not talking about debugscript read again every step (which means generally "every IF") put outputChatBox.. you will know on which "if" it fails Link to comment
FabienWang Posted July 3, 2010 Share Posted July 3, 2010 hummmm check this code local root = getRootElement() addEventHandler("onVehicleEnter", root, function(player) local id = getElementModel(source) --get the team local team = getPlayerTeam(player) local teamName = "" if team then teamName = getTeamName(team) end --check the vehicles if id == 416 then if (teamName) == "Medic" then outputChatBox("((* Don't abuse your lights! *))", player) else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end elseif id == 420 then if (teamName) == "Taxi" then outputChatBox("((pickup people and bring them to their chosen place))", player) else removePedFromVehicle(player) outputChatBox("((*You are not allowed to get in here*))", player) end end end ) Link to comment
m4rsje Posted July 3, 2010 Author Share Posted July 3, 2010 nop it doesn't work. come try it out, RPG test!!..jshgdjfkhf pw is: 12333 Link to comment
dzek (varez) Posted July 3, 2010 Share Posted July 3, 2010 after checking your code: one thing is missing - players without team can drive ambulance.. rest is working ok (Medics can drive it, others teams can not) Link to comment
FabienWang Posted July 3, 2010 Share Posted July 3, 2010 its still not solved.you can still drive away without having the team after checking your code:one thing is missing - players without team can drive ambulance.. rest is working ok (Medics can drive it, others teams can not) That was exactly his problem lol the code i have put should resolve it Link to comment
m4rsje Posted July 3, 2010 Author Share Posted July 3, 2010 local root = getRootElement() addEventHandler("onVehicleEnter", root, function(player) local id = getElementModel(source) --get the team local team = getPlayerTeam(player) local teamName = "" if team then teamName = getTeamName(team) else outputChatBox("You cant drive!!", thePlayer) end --check the vehicles if id == 416 then if (teamName) == "Medic" then outputChatBox("((* Don't abuse your lights! *))", player) else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end elseif id == 420 then if (teamName) == "Taxi" then outputChatBox("((pickup people and bring them to their chosen place))", player) else removePedFromVehicle(player) outputChatBox("((*You are not allowed to get in here*))", player) end end end ) like that? Link to comment
FabienWang Posted July 3, 2010 Share Posted July 3, 2010 nice copy paste but you loosed indentation. yes try my code in ur server and be surprised Link to comment
m4rsje Posted July 3, 2010 Author Share Posted July 3, 2010 nice copy paste but you loosed indentation.yes try my code in ur server and be surprised sorry dude i can still drive with it without having a team Link to comment
FabienWang Posted July 3, 2010 Share Posted July 3, 2010 it's working on my server, you might have an error somewhere else. check if your script is a server-side one. Link to comment
dzek (varez) Posted July 3, 2010 Share Posted July 3, 2010 local root = getRootElement() addEventHandler("onVehicleEnter", root, function(player) local vehicle = source local id = getElementModel(vehicle) if id == 416 then local team = getPlayerTeam(player) if team then local teamName = getTeamName(team) if (teamName) == "Medic" then outputChatBox("((* Don't abuse your lights! *))", player) else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end elseif id == 420 then local team = getPlayerTeam(player) if team then local teamName = getTeamName(team) if (teamName) == "Taxi" then outputChatBox("((pickup people and bring them to their chosen place))", player) else removePedFromVehicle(player) outputChatBox("((*You are not allowed to get in here*))", player) end else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end end end ) Link to comment
m4rsje Posted July 3, 2010 Author Share Posted July 3, 2010 local root = getRootElement() addEventHandler("onVehicleEnter", root, function(player) local vehicle = source local id = getElementModel(vehicle) if id == 416 then local team = getPlayerTeam(player) if team then local teamName = getTeamName(team) if (teamName) == "Medic" then outputChatBox("((* Don't abuse your lights! *))", player) else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end elseif id == 420 then local team = getPlayerTeam(player) if team then local teamName = getTeamName(team) if (teamName) == "Taxi" then outputChatBox("((pickup people and bring them to their chosen place))", player) else removePedFromVehicle(player) outputChatBox("((*You are not allowed to get in here*))", player) end else removePedFromVehicle(player) outputChatBox("((* You are not allowed to get in here! *))", player) end end end ) it worked thank you <3 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