BorderLine Posted November 14, 2011 Share Posted November 14, 2011 Hi forum's people. I need a big help, and is how i can give to zombies some weapons, like bat, or knife or other. The script is the same of slothman, and i dont know how start just i know how setteam to some ped, but i dont know if this is same. If someone know how doit, please my server is Biohazard, if someone want visit it (sorry offtopic, just say information) Link to comment
Castillo Posted November 14, 2011 Share Posted November 14, 2011 -- server side: addEvent("onZombieSpawn",true) addEventHandler("onZombieSpawn",root, function () if (source and getElementType(source) == "ped") then giveWeapon(source, 8, 1, true) end end) I'm not sure if it'll work. Link to comment
BorderLine Posted November 14, 2011 Author Share Posted November 14, 2011 dont work and debugscript 3 dont detect errors thanks, im try to make something if i can doit Link to comment
BorderLine Posted November 14, 2011 Author Share Posted November 14, 2011 i cant some other player know how do this? Link to comment
^Dev-PoinT^ Posted November 14, 2011 Share Posted November 14, 2011 ped = createPed( 19, -1634.5775, 1203.85, 7.1796 ) addCommandHandler( "give", function ( player, command, id, amount ) if not tonumber ( id ) then return end if not tonumber ( amount ) then amount = 9001 end giveWeapon( ped, id, amount, true ) end ) You can give him a weapon with "give " command in console. Link to comment
Charlie_Jefferson Posted November 14, 2011 Share Posted November 14, 2011 Not the player, the ped D: Can you upload the zombie script here, so I can see how the peds are defined? Link to comment
12p Posted November 14, 2011 Share Posted November 14, 2011 @Dev, He wants to give weapons to ZOMBIES, not to create a ped and give it a weapon... Link to comment
Castillo Posted November 14, 2011 Share Posted November 14, 2011 Sounds like the 'source' of onZombieSpawn is a player, I don't get it, why isn't a zombie? Link to comment
12p Posted November 14, 2011 Share Posted November 14, 2011 This will do the job addEvent("Zomb_STFU",true) addEventHandler("Zomb_STFU",root, function ( zomb ) if zomb and getElementType ( zomb ) == "ped" then giveWeapon ( zomb, 8, 1, true ) end end) Link to comment
Castillo Posted November 14, 2011 Share Posted November 14, 2011 Yes, I had the same idea Benxamix. Link to comment
^Dev-PoinT^ Posted November 14, 2011 Share Posted November 14, 2011 oh sry i dont get what he say isnt Ped =Zombie and Player? Link to comment
Charlie_Jefferson Posted November 14, 2011 Share Posted November 14, 2011 I found the resource and went through it and I was about to post when I saw benxamix2's post. Link to comment
12p Posted November 14, 2011 Share Posted November 14, 2011 Just, stop posting all of you and let Yakuza test it. lol. Link to comment
BorderLine Posted November 14, 2011 Author Share Posted November 14, 2011 thank benxamix.. but dont work . and debugscript dnt show errors. some pleyer toldme, he make this with bot sistem Link to comment
12p Posted November 14, 2011 Share Posted November 14, 2011 addEvent("Zomb_STFU",true) addEventHandler("Zomb_STFU",root, function ( zomb ) if zomb and getElementType ( zomb ) == "ped" then giveWeapon ( zomb, 8, 1, true ) outputChatBox ( "zomb with weapon!" ) end outputChatBox ( "zombie spawned!" ) end) Try it and tell me what does it say when a zombie spawns. Link to comment
BorderLine Posted November 14, 2011 Author Share Posted November 14, 2011 dont show message, but im change Zomb_STFU to onZombieSpawn addEvent("onZombieSpawn",true) addEventHandler("onZombieSpawn",root, function ( zomb ) if zomb and getElementType ( zomb ) == "ped" then giveWeapon ( zomb, 8, 1, true ) outputChatBox ( "zomb with weapon!" ) end outputChatBox ( "zombie spawned!" ) end) then show message "zombie spawned!" Link to comment
AGENT_STEELMEAT Posted November 14, 2011 Share Posted November 14, 2011 addEvent("onZombieSpawn",true) addEventHandler("onZombieSpawn",root, function() giveWeapon ( source, 8, 1, true ) outputChatBox ( "zomb with weapon!" ) end) Try that. Link to comment
12p Posted November 14, 2011 Share Posted November 14, 2011 (edited) onZombieSpawn has a player as source, michael. That won't work. Edited November 14, 2011 by Guest Link to comment
Castillo Posted November 14, 2011 Share Posted November 14, 2011 Yes, that's the same thing I'd, you should read the posts above, John. P.S: I think Slothman should put the source as the ped. Link to comment
12p Posted November 14, 2011 Share Posted November 14, 2011 I just understood my mistake and why all doesn't work. CLIENT. addEvent("Zomb_STFU",true) addEventHandler("Zomb_STFU",root, function ( zomb ) triggerServerEvent ( "onZombieSpawned", zomb ) end) SERVER: addEvent("onZombieSpawned",true) addEventHandler("onZombieSpawned",root, function ( ) giveWeapon ( source, 8, 1, true ) end) That should work Link to comment
AGENT_STEELMEAT Posted November 15, 2011 Share Posted November 15, 2011 Why would the source be a player? lol. In this case, do this: addEvent( "onZombieSpawn", true ) --ADD THIS addEvent("onZombieCreate", true) function RanSpawn_Z ( gx, gy, gz, rot) local safezone = 0 local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea ( theradar, gx, gy ) then safezone = 1 end end end if safezone == 0 then if table.getn ( everyZombie ) < newZombieLimit then if not rot then rot = math.random (1,359) end randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) if zomb ~= false then setElementData ( zomb, "zombie", true ) table.insert( everyZombie, zomb ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) --ADD THIS triggerEvent("onZombieCreate", zomb) end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) In zombie_server.lua in the zombies resource. Then, just use the onZombieCreate event. Link to comment
12p Posted November 15, 2011 Share Posted November 15, 2011 Why would the source be a player? function Spawn_Place(xcoord, ycoord) local x,y,z = getElementPosition( getLocalPlayer() ) local posx = x+xcoord local posy = y+ycoord local gz = getGroundPosition ( posx, posy, z+500 ) triggerServerEvent ("onZombieSpawn", getLocalPlayer(), posx, posy, gz+1 ) end Also I already made a solution, why do you create another one? Link to comment
AGENT_STEELMEAT Posted November 15, 2011 Share Posted November 15, 2011 Because it would make sense just to make a small modification to the zombies resource, and take care of it all serverside (like the rest of the resource). Link to comment
BorderLine Posted November 15, 2011 Author Share Posted November 15, 2011 I just understood my mistake and why all doesn't work.CLIENT. addEvent("Zomb_STFU",true) addEventHandler("Zomb_STFU",root, function ( zomb ) triggerServerEvent ( "onZombieSpawned", zomb ) end) SERVER: addEvent("onZombieSpawned",true) addEventHandler("onZombieSpawned",root, function ( ) giveWeapon ( source, 8, 1, true ) end) That should work This work perfect thank a lot Benxamix2, and solid and jhon.. and the last question. i dont disturb. how i can add more weapons. I mean. not all zombies have same weapons, some chainsaw, others knife or katana what is that fuction for do that? 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