Estevam2d Posted November 1, 2013 Share Posted November 1, 2013 I have this script enemy of the problem that the ped does not die for nothing. I spent my ammo on him and he does not suffer any damage. Could anyone help me. Sorry bad English local Exercito = getTeamFromName ( "Exercito" ) function Exercitosobymanawydan ( thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then nemesi = exports [ "slothBot" ]:spawnBot ( 103.65139007568,1902.8734130859,33.8984375, 90, math.random ( 300, 303 ), 0, 0, Exercito, 34, "guarding", true ) setElementModel ( nemesi, 287 ) BlipExercito = createBlipAttachedTo ( nemesi, 0, 2, 11, 86, 16, 255, 1) triggerClientEvent ( "nsound", root ) setElementData(nemesi, "exercito",true) if nemesi then exports.extra_health:setElementExtraHealth ( nemesi, 100 ) end end end addCommandHandler("exercito", Exercitosobymanawydan) setTimer ( destroyElement, 3600000, 0, slothbot) addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(), function (killer) if (source == nemesi) then givePlayerMoney(killer,math.random(4000,6000)) outputChatBox ( getPlayerName ( killer ) .. " #081DBFmatou um soldado",getRootElement(), 255, 255, 255, true ) exports.exp_system:addPlayerEXP ( killer, 600 ) destroyElement(BlipExercito) end end) function SetAdmExercitoTeam(thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then setPlayerTeam ( thePlayer, Exercito ) end end addCommandHandler("nemesiTeam",SetAdmExercitoTeam) Link to comment
Moderators IIYAMA Posted November 1, 2013 Moderators Share Posted November 1, 2013 are you in the same team? Link to comment
Estevam2d Posted November 1, 2013 Author Share Posted November 1, 2013 'm not the criminal group. they are criminals in the team and I'm in Admin team Link to comment
Price. Posted November 3, 2013 Share Posted November 3, 2013 you haven't named your function at line 19 , here try this not sure if it would work local Exercito = getTeamFromName ( "Exercito" ) function Exercitosobymanawydan ( thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then nemesi = exports [ "slothBot" ]:spawnBot ( 103.65139007568,1902.8734130859,33.8984375, 90, math.random ( 300, 303 ), 0, 0, Exercito, 34, "guarding", true ) setElementModel ( nemesi, 287 ) BlipExercito = createBlipAttachedTo ( nemesi, 0, 2, 11, 86, 16, 255, 1) triggerClientEvent ( "nsound", root ) setElementData(nemesi, "exercito",true) if nemesi then exports.extra_health:setElementExtraHealth ( nemesi, 100 ) end end end addCommandHandler("exercito", Exercitosobymanawydan) setTimer ( destroyElement, 3600000, 0, slothbot) function onplayerkill( ammo, killer, killerweapon, bodypart ) if (source == nemesi) then if ( killer ) and ( killer ~= source ) then givePlayerMoney(killer,math.random(4000,6000)) outputChatBox ( getPlayerName ( killer ) .. " #081DBFmatou um soldado",getRootElement(), 255, 255, 255, true ) exports.exp_system:addPlayerEXP ( killer, 600 ) destroyElement(BlipExercito) addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) end end function SetAdmExercitoTeam(thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then setPlayerTeam ( thePlayer, Exercito ) end end addCommandHandler("nemesiTeam",SetAdmExercitoTeam) EDIT: also mention your errors. Link to comment
Moderators IIYAMA Posted November 3, 2013 Moderators Share Posted November 3, 2013 you haven't named your function at line 19 , here try this not sure if it would work local Exercito = getTeamFromName ( "Exercito" ) function Exercitosobymanawydan ( thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then nemesi = exports [ "slothBot" ]:spawnBot ( 103.65139007568,1902.8734130859,33.8984375, 90, math.random ( 300, 303 ), 0, 0, Exercito, 34, "guarding", true ) setElementModel ( nemesi, 287 ) BlipExercito = createBlipAttachedTo ( nemesi, 0, 2, 11, 86, 16, 255, 1) triggerClientEvent ( "nsound", root ) setElementData(nemesi, "exercito",true) if nemesi then exports.extra_health:setElementExtraHealth ( nemesi, 100 ) end end end addCommandHandler("exercito", Exercitosobymanawydan) setTimer ( destroyElement, 3600000, 0, slothbot) function onplayerkill( ammo, killer, killerweapon, bodypart ) if (source == nemesi) then if ( killer ) and ( killer ~= source ) then givePlayerMoney(killer,math.random(4000,6000)) outputChatBox ( getPlayerName ( killer ) .. " #081DBFmatou um soldado",getRootElement(), 255, 255, 255, true ) exports.exp_system:addPlayerEXP ( killer, 600 ) destroyElement(BlipExercito) addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) end end function SetAdmExercitoTeam(thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then setPlayerTeam ( thePlayer, Exercito ) end end addCommandHandler("nemesiTeam",SetAdmExercitoTeam) EDIT: also mention your errors. you haven't named your function at line 19 wtf! O_o A function is a value that needs to be stored at some place. He already put it inside his event handler. A both all, that wasn't his problem at the first place. His problem is this: (in slot bot) addEventHandler("onClientPedDamage",root, -- check if same team, then cancel....... cancelEvent() end) But it seems slot bot doesn't get the right information, to do it's job. Link to comment
Estevam2d Posted November 4, 2013 Author Share Posted November 4, 2013 you're saying that the problem is in slot bot? Link to comment
Moderators IIYAMA Posted November 4, 2013 Moderators Share Posted November 4, 2013 No the problem starts here, starts at you. A player can't kill a bot from the same team. Try this: local Exercito = getTeamFromName ( "Exercito" ) if not Exercito then Exercito = createTeam ( "Exercito",0, 255, 0) for i=1,5 do outputChatBox("failure to get Exercito team, so recreate the team.") end end -- put the variables in to locals -- local nemesi,BlipExercito ------------------------------------ function Exercitosobymanawydan ( thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if AclNome and isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then if nemesi and isElement(nemesi) then destroyElement(nemesi) end if BlipExercito and isElement(BlipExercito) then destroyElement(BlipExercito) end nemesi = exports [ "slothBot" ]:spawnBot ( 103.65139007568,1902.8734130859,33.8984375, 90, 287, 0, 0, Exercito, 34, "guarding", true ) --setElementModel ( nemesi, 287 ) --math.random ( 300, 303 ) BlipExercito = createBlipAttachedTo ( nemesi, 0, 2, 11, 86, 16, 255, 1) triggerClientEvent ( "nsound", root ) setElementData(nemesi, "exercito",true) if nemesi then exports.extra_health:setElementExtraHealth ( nemesi, 100 ) end end end addCommandHandler("exercito", Exercitosobymanawydan) setTimer ( destroyElement, 3600000, 0, slothbot) -- wtf? addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(), function (killer) if (source == nemesi) and killer and getElementType(killer) == "player" then givePlayerMoney(killer,math.random(4000,6000)) outputChatBox ( getPlayerName ( killer ) .. " #081DBFmatou um soldado",getRootElement(), 255, 255, 255, true ) exports.exp_system:addPlayerEXP ( killer, 600 ) if BlipExercito and isElement(BlipExercito) then destroyElement(BlipExercito) end end end) function SetAdmExercitoTeam(thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if AclNome and isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then setPlayerTeam ( thePlayer, Exercito ) end end addCommandHandler("nemesiTeam",SetAdmExercitoTeam) local testTeam = createTeam ( "testTeam",255, 0, 0) local function SetAdmTestTeam(thePlayer) local AclNome = getAccountName ( getPlayerAccount ( thePlayer ) ) if AclNome and isObjectInACLGroup ("user."..AclNome, aclGetGroup ( "Admin" ) ) then setPlayerTeam ( thePlayer,testTeam) end end addCommandHandler("testteam",SetAdmTestTeam) Write down /testteam before you start shooting at the ped. Not tested! Link to comment
Estevam2d Posted November 4, 2013 Author Share Posted November 4, 2013 I'm not on any team. And even if I'm the bot will not die by any weapon what do I do? Link to comment
Moderators IIYAMA Posted November 4, 2013 Moderators Share Posted November 4, 2013 It will die, unless you made one of the stupid mistakes in your live. 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