Mathias Lui Posted July 2, 2016 Posted July 2, 2016 Hi i just want to check with "/veh name" if a player is in a vehicle. If he is, you will be told. I don't know why my scripts don't work I tried various options. function getVehicle( thePlayer, command, name ) local vehicle = getPedOccupiedVehicle( name ) if ( vehicle ) then outputChatBox( name.." drives this vehicle: "..vehicle, thePlayer, 0, 0, 255 ) else outputChatBox( name.." isn't in a vehicle.", thePlayer, 255, 0, 0 ) end end addCommandHandler( "veh", getVehicle ) I am looking for any kind of help for Resource Scripting in MTA!
Walid Posted July 2, 2016 Posted July 2, 2016 explain your problem better. name = the vehicle name or name = the target name (the player that you are trying to check if he is inside a vehicle or not) 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
Mathias Lui Posted July 2, 2016 Author Posted July 2, 2016 If you read the text you can see Name = guy i want to check if hes in a vehicle Vehicle = vehicle name I am looking for any kind of help for Resource Scripting in MTA!
Walid Posted July 2, 2016 Posted July 2, 2016 If you read the text you can seeName = guy i want to check if hes in a vehicle Vehicle = vehicle name You are totaly wrong check your code. anyways try this (untested i'm using the phone) function getVehicle(player, command, name ) if player and isElement(player) then if name then -- we get the player element from the nick specified local thePlayer = getPlayerFromName(name) -- if there exists a player with that nick if (not isElement(thePlayer)) then outputChatBox("This player does no longer exist!",player, 255, 0, 0) return end -- if he's in a vehicle if isPedInVehicle(thePlayer) then local vehicle = getPedOccupiedVehicle (thePlayer) outputChatBox(getPlayerName(thePlayer).." drives this vehicle: "..getVehicleName (vehicle),player, 0, 0, 255 ) else outputChatBox(getPlayerName(thePlayer).." isn't in a vehicle.",player, 255, 0, 0 ) end else outputChatBox("[usage] /veh ",player, 255, 0, 0 ) end end end addCommandHandler("veh", getVehicle) 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
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