Jump to content

[HELP] Script Error


Recommended Posts

That's because you used createPed but you need to use spawnBot.

https://wiki.multitheftauto.com/wiki/Slothman/Slothbot

Alright if i do it...not works...tried already so :/?

     function gta (thePlayer) 
    local x,y,z = getElementPosition (thePlayer) 
    Guard = exports.slothbot:spawnBot (240,x,y,z) 
    exports.slothbot:setBotFollow (Guard, thePlayer) 
    end 
    addCommandHandler ("guard", gta) 

Link to comment

Alright fixed it but why the ped attacks me :/?

and then i have Falsed the attack..but still attacks me

     function gta (thePlayer) 
    local x,y,z = getElementPosition (thePlayer) 
    Guard = exports.slothbot:spawnBot (x,y,z,0, 240) 
    exports.slothbot:setBotFollow (Guard, thePlayer) 
    exports.slothbot:setBotAttackEnabled (Guard, false) 
    end 
    addCommandHandler ("guard", gta) 

Link to comment
Alright i've edit the script to this but the ped still ATTACKS ME after spawns it! :/
     function gta (thePlayer) 
    local x,y,z = getElementPosition (thePlayer) 
    Guard = exports.slothbot:spawnBot (x,y,z,0, 240, 0, 0, nil, 0, "follow", nil) 
    end 
    addCommandHandler ("guard", gta) 

Then Changed this Shit script again to this

     function gta (thePlayer) 
    local x,y,z = getElementPosition (thePlayer) 
    Guard = exports.slothbot:spawnBot (x,y,z,0, 240, 0, 0, nil, 0, "follow", nil) 
    if getAccountName(getPlayerAccount(thePlayer)) == "LiOneLMeSsI" and exports.slothbot:getBotAttackEnabled (Guard) then 
    exports.slothbot:setBotAttackEnabled (Guard, false) 
    end 
end 
addCommandHandler ("guard", gta) 

Still Attacks me!!!!...how i can to stop him from attacking people. :/

Link to comment
Because when you spawn the bot there is a timer (200 ms) in the script "slothbot'" that set its attack to true, so you will have to use a time bigger than 200 ms for the function setBotAttackEnabled.

Alright i understand about that..but i think the timer is not good idea for the script..so there's some way to remove the timer? :) if not then please tell me how to set the timer.

and Thank you man :D

Link to comment
No need, the timer will execute only one times and it will destroyed automatically.

Alright.. i did it and still attacks me.

    function guard (thePlayer) 
        local x,y,z = getElementPosition (thePlayer) 
        local Guard = exports ["slothbot"]:spawnBot (x,y,z, 0, 240, 0, 0, nil, 0, "follow", "following") 
        setTimer(function() exports ["slothbot"]:setBotAttackEnabled(Guard, false) end, 9999999999999999, 1) 
        end 
        addCommandHandler ("guard", guard) 

Link to comment

You have wrong argument at spawnBot.

function guard(thePlayer) 
    local x,y,z = getElementPosition(thePlayer) 
    Guard = exports ["slothbot"]:spawnBot(x,y,z, 0, 240, 0, 0, nil, 0, "following", thePlayer) 
    setTimer(function() exports ["slothbot"]:setBotAttackEnabled(Guard, false) end, 250, 1) 
end 
addCommandHandler ("guard", guard) 

Link to comment
You have wrong argument at spawnBot.
function guard(thePlayer) 
    local x,y,z = getElementPosition(thePlayer) 
    local Guard = exports ["slothbot"]:spawnBot(x,y,z, 0, 240, 0, 0, nil, 0, "following", thePlayer) 
    setTimer(function() exports ["slothbot"]:setBotAttackEnabled(Guard, false) end, 250, 1) 
end 
addCommandHandler ("guard", guard) 

Alright tried it and works as the guard don't try to do anything on me... but there's some problem

..the bot takes long time to follow me...like not follows me when i move...the bot wait for long distance.. and then "jumps" follows me "move around me" "stop behind me" like the bot don't know what he should to do.

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