Captain Cody Posted August 3, 2014 Share Posted August 3, 2014 Ive been working on a dog script for my server but when I spawn a dog it kills me and everyone else function Spawndoggy (source) local x,y,z = getElementPosition (source) local rot= 90 local skin=79 local interior=0 local dimension=0 local team = getPlayerTeam ( source ) local weapon=0 local mode= "following" local modesubject=source setTimer ( call, 12, 1,getResourceFromName("slothbot"), "setBotAttackEnabled",dog,false ) call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) end addCommandHandler("spawndog", Spawndoggy) Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 --Uses Sloth Bot-- Link to comment
nxFairlywell Posted August 3, 2014 Share Posted August 3, 2014 Where is the definition of the ( dog ) you originally did not specify what dog ! Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 Where do I define it at? I thought I should put resource name there Link to comment
nxFairlywell Posted August 3, 2014 Share Posted August 3, 2014 (edited) This is not unreasonable @ _ @ you must define ( dog ) #Edited Syntax : resource getResourceFromName ( string resourceName ) getResourceFromName ( "youResourceNameHere" ) Edited August 3, 2014 by Guest Link to comment
nxFairlywell Posted August 3, 2014 Share Posted August 3, 2014 Wait wat? my english low sorry Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 can you try to explain to me as best as you can how I would get the dog to follow the person that spawned him and not attack everyone if not by command /dattack Link to comment
Anubhav Posted August 3, 2014 Share Posted August 3, 2014 function Spawndoggy (source) local x,y,z = getElementPosition (source) local rot= 90 local skin=79 local interior=0 local dimension=0 local team = getPlayerTeam ( source ) local weapon=0 local mode= "following" local modesubject=source setTimer ( call, 5000, 1, getResourceFromName("slothbot"), "setBotAttackEnabled",dog,false ) call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) end addCommandHandler("spawndog", Spawndoggy) Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 Wait wat this is same script aint it? Link to comment
Anubhav Posted August 3, 2014 Share Posted August 3, 2014 Not at all. Bad usage on setTimer is fixed. Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 Ah ok I'll try it btw How can I make it so when u use command /dogattack the dog will attack people? then when u do it again it stops attacking Link to comment
Anubhav Posted August 3, 2014 Share Posted August 3, 2014 function Spawndoggy (source) if not getElementData(source, "isDogSpawned") then local x,y,z = getElementPosition (source) local rot= 90 local skin=79 local interior=0 local dimension=0 local team = getPlayerTeam ( source ) local weapon=0 local mode= "following" local modesubject=source setElementData(source, "isDogSpawned", true) dog = call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) setTimer ( call, 5000, 1, getResourceFromName("slothbot"), "setBotAttackEnabled",dog,false ) else dog = call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) setTimer( call, 5000, 1, getResourceFromName("slothbot"), "setBotAttackEnabled", dog, true) end end addCommandHandler("spawndog", Spawndoggy) Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 I said is there a way to add command /Dogattack Not wat ever u did... Link to comment
Anubhav Posted August 3, 2014 Share Posted August 3, 2014 function Spawndoggy (source) local x,y,z = getElementPosition (source) local rot= 90 local skin=79 local interior=0 local dimension=0 local team = getPlayerTeam ( source ) local weapon=0 local mode= "following" local modesubject=source setElementData(source, "isDogSpawned", true) dog = call (getResourceFromName("slothbot"), "spawnBot", x, y+5, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) setTimer ( call, 5000, 1, getResourceFromName("slothbot"), "setBotAttackEnabled",dog,false ) end addCommandHandler("spawndog", Spawndoggy) function dogA(source) if not getElementData(source, "isDogSpawned") then outputChatBox("Spawn one dog first! Use /spawndog", source) else outputChatBox("Your dog will start attacking now!", source) setTimer ( call, 5000, 1, getResourceFromName("slothbot"), "setBotAttackEnabled",dog, true ) end end addCommandHandler("Dogattack", dogA) Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 2 things how can I make it so it only follows me? and warps into cars and out of cars when u get in and out of cars Link to comment
Captain Cody Posted August 3, 2014 Author Share Posted August 3, 2014 I noticed it starts following other people if they come near and how can I make it so on command the dog stays aka waiting instead of following Link to comment
Addlibs Posted August 3, 2014 Share Posted August 3, 2014 2 ways: 1.) Edit slothbot to use a table of player elements as 'friendlies' 2.) Make an empty team and set yourself to it, then spawn a dog - it should be a part of the team too. Link to comment
Addlibs Posted August 3, 2014 Share Posted August 3, 2014 and warps into cars and out of cars when u get in and out of cars onVehicleEnter warpPedIntoVehcle onVehicleExit removePedFromVehicle Link to comment
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