Jump to content

Bot doesn't receives the weapon.


Recommended Posts

Posted

What might be the problem?

client:

  
addCommandHandler("givewep", 
function(command, botid, weapon) 
  
    botid = botid or 1 
    weapon = weapon or "Knife" 
    bot = botGet(botid) or outputChatBox("Invalid Bot.") 
    local weaponid = getWeaponIDFromName(weapon) or outputChatBox("Invalid Weapon.") 
  
    if(bot and weapon) then 
     
        triggerServerEvent("eGiveBotWeapon", localPlayer, bot, weaponid) 
        outputChatBox("Bot " .. tostring(id) .. " given weapon " .. weapon) 
         
    end 
  
end) 
  

server:

  
function giveBotWeapon(bot, weaponID) 
  
    setTimer(giveWeapon, 300, 1, bot, weaponID, 1, true) 
  
end 
addEvent("eGiveBotWeapon", true) 
addEventHandler("eGiveBotWeapon", root, giveBotWeapon) 
  

Regards,

Cassandra - V:MP

Posted

Your bot is created client side? if so, that's the reason.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Yeah it works.

i think u should create and check peds at server-side. that might be the problem.

Destruction Derby

Posted
Your bot is created client side? if so, that's the reason.

Aaaaah thought about that. Is that the same for all other elements?

Regards,

Cassandra - V:MP

Posted

Yes, if a element is created client side, the server doesn't know about it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Yes, if a element is created client side, the server doesn't know about it.
setElementID() 
getElementByID() 

hm?

Destruction Derby

Posted
Yes, if a element is created client side, the server doesn't know about it.

Is that the same the other way around? Like if the element is created server side, the client doesn't know about it.

Regards,

Cassandra - V:MP

Posted

No, that's different, e.g: you can send a ped element and do stuff with him.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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