CLEO Help Drive bot that stops behind a other vehicle

CLEO related
Status
Not open for further replies.

theralio

Member
Joined
Feb 5, 2014
Messages
5
Reaction score
0
Hi, is it hard to create a bot that drives arround and when a player is in the way the bot stops?
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
52
Location
LongForgotten <-> 0x32789
supahdupahnubah said:
theralio said:
is it hard

Nope

not hard, just get the x and y infront of the bot, loop through all vehicles ( cpp code: for ( int v = 0; v < 2000; v++ ) { ), check if the vehicle is valid ( I honestly don't know how but s0b has such a function, forgot it tho ), if it is, get the vehicle x and y, check the distance between player position and the vehicle position (or vice-versa) and see if they are under the 7.5 distance, ex: (c++)
Code:
void stopper()
{
    float myPos [3] = GetXYInFront(botgetposition(), 5.0);
    for (int x = 0; x < 2000; x++) {
        if(isValidVehicle(x))
        {
            float vPos [3] = x.getPosition();
            if(checkDistance(myPos, vPos) < 7.5)
            {
                stopBot();
                return;
            } 
        }
    }
}
[code]double checkDistance(float posArray1[3], float posArrow2[3])
{
    distance = sqrt(pow((posArray1[0] - posArray2[0]), 2) + pow((posArray1[1] - posArray2[1]), 2) + pow((posArray1[2] - posArray2[2]), 2));
    return(distance);
}

[/code]

i did this while sleeping sorry if I made any mistake.
anyways,  :D enjoy  :ugbase:
 

theralio

Member
Joined
Feb 5, 2014
Messages
5
Reaction score
0
http://www.file-upload.net/download-10228182/PathDC.rar.html and how i add this to this bot and how can i disable the godmode?
 
Status
Not open for further replies.
Top