Kenix Posted January 14, 2011 Author Share Posted January 14, 2011 and is obtained here it should also be on the client side: getGameSpeed setPedHeadless setPedOnFire I simply exist that did not work. Link to comment
Kenix Posted January 23, 2011 Author Share Posted January 23, 2011 so I did as told SDK but it still does not work. server side bronezombies = { 167, 277, 264 } -- бронерованные зомби noheadzombies = { 70, 108, 128, 188, 259 } -- без головные зомби speedzombies = { 92, 162, 206, 209, 212, 229, 230 } -- скоростные зомби firezombies = { 105, 107, 127, 280, 287 } -- огненные зомби function table.have ( t, value ) if type(t) ~= "table" then return false end for k, v in pairs ( t ) do if ( v == value ) then return true end end return false end function zombieclasses ( zombie ) if not zombie then return end -- если не указано значение - выход local skinID = getElementModel(zombie) if not skinID then return end -- если не удалось узнать скин - выход if table.have( bronezombies, skinID ) then triggerClientEvent (source,"onbronezombies", source) elseif table.have( noheadzombies, skinID ) then elseif not setPedHeadless( zombie, false ) then triggerClientEvent ("onnoheadzombies", getRootElement()) elseif table.have( speedzombies, skinID ) then triggerClientEvent (source,"onspeedzombies", source) setPedStat ( zombie, 24, 500 ) -- но меньше жизек setElementHealth (zombie, 1000-(500-getElementHealth(zombie))) elseif table.have( firezombies, skinID ) then elseif not setPedOnFire ( zombie, false ) then triggerClientEvent ("onfirezombies", getRootElement()) end end client side addEvent("onbronezombies",true) addEventHandler( "onbronezombies", getLocalPlayer(), function(zombie) setGameSpeed (1); setGravity (0.1); end ) addEvent("onspeedzombies",true) addEventHandler( "onspeedzombies", getLocalPlayer(), function(zombie) setGameSpeed (1.2) end ) addEvent("onnoheadzombies",true) addEventHandler( "onnoheadzombies", getRootElement(), function(zombie) setPedHeadless( getRootElement(), true ) end ) addEvent("onfirezombies",true) addEventHandler( "onfirezombies", getRootElement(), function(zombie) setPedOnFire( getRootElement(), true ) end ) Link to comment
SDK Posted January 23, 2011 Share Posted January 23, 2011 elseif table.have( noheadzombies, skinID ) then elseif not setPedHeadless( zombie, false ) then triggerClientEvent ("onnoheadzombies", getRootElement()) elseif table.have( speedzombies, skinID ) then elseif table.have( firezombies, skinID ) then elseif not setPedOnFire ( zombie, false ) then triggerClientEvent ("onfirezombies", getRootElement()) These parts don't make sense, fix your elseif's. Also, the only thing you should use clientside is setGamesSpeed (and I don't even know it would work the way you would want it), and setPedGravity instead of setGravity. Link to comment
Kenix Posted January 23, 2011 Author Share Posted January 23, 2011 fix it,but still not working client side addEvent("onbronezombies",true) addEventHandler( "onbronezombies", getLocalPlayer(), function(zombie) setGameSpeed (1) end ) addEvent("onspeedzombies",true) addEventHandler( "onspeedzombies", getLocalPlayer(), function(zombie) setGameSpeed (1.2) end ) server side function zombieclasses ( zombie ) if not zombie then return end local skinID = getElementModel(zombie) if not skinID then return end if table.have( bronezombies, skinID ) then triggerClientEvent (source,"onbronezombies", source) setPedGravity (zombie,0.008) elseif table.have( noheadzombies, skinID ) then setPedHeadless( zombie, true ) elseif table.have( speedzombies, skinID ) then triggerClientEvent (source,"onspeedzombies", source) setPedStat ( zombie, 24, 500 ) -- но меньше жизек setElementHealth (zombie, 1000-(500-getElementHealth(zombie))) elseif table.have( firezombies, skinID ) then setPedOnFire ( zombie, true ) end end Link to comment
SDK Posted January 23, 2011 Share Posted January 23, 2011 what's the problem, more details please Link to comment
Kenix Posted January 23, 2011 Author Share Posted January 23, 2011 what's the problem, more details please nothing works more than one class is not noheadzombies not speedzombies etc. debugscript 1-3 did not write errors and outputChatBox("1") -- does not work does not operate below 6 line Link to comment
Kenix Posted January 24, 2011 Author Share Posted January 24, 2011 My script does not like do not fix it? Link to comment
Kenix Posted February 17, 2011 Author Share Posted February 17, 2011 script has become a sly but turns out the error in 10 line @Bad Argument getElementModel broneskins = { [167]=true, [277]=true, [264]=true } -- бронерованные зомби noheadskins= { [70]=true, [108]=true, [128]=true, [188]=true, [259]=true } -- без головные зомби speedskins = { [92]=true, [162]=true, [206]=true, [209]=true, [212]=true, [229]=true, [230]=true } -- скоростные зомби fireskins = { [105]=true, [107]=true, [127]=true, [280]=true, [287]=true } -- огненные зомби function createZombieClass(thePlayer) --setTimer(createZombieClass,1000,1) local idSkin = getElementModel (thePlayer) if idSkin == broneskins then triggerClientEvent (thePlayer,"onbronezombies", thePlayer) outputChatBox ( "1") elseif idSkin == noheadskins then setPedHeadless( thePlayer, true ) outputChatBox ( "2") elseif idSkin == speedskins then triggerClientEvent (thePlayer,"onspeedzombies", thePlayer) setPedStat ( thePlayer, 24, 200 ) -- но меньше жизек setElementHealth (thePlayer, 1000-(800-getElementHealth(thePlayer))) outputChatBox ( "3") elseif idSkin == fireskins then setPedOnFire ( thePlayer, true ) outputChatBox ( "4") end end Link to comment
12p Posted February 26, 2011 Share Posted February 26, 2011 Using some debugging may help to know what's the error there. broneskins = { [167]=true, [277]=true, [264]=true } -- бронерованные зомби noheadskins= { [70]=true, [108]=true, [128]=true, [188]=true, [259]=true } -- без головные зомби speedskins = { [92]=true, [162]=true, [206]=true, [209]=true, [212]=true, [229]=true, [230]=true } -- скоростные зомби fireskins = { [105]=true, [107]=true, [127]=true, [280]=true, [287]=true } -- огненные зомби function createZombieClass(thePlayer) --setTimer(createZombieClass,1000,1) if isElement ( thePlayer ) then outputChatBox ( "thePlayer element type: "..getElementType (thePlayer) ) --If this says player then just delete this line local idSkin = getElementModel (thePlayer) if idSkin == broneskins then triggerClientEvent (thePlayer,"onbronezombies", thePlayer) outputChatBox ( "1") elseif idSkin == noheadskins then setPedHeadless( thePlayer, true ) outputChatBox ( "2") elseif idSkin == speedskins then triggerClientEvent (thePlayer,"onspeedzombies", thePlayer) setPedStat ( thePlayer, 24, 200 ) -- но меньше жизек setElementHealth (thePlayer, 1000-(800-getElementHealth(thePlayer))) outputChatBox ( "3") elseif idSkin == fireskins then setPedOnFire ( thePlayer, true ) outputChatBox ( "4") end end end Link to comment
Kenix Posted February 26, 2011 Author Share Posted February 26, 2011 Using some debugging may help to know what's the error there. broneskins = { [167]=true, [277]=true, [264]=true } -- бронерованные зомби noheadskins= { [70]=true, [108]=true, [128]=true, [188]=true, [259]=true } -- без головные зомби speedskins = { [92]=true, [162]=true, [206]=true, [209]=true, [212]=true, [229]=true, [230]=true } -- скоростные зомби fireskins = { [105]=true, [107]=true, [127]=true, [280]=true, [287]=true } -- огненные зомби function createZombieClass(thePlayer) --setTimer(createZombieClass,1000,1) if isElement ( thePlayer ) then outputChatBox ( "thePlayer element type: "..getElementType (thePlayer) ) --If this says player then just delete this line local idSkin = getElementModel (thePlayer) if idSkin == broneskins then triggerClientEvent (thePlayer,"onbronezombies", thePlayer) outputChatBox ( "1") elseif idSkin == noheadskins then setPedHeadless( thePlayer, true ) outputChatBox ( "2") elseif idSkin == speedskins then triggerClientEvent (thePlayer,"onspeedzombies", thePlayer) setPedStat ( thePlayer, 24, 200 ) -- но меньше жизек setElementHealth (thePlayer, 1000-(800-getElementHealth(thePlayer))) outputChatBox ( "3") elseif idSkin == fireskins then setPedOnFire ( thePlayer, true ) outputChatBox ( "4") end end end there does not work does not write anything = ( Link to comment
12p Posted February 26, 2011 Share Posted February 26, 2011 thePlayer isn't an element, your code is wrong somewhere else. Link to comment
Kenix Posted February 26, 2011 Author Share Posted February 26, 2011 thePlayer isn't an element, your code is wrong somewhere else. then use the source instead thePlayer now try. source so do not work ... Link to comment
Kenix Posted February 26, 2011 Author Share Posted February 26, 2011 OMG I removed the outside of the function (thePlayer) and the script started to work but not quite yet He wrote "thePlayer element type: resource" on the "player" there is nothing broneskins = { [167]=true, [277]=true, [264]=true } -- бронерованные зомби noheadskins= { [70]=true, [108]=true, [128]=true, [188]=true, [259]=true } -- без головные зомби speedskins = { [92]=true, [162]=true, [206]=true, [209]=true, [212]=true, [229]=true, [230]=true } -- скоростные зомби fireskins = { [105]=true, [107]=true, [127]=true, [280]=true, [287]=true } -- огненные зомби function createZombieClass() --setTimer(createZombieClass,1000,1) if isElement ( source ) then outputChatBox ( "thePlayer element type: "..getElementType (source) ) --If this says player then just delete this line local idSkin = getElementModel (source) if idSkin == broneskins then triggerClientEvent (source,"onbronezombies", source) outputChatBox ( "1") elseif idSkin == noheadskins then setPedHeadless( source, true ) outputChatBox ( "2") elseif idSkin == speedskins then triggerClientEvent (source,"onspeedzombies", source) setPedStat ( source, 24, 200 ) -- но меньше жизек setElementHealth (source, 1000-(800-getElementHealth(source))) outputChatBox ( "3") elseif idSkin == fireskins then setPedOnFire ( source, true ) outputChatBox ( "4") end end end Link to comment
Castillo Posted February 27, 2011 Share Posted February 27, 2011 I'm wondering, how do you use this function? how do you execute it? Link to comment
12p Posted February 27, 2011 Share Posted February 27, 2011 I wonder the same thing. I was *unplicity* asking it Link to comment
Kenix Posted February 28, 2011 Author Share Posted February 28, 2011 function calls from the opening event onResourceStart. function zm_onResourceStart( resourcename, res ) zombiewinsdisplay = textCreateDisplay() local zombietext = textCreateTextItem ( "Выживших не осталось. Зомби победили!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( zombiewinsdisplay, zombietext ) zombiewinsdisplayeng = textCreateDisplay() local zombietexteng = textCreateTextItem ( "No survivors left. Zombies won!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( zombiewinsdisplayeng, zombietexteng ) Survivorwinsdisplay = textCreateDisplay() local Survivortext = textCreateTextItem ( "Выжившие победили! Они пережили нападение!", 0.5, 0.5, "low", 0, 255, 0, 255, 3, "center", "center" ) textDisplayAddText ( Survivorwinsdisplay, Survivortext ) Survivorwinsdisplayeng = textCreateDisplay() local Survivortexteng = textCreateTextItem ( "Surviving won! They survived the attack!", 0.5, 0.5, "low", 0, 255, 0, 255, 3, "center", "center" ) textDisplayAddText ( Survivorwinsdisplayeng, Survivortexteng ) opsdisplay = textCreateDisplay() local opsdisplaytext = textCreateTextItem ( "Вы зомби , ваша цель убить выживших!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( opsdisplay, opsdisplaytext,source ) opsdisplayeng = textCreateDisplay() local opsdisplaytexteng = textCreateTextItem ( "You are a zombie, your goal is to kill the survivors!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( opsdisplayeng, opsdisplaytexteng,source ) for i, v in ipairs( getElementsByType( "player" ) ) do createZombieClass( v ); end; if isTimer(selectTimer) then killTimer(selectTimer) end if isTimer(rebootTimer ) then killTimer(rebootTimer ) end removeEventHandler("onEndgame", getRootElement( ), Endgame ) removeEventHandler( "onTimeElapsed", getRootElement( ),onTimeElapsed ) removeEventHandler("onTimeProverka", getRootElement( ), setTimer) removeEventHandler("onreboot", getRootElement( ), reboot) removeEventHandler("onChengemap", getRootElement( ), chengemap) selectTimer = setTimer(function() zombieturn(getRndPlayer()) end, 20000, 1) showPlayerHudComponent ( source,"radar", false ) if resourceName == 'mapmanager' then mapmanager = createResourceCallInterface('mapmanager') end end addEventHandler( "onResourceStart", getRootElement(), zm_onResourceStart ) Link to comment
Kenix Posted February 28, 2011 Author Share Posted February 28, 2011 script works finally but not quite as it should All I could do but the problem of change triggered after the opening event that is in the next / Round Here's the script: function loadmap(startmap, player) local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setTimer( setPedSkin , 500 , 1 , source, SurvivorsElements[math.random(1, #SurvivorsElements)]) for i, v in ipairs( getElementsByType( "player" ) ) do setTimer (createZombieClass( v ),20000,1); end; spawnPlayer( source, x, y, z, rot); setCameraTarget (source, source ); fadeCamera( source, true ); end end addEventHandler("onGamemodeMapStart",getRootElement(), loadmap) zombie classes: broneskins = { [167]=true, [277]=true, [264]=true } -- бронерованные зомби noheadskins = { [70]=true, [108]=true, [128]=true, [188]=true, [259]=true } -- без головные зомби speedskins = { [92]=true, [162]=true, [206]=true, [209]=true, [212]=true, [229]=true, [230]=true } -- скоростные зомби fireskins = { [105]=true, [107]=true, [127]=true, [280]=true, [287]=true } -- огненные зомби function createZombieClass( player ) local idSkin = getElementModel( player ) if broneskins[ idSkin ] then triggerClientEvent( player,"onbronezombies", player ) outputChatBox ( "1" ) elseif noheadskins[ idSkin ] then setPedHeadless( player, true ) outputChatBox ( "2" ) elseif speedskins[ idSkin ] then triggerClientEvent( player,"onspeedzombies", player ) setPedStat( player, 24, 1000 ) -- но меньше жизек setElementHealth( player, 200 - ( 180 - getElementHealth( player ) ) ) outputChatBox ( "3" ) elseif fireskins[ idSkin ] then setPedOnFire( player, true ) outputChatBox ( "4" ) end end Link to comment
Moderators Citizen Posted February 28, 2011 Moderators Share Posted February 28, 2011 Surely it's not the reason but why you put some ";" ? Here: setTimer (createZombieClass( v ),20000,1); end; spawnPlayer( source, x, y, z, rot); setCameraTarget (source, source ); fadeCamera( source, true ); Link to comment
Kenix Posted February 28, 2011 Author Share Posted February 28, 2011 I deleted but still only in the next round included Link to comment
Moderators Citizen Posted February 28, 2011 Moderators Share Posted February 28, 2011 Ok and I found an error in this setTimer; setTimer (createZombieClass( v ),20000,1) ( It's correct ? ) replace by: setTimer (createZombieClass,20000,1,v) It might be the last error Link to comment
Kenix Posted February 28, 2011 Author Share Posted February 28, 2011 Ok and I found an error in this setTimer; setTimer (createZombieClass( v ),20000,1) ( It's correct ? ) replace by: setTimer (createZombieClass,20000,1,v) It might be the last error the same, nothing has changed,now does not work Link to comment
Moderators Citizen Posted February 28, 2011 Moderators Share Posted February 28, 2011 (edited) And there are no errors in clientscript.log ? No outputChatBox ? Try to put another outputChatBox here: function createZombieClass( player ) outputChatBox( "createZombieClass" ) Edited February 28, 2011 by Guest Link to comment
Kenix Posted February 28, 2011 Author Share Posted February 28, 2011 it works but it is only the function and everything else is not working and then it worked but worked in the next round: | 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