Darky Posted May 16, 2013 Posted May 16, 2013 how i can create a Zombie sistem whit Slothbot ? i do this but bot dont spawn ._. zombiesTeam = createTeam ("Zombies", 255 , 0 , 0) function zombieSistem( ) x,y,z = getElementPosition( source) zombie1 = exports [ "slothBot" ]:spawnBot ( x+5,y+5,z+0.5 , 0, 46, 0, 0, zombiesTeam , 0, "hunting", true ) addEventHandler ( "onResourceStart", getRootElement(), zombieSistem)
Castillo Posted May 16, 2013 Posted May 16, 2013 onResourceStart has no player element, so source is invalid.
iPrestege Posted May 16, 2013 Posted May 16, 2013 You have to use : getElementsByType And loop the players : And you're script should be : -- # Server Side local zombiesTeam = createTeam ("Zombies", 255 , 0 , 0) function zombieSistem( ) for i,player in ipairs ( getElementsByType ( "player" ) ) do x,y,z = getElementPosition( player ) zombie1 = exports [ "slothBot" ]:spawnBot( x+5,y+5,z+0.5 , 0, 46, 0, 0, zombiesTeam , 0, "hunting", true ) end end addEventHandler ("onResourceStart",resourceRoot, zombieSistem) This script will get all players and export the function
Darky Posted May 16, 2013 Author Posted May 16, 2013 onResourceStart has no player element, so source is invalid. mmm , I didnt know that thx You have to use : getElementsByType And loop the players : And you're script should be : -- # Server Side local zombiesTeam = createTeam ("Zombies", 255 , 0 , 0) function zombieSistem( ) for i,player in ipairs ( getElementsByType ( "player" ) ) do x,y,z = getElementPosition( player ) zombie1 = exports [ "slothBot" ]:spawnBot( x+5,y+5,z+0.5 , 0, 46, 0, 0, zombiesTeam , 0, "hunting", true ) end end addEventHandler ("onResourceStart",resourceRoot, zombieSistem) This script will get all players and export the function i think i can do the respawn bot whit onBotWasted ? addEvent("onBotWasted",true) addEventHandler ("onBotWasted",resourceRoot, lol)
Darky Posted May 16, 2013 Author Posted May 16, 2013 No problem , i do it whit "onBotWasted" and dont have any problems (for now ), I havent do it without your help , thx very much.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now