Jump to content

[HELP] Script Error


Recommended Posts

Posted

can you guys help me with this simple script error?

server:

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

 Bad argument @ 'createPed' 

and Thanks.

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

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

Yeah works :) but why the ped don't follow the player :/! the ped don't follow me

Posted
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) 

Posted

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) 

Posted

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) 

Posted
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. :/

Posted

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.

Posted
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

Posted

A single timer won't hurt, you just going do instead of this:

exports.slothbot:setBotAttackEnabled(Guard, false) 

You will do this:

setTimer(function() exports.slothbot:setBotAttackEnabled(Guard, false) end, 250, 1) 

Posted
A single timer won't hurt, you just going do instead of this:
exports.slothbot:setBotAttackEnabled(Guard, false) 

You will do this:

setTimer(function() exports.slothbot:setBotAttackEnabled(Guard, false) end, 250, 1) 

and could i disable the timer? or you have way to do this :)...

Posted
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) 

Posted

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) 

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

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