WASSIm. Posted June 6, 2013 Posted June 6, 2013 hi guys i have problem blip zombie he is working only start script and if spawn zombie or wasted nothing local zombieBlips = {} addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function () for k, theZombie in ipairs ( getElementsByType( "ped" ) ) do if (getElementData ( theZombie, "zombie" ) == true) then if not ( zombieBlips[theZombie] ) then zombieBlips[theZombie] = createBlipAttachedTo( theZombie, 0, 1, 162, 2, 2, 100 ) end end end end ) addEvent ( "onZombieSpawn", true ) addEventHandler ( "onZombieSpawn", root, function() if (getElementData ( source, "zombie" ) == true) then if not ( zombieBlips[source] ) then zombieBlips[source] = createBlipAttachedTo( source, 0, 1, 162, 2, 2, 100 ) end end end ) addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", root, function () if ( isElement( zombieBlips[source] ) ) then destroyElement( zombieBlips[source] ) zombieBlips[source] = nil end end )
iPrestege Posted June 6, 2013 Posted June 6, 2013 If you are a player of course you can not see the blip .
WASSIm. Posted June 6, 2013 Author Posted June 6, 2013 i can see it but if start script show blip all zombies but not showing new zombie spawned and dont remove blip old zombie (wasted or destroyed)
50p Posted June 6, 2013 Posted June 6, 2013 These events need to be triggered. Are they triggered when zombies spawn/die? To me it looks like these events may be triggered but server-side only and you're trying to use these events in a client-side script. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
WASSIm. Posted June 6, 2013 Author Posted June 6, 2013 These events need to be triggered. Are they triggered when zombies spawn/die? To me it looks like these events may be triggered but server-side only and you're trying to use these events in a client-side script. i change this script server said but nothing
50p Posted June 6, 2013 Posted June 6, 2013 If you simply changed the script type in meta.xml from client to server then it should work only when zombies spawn/die. Your script is a mixture of client and server side scripts. 1. You're using onClientResourceStart - client-side event 2. onZombieSpawn and onZombieWasted - both look like server-side events (check the zombie resource documentation) - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
WASSIm. Posted June 6, 2013 Author Posted June 6, 2013 nothing changed its like client said ! local zombieBlips = {} addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), function () for k, theZombie in ipairs ( getElementsByType( "ped" ) ) do if (getElementData ( theZombie, "zombie" ) == true) then if not ( zombieBlips[theZombie] ) then zombieBlips[theZombie] = createBlipAttachedTo( theZombie, 0, 1, 162, 2, 2, 100 ) setBlipVisibleDistance( zombieBlips[theZombie], 100 ) end end end end ) addEvent ( "onZombieSpawn", true ) addEventHandler ( "onZombieSpawn", root, function() if (getElementData ( source, "zombie" ) == true) then if not ( zombieBlips[source] ) then zombieBlips[source] = createBlipAttachedTo( source, 0, 1, 162, 2, 2, 100 ) setBlipVisibleDistance( zombieBlips[source], 100 ) end end end ) addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", root, function () if ( isElement( zombieBlips[source] ) ) then destroyElement( zombieBlips[source] ) zombieBlips[source] = nil end end )
Cadu12 Posted June 6, 2013 Posted June 6, 2013 Well, can you read what 50p said? Also, I found answer for your problem: https://forum.multitheftauto.com/viewtop ... 87#p515469 Your script should be server-side. Ingame nick: Cadu12
WASSIm. Posted June 6, 2013 Author Posted June 6, 2013 Well, can you read what 50p said?Also, I found answer for your problem: https://forum.multitheftauto.com/viewtop ... 87#p515469 Your script should be server-side. its already server said!!! thx for link i fix create blip if zombie spawn but if zombie hiding not hiding blip local zombieBlips = {} addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), function () for k, theZombie in ipairs ( getElementsByType( "ped" ) ) do if (getElementData ( theZombie, "zombie" ) == true) then if not ( zombieBlips[theZombie] ) then zombieBlips[theZombie] = createBlipAttachedTo( theZombie, 0, 1, 162, 2, 2, 100 ) setBlipVisibleDistance( zombieBlips[theZombie], 100 ) end end end end ) addEvent ( "onZombieSpawn", true ) addEventHandler ( "onZombieSpawn", root, function() for k, theZombie in ipairs ( getElementsByType( "ped" ) ) do if (getElementData ( theZombie, "zombie" ) == true) then if not ( zombieBlips[theZombie] ) then zombieBlips[theZombie] = createBlipAttachedTo( theZombie, 0, 1, 162, 2, 2, 100 ) setBlipVisibleDistance( zombieBlips[theZombie], 100 ) end end end end ) addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", root, function () if ( isElement( zombieBlips[source] ) ) then destroyElement( zombieBlips[source] ) zombieBlips[source] = nil end end )
Castillo Posted June 6, 2013 Posted June 6, 2013 Hiding? you mean when a zombie dies? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WASSIm. Posted June 7, 2013 Author Posted June 7, 2013 Hiding? you mean when a zombie dies? if away of zombies its hidden zombies
Moderators IIYAMA Posted June 7, 2013 Moderators Posted June 7, 2013 Destroys the zombie, not hide it. It will be hidden when you set it to another dimension/interior/location or something like that. addEventHandler("onElementDestroy", root, function () if getElementType(source)=="ped" and isElement(zombieBlips[source]) then destroyElement(zombieBlips[source]) end end) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
WASSIm. Posted June 7, 2013 Author Posted June 7, 2013 Destroys the zombie, not hide it.It will be hidden when you set it to another dimension/interior/location or something like that. addEventHandler("onElementDestroy", root, function () if getElementType(source)=="ped" and isElement(zombieBlips[source]) then destroyElement(zombieBlips[source]) end end) thank you very much
Moderators IIYAMA Posted June 7, 2013 Moderators Posted June 7, 2013 np. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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