Jump to content

Bot Driving problem


Tockra

Recommended Posts

Hi guys,

i use this code:

function OnPlayerConnect()	
bindKey ( "u", "both", botMove )
bindKey ( "k", "both", rechts )
bindKey ( "h", "both", links )
bindKey ( "j", "both", back )
end
addEventHandler( "onClientResourceStart",  getResourceRootElement(getThisResource()), OnPlayerConnect)
 
function botMove(key,keystate)
bot = getElementByID ( "bot" )
if(keystate == "down") then
setPedControlState ( bot, "forwards", true )
elseif(keystate == "up") then
setPedControlState ( bot, "forwards", false )
end	
end
 
function rechts(key,keystate)	
if(keystate == "down") then
setPedControlState ( bot, "vehicle_right", true )
elseif(keystate == "up") then
setPedControlState ( bot, "vehicle_right", false )
end
end
 
function links(key,keystate)
if(keystate == "down") then
setPedControlState ( bot, "vehicle_left", true )
elseif(keystate == "up") then
setPedControlState ( bot, "vehicle_left", false )
end
end
 
function back(key,keystate)
if(keystate == "down") then
setPedControlState ( bot, "backwards", true )
elseif(keystate == "up") then
setPedControlState ( bot, "backwards", false )
end
end

h and k run but u and j dont run...

Link to comment

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