WASSIm. Posted June 6, 2013 Share 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 ) Link to comment
iPrestege Posted June 6, 2013 Share Posted June 6, 2013 You are creating the blip for the zombie? Link to comment
WASSIm. Posted June 6, 2013 Author Share Posted June 6, 2013 You are creating the blip for the zombie? yes Link to comment
iPrestege Posted June 6, 2013 Share Posted June 6, 2013 If you are a player of course you can not see the blip . Link to comment
WASSIm. Posted June 6, 2013 Author Share 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) Link to comment
50p Posted June 6, 2013 Share 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. Link to comment
WASSIm. Posted June 6, 2013 Author Share 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 Link to comment
50p Posted June 6, 2013 Share 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) Link to comment
WASSIm. Posted June 6, 2013 Author Share 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 ) Link to comment
Cadu12 Posted June 6, 2013 Share 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. Link to comment
WASSIm. Posted June 6, 2013 Author Share 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 ) Link to comment
Castillo Posted June 6, 2013 Share Posted June 6, 2013 Hiding? you mean when a zombie dies? Link to comment
WASSIm. Posted June 7, 2013 Author Share Posted June 7, 2013 Hiding? you mean when a zombie dies? if away of zombies its hidden zombies Link to comment
Moderators IIYAMA Posted June 7, 2013 Moderators Share 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) Link to comment
WASSIm. Posted June 7, 2013 Author Share 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 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