Jump to content

Help me spawn ped xml Slothbot


kurubay

Recommended Posts

i plan to make ped scattered in several places with slothbot with xml point, but nothing happen ( i mean no error no message ) and server not appear in server list.

this is script

server side

  
function initTrafficGenerator() 
local Team = createTeam ( "₧ÑΣαε" ) 
local partlist = xmlLoadFile("samp.xml") 
local partnodes = xmlNodeGetChildren(partlist) 
for partnum,partnode in ipairs(partnodes) do 
            local model_x = tonumber(xmlNodeGetAttribute(partnode,"name")) 
            local model_y = tonumber(xmlNodeGetAttribute(partnode,"name2")) 
            local model_z = tonumber(xmlNodeGetAttribute(partnode,"name3")) 
            local bot1 =  exports [ "slothbot" ]:spawnBot (model_x,model_y,model_z,360,184,0,0,Team ,1,"guarding")  
        end 
        xmlUnloadFile(partlist) 
  
setTimer ( function ( b ) 
                local Team = getTeamFromName ( "₧ÑΣαε" ) 
                exports [ "slothbot" ]:setBotTeam ( b, Team )            
                end  
                ,50, 1, bot1 
                )     
            end 
  
  
addEventHandler("onResourceStart",resourceRoot,initTrafficGenerator) 
  

this is example samp.xml

  
<nameid> 
    <id name="-2141.5" name2="-2519.63" name3="29.5" /> 
    <id name="-2114.25" name2="-2503.13" name3="29.5" /> 
    <id name="-2126.38" name2="-2518.75" name3="29.5" /> 
    <id name="-2131.38" name2="-2524.88" name3="29.5" /> 
    <id name="-2117.5" name2="-2532.13" name3="29.5" /> 
    <id name="-2153.13" name2="-2510.5" name3="29.5" /> 
    <id name="-2137.75" name2="-2539.5" name3="29.5" /> 
    <id name="-2171" name2="-2514.75" name3="29.5" /> 
    <id name="-2178.63" name2="-2509" name3="29.5" /> 
    <id name="-2141.5" name2="-2519.63" name3="29.5" /> 
</nameid> 
  

Link to comment

And where is b defined...?

setTimer ( function ( b ) 
                local Team = getTeamFromName ( "₧ÑΣαε" ) 
                exports [ "slothbot" ]:setBotTeam ( b, Team )           
                end 
                ,50, 1, bot1 
                )    
            end 

Link to comment

i have test the script from this https://forum.multitheftauto.com/viewtopic.php?f ... 5&start=15

and its work

and i modif the simple script and work like a charm

  
function gg(player,k,ks) 
local Team = createTeam ( "₧ÑΣαε" )        
 local ss1 = getElementData(player,"bot1") 
 local ss2 = getElementData(player,"bot2") 
 if(ss1 or ss2) and isElement(ss1) or isElement(ss2)  then return end 
 local x,y,z = getElementPosition(player) 
  
  
local aq = {10, 15, 20, 25, 30, 35, 40} 
local aa = aq [math.random(1,#aq)] 
local ab = aq [math.random(1,#aq)] 
local ae = aq [math.random(1,#aq)] 
local af = aq [math.random(1,#aq)] 
local aj = aq [math.random(1,#aq)] 
  
  
local bot1 =  exports [ "slothbot" ]:spawnBot (x+aj,y+aa,z,360,184,0,0,Team ,1,"hunting", "following")  
local bot2 = exports [ "slothbot" ]:spawnBot (x+af,y+ab,z,190,188,0,0,Team ,2,"hunting", "following") 
  
triggerClientEvent(getRootElement(), "startForward", bot1, bot1) 
triggerClientEvent(getRootElement(), "startForward", bot2, bot2) 
  
setElementData(player,"bot1",bot1) 
setElementData(player,"bot2",bot2) 
  
 setTimer ( function ( b, b1 ) 
                local Team = getTeamFromName ( "₧ÑΣαε" ) 
                exports [ "slothbot" ]:setBotTeam ( b, Team ) 
                exports [ "slothbot" ]:setBotTeam ( b1, Team )           
                end  
                ,500, 1, bot1, bot2 
                ) 
     
            end 
addCommandHandler ( "gg", gg )   
  

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