Jump to content

Bot Driving problem


Tockra

Recommended Posts

Posted

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

Posted

Because you use wrong control names. Forwards and backwards are for peds who are not in vehicles. For peds inside vehicle use "accelerate" and "brake_reverse".

Posted

Thank...

Know someone how i can caliculate perfect curves ?

The ped shall drive a curve and shall on the right street site after the curve ...

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