manawydan Posted January 10, 2013 Share Posted January 10, 2013 how can I put a bot in the car, whether it is on the same leader? tried warpPedIntoVehicle Link to comment
manawydan Posted January 10, 2013 Author Share Posted January 10, 2013 function pet(thePlayer) local skinpet = { "43", "44", "45", "46" } local x,y,z = getElementPosition(thePlayer) local rot= 90 local skin=skinpet[ math.random( 1,#skinpet ) ] local interior=inter local dimension=dimen local team=getPlayerTeam ( thePlayer ) local weapon=0 local mode= "following" local modesubject=thePlayer animal = call (getResourceFromName("slothbot"), "spawnBot", x, y, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) end addCommandHandler( "pet", pet) function petvehicle(seat, jacked, thevehicle) if getElementData(source, "leader", true) then warpPedIntoVehicle ( animal, thevehicle, 1) end end addEventHandler ( "onVehicleEnter", getRootElement(), petvehicle ) Link to comment
GerardWay Posted January 10, 2013 Share Posted January 10, 2013 (edited) [color=#FFBF00]function warpPedIntoVehicle ( )[/color][color=#FF0000] -- Sets the function.[/color] [color=#0000FF]local Ped[/color] [color=#FF0000]= createPed[/color] [color=#0000FF]( 252, 0, 0, 5 )[/color] [color=#FF0000]-- Creates A Ped at the Coordinates "0, 0, 5".[/color] [color=#0000FF]local Vehicle[/color] = [color=#FF0000]createVehicle[/color] [color=#80FF00]( 411, 10, 10, 5 )[/color] [color=#FF00CC]-- Creates A Vehicle at the Coordinates "10, 10, 5". [/color] [color=#0000FF]warpPedIntoVehicle[/color] ( [color=#FF00CC]Ped[/color][color=#00FF00], Vehicle[/color] ) [color=#FF0000] -- Warps the Ped created with "createPed" into The Vehicle that was created with "createVehicle".[/color] [color=#4080FF]end[/color] [color=#FF0000]addCommandHandler[/color] ([color=#00FFFF] "pedwarp"[/color], [color=#0040FF]warpPedIntoVehicle[/color] ) [color=#FF0000]-- Creates a command that will Warp the Ped into the Vehicle when the Player types "/pedwarp".[/color] Edited January 10, 2013 by Guest Link to comment
Castillo Posted January 10, 2013 Share Posted January 10, 2013 function petvehicle ( thePlayer ) if getElementData ( thePlayer, "leader", true ) then warpPedIntoVehicle ( animal, source, 1 ) end end addEventHandler ( "onVehicleEnter", getRootElement(), petvehicle ) Link to comment
3NAD Posted January 10, 2013 Share Posted January 10, 2013 [color=#FFBF00]function warpPedIntoVehicle ( )[/color][color=#FF0000] -- Sets the function.[/color] [color=#0000FF]local Ped[/color] [color=#FF0000]= createPed[/color] [color=#0000FF]( 252, 0, 0, 5 )[/color] [color=#FF0000]-- Creates A Ped at the Coordinates "0, 0, 5".[/color] [color=#0000FF]local Vehicle[/color] = [color=#FF0000]createVehicle[/color] [color=#80FF00]( 411, 10, 10, 5 )[/color] [color=#FF00CC]-- Creates A Vehicle at the Coordinates "10, 10, 5". [/color] [color=#0000FF]warpPedIntoVehicle[/color] ( [color=#FF00CC]Ped[/color][color=#00FF00], Vehicle[/color] ) [color=#FF0000] -- Warps the Ped created with "createPed" into The Vehicle that was created with "createVehicle".[/color] [color=#4080FF]end[/color] [color=#FF0000]addCommandHandler[/color] ([color=#00FFFF] "pedwarp"[/color], [color=#0040FF]warpPedIntoVehicle[/color] ) [color=#FF0000]-- Creates a command that will Warp the Ped into the Vehicle when the Player types "/pedwarp".[/color] lol ?? what are you doing, Just use [ lua ] Text [ /lua ] Without spaces Link to comment
manawydan Posted January 10, 2013 Author Share Posted January 10, 2013 Solidsnake14 work. but C stack overflow in console Link to comment
Castillo Posted January 10, 2013 Share Posted January 10, 2013 function petvehicle ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and getElementData ( thePlayer, "leader", true ) ) then warpPedIntoVehicle ( animal, source, 1 ) end end addEventHandler ( "onVehicleEnter", getRootElement(), petvehicle ) Link to comment
manawydan Posted January 10, 2013 Author Share Posted January 10, 2013 thank you very much Link to comment
manawydan Posted January 10, 2013 Author Share Posted January 10, 2013 he not exit function petvehiclexit ( ) if ( getElementType ( thePlayer ) == "player" and getElementData ( thePlayer, "leader", true ) ) then x, y, z = getElementPosition(thePlayer) setElementPosition( animal, x+1, y+2, z) setElementInterior ( animal, 0 ) setElementRotacion ( animal, 90 ) end end addEventHandler ( "onVehicleExit", getRootElement(), petvehiclexit ) sorry Link to comment
Castillo Posted January 10, 2013 Share Posted January 10, 2013 You must use: removePedFromVehicle . Link to comment
manawydan Posted January 10, 2013 Author Share Posted January 10, 2013 no work function petvehiclexit ( thePlayer) if ( getElementType ( thePlayer ) == "player" and getElementData ( thePlayer, "leader", true ) ) then removePedFromVehicle ( animal ) end end addEventHandler ( "onVehicleExit", getRootElement(), petvehiclexit ) Link to comment
manawydan Posted January 11, 2013 Author Share Posted January 11, 2013 function pet(thePlayer) local skinpet = { "43", "44", "45", "46" } local x,y,z = getElementPosition(thePlayer) local rot= 90 local skin=skinpet[ math.random( 1,#skinpet ) ] local interior=inter local dimension=dimen local team=getPlayerTeam ( thePlayer ) local weapon=0 local mode= "following" local modesubject=thePlayer animal = call (getResourceFromName("slothbot"), "spawnBot", x, y, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) end addCommandHandler( "pet", pet) function petvehicle ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and getElementData ( thePlayer, "leader", true ) ) then warpPedIntoVehicle ( animal, source, 1 ) end end addEventHandler ( "onVehicleEnter", getRootElement(), petvehicle ) function petvehiclexit ( thePlayer) if ( getElementType ( thePlayer ) == "player" and getElementData ( thePlayer, "leader", true ) ) then removePedFromVehicle ( animal ) end end addEventHandler ( "onVehicleExit", getRootElement(), petvehiclexit ) lol the bot no enter in vehicle Link to comment
3NAD Posted January 11, 2013 Share Posted January 11, 2013 can you Put this Resource "slothbot" ? i Will try the Code and the Bots. Link to comment
abu5lf Posted January 11, 2013 Share Posted January 11, 2013 function pet(thePlayer) local skinpet = { "43", "44", "45", "46" } local x,y,z = getElementPosition(thePlayer) local rot= 90 local skin=skinpet[ math.random( 1,#skinpet ) ] local interior=inter local dimension=dimen local team=getPlayerTeam ( thePlayer ) local weapon=0 local mode= "following" local modesubject=thePlayer animal = call (getResourceFromName("slothbot"), "spawnBot", x, y, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) setElementData ( thePlayer, "leader", true ) end addCommandHandler( "pet", pet) function petvehicle ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and getElementData ( thePlayer, "leader", true ) ) then warpPedIntoVehicle ( animal, source, 1 ) end end addEventHandler ( "onVehicleEnter", getRootElement(), petvehicle ) function petvehiclexit ( thePlayer) if ( getElementType ( thePlayer ) == "player" and getElementData ( thePlayer, "leader", true ) ) then removePedFromVehicle ( animal ) end end addEventHandler ( "onVehicleExit", getRootElement(), petvehiclexit ) 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