Jump to content

xboxxxxd

Members
  • Content Count

    10
  • Joined

Posts posted by xboxxxxd

  1. Hi there person,

    I need some help figuring out how to progress and finish up a script (idea to reality), but i can't find a way to do it on my own,

    So can sombady help me out,

    Here's the code.

    CLIENT:

    addEventHandler("onClientVehicleEnter", getRootElement(),
    	function (thePlayer, seat)
    		if thePlayer == getLocalPlayer() then
    			triggerServerEvent ("Freeze", resourceRoot)
    		end
    	end
    )
    
    addEventHandler("onClientVehicleExit", getRootElement(),
    	function (thePlayer, seat)
    		if thePlayer == getLocalPlayer() then
    			triggerServerEvent ("Freeze", resourceRoot)
    		end
    	end
    )

    SERVER:

    function FreezeHandler()
    
    end
    addEvent("Freeze", true)
    addEventHandler("Freeze", resourceRoot, FreezeHandler)

    So my intention is first of all to freeze every vehicle when it respawns/spawns, and for example if 1 does respawn/spawn then only that 1 get's frozen.

    And whenever the Event "onClientVehicleEnter" get's triggered, then the vehicle the player is going to unfreeze's,

    and for "onClientVehicleExit" it's inverted, so it has to freeze the vehicle again until another player interaction would occur.

     

    is anyone willing to help me out on this one, because i can't find it..

     

    Gr.xboxxxxd.

  2. If you want to use a OOP being loaded and/or used within a new resource, while this OOP is not inside the new resource, you could do 2 things out of my knowledge:

    as example we use; the OOP resource you want to use is called 'ExistingOOP', and now you want to use it in your new resource, so...

    1.

    Simply just Copy the 'ExistingOOP' Folder, and rename the copy'd ExistingOOP folder to your liking,

    then from there on, code whatever you where intended to do, like just use the same resource, but modify it.

    or..

    2.

    Create a new folder, call it for example 'NewOOP', now open that folder,

    create the meta.xml file, and 1 other folder, like 'files' or something, to put other files in for later on.. i geus,

    now open your meta.xml in 'NewOOP', and on top, before every other syntax, (like second row of text.), so bellow "<meta>",

    Put first this in to make sure you have any OOP function enabled because by default it's disabled!;

    <oop>true</oop>

    put in this piece of code under the other piece of code i described above;

    <include resource="ExistingOOP" />

    to make sure it has been loaded before anything else loads with your 'NewOOP' resource,

    Now you should be fine using any client, server, shared, both, and other type's of using a script/oop to your liking!..

     

    More Information can be found here:

    Short Info, OOP: https://wiki.multitheftauto.com/wiki/OOP

    Full Info, OOP (Introduction): https://wiki.multitheftauto.com/wiki/OOP_Introduction

    meta.xml Info: https://wiki.multitheftauto.com/wiki/Meta.xml

    (Look arround the meta.xml wiki page, there is some good detailed piece's of code there!).

     

    Gr.xboxxxxd

     

    PS: If anything is wrong on my reply here, feel free to correct me in any way possible, it won't bother me. ;)

  3. I prefer to never zip it, like i do, until you find a way to extremely compress a .zip file for a lower download or such, only then i would start using .zip files.

    But on the date of today.. no results finding any way to extremely compress .zip's without breaking it's files to execute on a server..

     

    Also how i think about compressing mta server resources, for example:

    i got tons of resource's, together it's about 1,4GB, if i would be able to compress it into 200MB or so, i would do that.. for sure!..

     

    EDIT: I also know this 'is' possible, ive played like 4/5 years ago on a big drifting server, they had about 2,8GB of resource's,

    Like most of the resource's where Vehicle's, Plane's, also Drift Tracks (Custom Maps), Weapons, etc etc..

    they managed to compress everything into only 392MB, but got never the info on how they did it..

     

    Gr.xboxxxxd

  4. Hello there Humans :P,

    a week or 2 ago i downloaded a resource from the resource community (https://community.multitheftauto.com/index.php?p=resources),

    And it's a Groundpickups resource, it was outdated, like bugs appeared when i started using it and testing it,

    i thought by myself, let's fix these render bugs and outdated functions, alright, about 1 week later i got it fixed,

    i uploaded it to the resource community, BAM.. no problem!..

    But like an hour or 2 later, ccw (an administrator) suspended it, while it's nearly the same piece of code like as that of GroundPickups,

    and i look'd at the reason why it got suspended, well.. 'CallServerFunction' was that reason why it got suspended!.

    And then i thought by myself, well.. if this is insecure against hackers and such, then why is the original GroundPickups not suspended (i send a message about it to ccw, he suspended it now).

     

    But, now the following thing is, i now want to secure the 'callServerFunction',

    But i don't even know and never used this type of function's before, so now to anyone who wil help me out, thanks for the help,

    Now the script itself, i've try'ed some stuff and to merge the example's of 'callServerFunction' into the groundpickups script, but without success >.<

    (There's 1 Export in the meta.xml, just for the info it's:     <export function = "createGroundWeapon" type = "server" /> )

    So this is the script right before i started trying to add a secure method for this function:

    client.lua (Client-Side Script):

    screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolution
    shrifteg = (0.015 * screenHeight) / 9
    localPlayer = getLocalPlayer()
    currentGround = nil
    elementgg = {}
    gta4markers = true
    
    weaponmarkercolors = {
    	[0] = {255,255,255},
    	[1] = {100,100,255},
    	[2] = {0,230,0},
    	[3] = {0,150,0},
    	[4] = {255,255,0},
    	[5] = {255,204,0},
    	[6] = {150,0,150},
    	[7] = {255,0,255},
    	[8] = {0,0,255},
    	[9] = {204,255,255},
    	[10] = {255,100,100},
    	[11] = {255,255,255},
    	[12] = {255,255,255}
    }
    
    slots = {
    	[1] = 0,
    	[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,[7] = 1,[8] = 1,[9] = 1,
    	[24] = 2,[23] = 2,[22] = 2,
    	[25] = 3,[26] = 3,[27] = 3,
    	[29] = 4,[32] = 4,[28] = 4,
    	[30] = 5,[31] = 5,
    	[33] = 6,[34] = 6,
    	[35] = 7,[36] = 7,[37] = 7,[38] = 7,
    	[16] = 8,[17] = 8,[18] = 8,[39] = 8,
    	[41] = 9,[42] = 9,[43] = 9,
    	[10] = 10,[11] = 10,[12] = 10,[13] = 10,[14] = 10,[15] = 10,
    	[44] = 11,[45] = 11,[46] = 11,
    	[40] = 12
    }
    
    weaponsIDS = {
    	--0
    	[1] = 331,
    	--1
    	[2] = 333,
    	[3] = 334,
    	[4] = 335,
    	[5] = 336,
    	[6] = 337,
    	[7] = 338,
    	[8] = 339,
    	[9] = 341,
    	--2
    	[22] = 346,
    	[23] = 347,
    	[24] = 348,
    	--3
    	[25] = 349,
    	[26] = 350,
    	[27] = 351,
    	--4
    	[28] = 352,
    	[29] = 353,
    	[32] = 372,
    	--5
    	[30] = 355,
    	[31] = 356,
    	--6
    	[33] = 357,
    	[34] = 358,
    	--7
    	[35] = 359,
    	[36] = 360,
    	[37] = 361,
    	[38] = 362,
    	--8
    	[16] = 342,
    	[17] = 343,
    	[18] = 344,
    	[39] = 363,
    	--9
    	[41] = 365,
    	[42] = 366,
    	[43] = 367,
    	--10
    	[10] = 321,
    	[11] = 322,
    	[12] = 323,
    	[13] = 324,
    	[14] = 325,
    	[15] = 326,
    	--11
    	[44] = 368,
    	[45] = 369,
    	[46] = 371,
    	--12
    	[40] = 364
    }
    
    function client_createGroundWeapon(groundweapon)
    	if(elementgg[groundweapon] == nil) then
    		local temp = createColSphere(tonumber(getElementData(groundweapon, "posX")),tonumber(getElementData(groundweapon, "posY")),tonumber(getElementData(groundweapon, "posZ"))+0.5, 1)
    		--[[local temp = createColCuboid(tonumber(getElementData(groundweapon, "posX"))-0.5,
    		tonumber(getElementData(groundweapon, "posY"))-0.5,
    		tonumber(getElementData(groundweapon, "posZ"))-1,
    		1,1,2)]]
    		
    		setElementData(temp, "colshape.groundweapon", groundweapon)
    		setElementData(temp, "colshape.weaponid", tonumber(getElementData(groundweapon, "weaponid")))
    		setElementData(temp, "colshape.ammo", tonumber(getElementData(groundweapon, "ammo")))
    		setElementData(temp, "colshape.clip", tonumber(getElementData(groundweapon, "clip")))
    		elementgg[groundweapon] = temp
    		local slot = slots[tonumber(getElementData(groundweapon, "weaponid"))]
    
    		--createObject
    		local object = createObject(weaponsIDS[tonumber(getElementData(groundweapon, "weaponid"))],
    		tonumber(getElementData(groundweapon, "posX")),tonumber(getElementData(groundweapon, "posY")),tonumber(getElementData(groundweapon, "posZ")),
    		tonumber(getElementData(groundweapon, "rotX")),tonumber(getElementData(groundweapon, "rotY")),tonumber(getElementData(groundweapon, "rotZ")))
    		setObjectStatic(object, true)
    		setElementCollisionsEnabled(object, false)
    
    		setElementInterior(object, tonumber(getElementData(groundweapon, "interior")))
    		setElementDimension(object, tonumber(getElementData(groundweapon, "dimension")))
    		
    		setElementData(temp, "colshape.object", object)
    
    		--createMarker
    		local marker = createMarker(tonumber(getElementData(groundweapon, "posX")),
    		tonumber(getElementData(groundweapon, "posY")),
    		tonumber(getElementData(groundweapon, "posZ"))+0.05,
    		"corona", 0.5, weaponmarkercolors[slot][1],weaponmarkercolors[slot][2], weaponmarkercolors[slot][3], 20)
    
    		setElementInterior(marker, tonumber(getElementData(groundweapon, "interior")))
    		setElementDimension(marker, tonumber(getElementData(groundweapon, "dimension")))
    			
    		setElementData(temp, "colshape.marker", marker)
    
    		local x,y,z = getElementPosition(localPlayer)
    		if(getDistanceBetweenPoints2D(x,y,tonumber(getElementData(groundweapon, "posX")),tonumber(getElementData(groundweapon, "posY"))) < 0.25) then local_activate(temp, localPlayer,true) end
    	end
    end
    
    function client_destroyGroundWeapon(groundweapon)
    	local col = elementgg[groundweapon]
    	local object = getElementData(col, "colshape.object")
    	local marker = getElementData(col, "colshape.marker")
    	if(isElement(object)) then destroyElement(object) end
    	if(isElement(marker)) then destroyElement(marker) end
    	if(isElement(col)) then destroyElement(col) end
    	elementgg[groundweapon] = nil
    end
    
    function pickupCurrentWeapon()
    	if(isElement(currentGround)) then
    		local weaponid = getElementData(currentGround, "colshape.weaponid")
    		local ammo = getElementData(currentGround, "colshape.ammo")
    		local clip = getElementData(currentGround, "colshape.clip")
    
    		if(getPedWeapon(localPlayer, slots[weaponid]) ~= 0) then dropWeapon(slots[weaponid]) end
    		
    		if(ammo) then
    			local groundweapon = getElementData(currentGround, "colshape.groundweapon")
    			callServerFunction("destroyElement", groundweapon)
    			callServerFunction("giveWeapon", localPlayer, weaponid, ammo, true)
    			callServerFunction("setWeaponAmmo", localPlayer, weaponid, ammo, clip)
    			for i,p in ipairs(getElementsByType("colshape")) do
    				if(isElementWithinColShape(localPlayer, p) == true) then
    					local_activate(p, localPlayer,true)
    				else
    				if( not isElementWithinColShape(localPlayer, p) ) then
    					break
    					end
    				end
    			end
    		end
    	end
    end
    
    function dropWeapon(slot)
    	if(slot > 0) then
    		local weaponid = getPedWeapon(localPlayer, slot)
    		if(weaponid ~= 0) then
    			callServerFunction("takeWeapon", localPlayer, weaponid)
    			local x,y,z = getElementPosition(localPlayer)
    			local hit, hitX, hitY, hitZ, as = processLineOfSight(x, y, z, x, y, -3000, true, false, false, true, false, false, false, false)
    			if(hit) then z = hitZ
    			else z = z - 0.95 end
    			callServerFunction("createGroundWeapon", weaponid, getPedTotalAmmo(localPlayer), getPedAmmoInClip(localPlayer), x,y,z, 97.3,120,math.random(0,359),getElementInterior(localPlayer),getElementDimension(localPlayer))
    		end
    	end
    end
    
    function local_activate(shape, element,dimension)
    	if(element == localPlayer) then
    		--local groundweapon = getElementData(shape, "colshape.groundweapon")
    		--local object = getElementData(shape, "colshape.object")
    		--local marker = getElementData(shape, "colshape.marker")
    		currentGround = shape
    	end
    end
    
    addEventHandler("onClientResourceStart", getRootElement(),
    	function(startedRes)
    		if(startedRes == getThisResource()) then
    			bindKey("k", "down", "pickup/swap weapon")
    			bindKey("l", "down", "drop weapon")
    		else
    			for i,p in pairs(getElementsByType("groundweapon")) do --getResourceRootElement(startedRes)
    				client_createGroundWeapon(p)
    			end
    		end
    	end
    )
    
    addEventHandler("onClientResourceStop", getResourceRootElement(),
    	function(startedRes)
    		for i,p in pairs(getElementsByType("groundweapon")) do
    			client_destroyGroundWeapon(p)
    		end
    	end
    )
    
    addEventHandler("onClientRender", getRootElement(),
    	function()
    		if(isElement(currentGround)) then
    			local weaponid = getElementData(currentGround, "colshape.weaponid")
    			local ammo = getElementData(currentGround, "colshape.ammo")
    
    			sx,sy = screenWidth/2, screenHeight/2
    
    			local str = "false"
    			
    			dxDrawRectangle(sx-80, sy-20, 160, 75, tocolor(0, 0, 0, 128))
    
    			if(getPedWeapon(localPlayer, slots[weaponid]) ~= 0) then
    				str = "swap weapons"
    				dxDrawImage(sx-13, sy+13, 26, 26, "img/swap.png")
    				
    				dxDrawImage(sx+20, sy-10, 50, 50, "img/" .. weaponid .. ".png")
    				dxDrawImage(sx-70, sy-10, 50, 50, "img/" .. getPedWeapon(localPlayer, slots[weaponid]) .. ".png")
    				
    				dxDrawText(tostring(ammo),
    				sx+45, sy+45, sx+45, sy+45,
    				tocolor(255,255,255,255), 1, "default-bold", "center", "center")
    				
    				dxDrawText(tostring(getPedTotalAmmo(localPlayer, slots[weaponid])) .. " (you)",
    				sx-45, sy+45, sx-45, sy+45,
    				tocolor(255,255,255,255), 1, "default-bold", "center", "center")
    			else
    				str = "pickup weapon"
    				dxDrawImage(sx-25, sy-10, 50, 50, "img/" .. tonumber(weaponid) .. ".png")
    				
    				dxDrawText(tostring(ammo),
    				sx, sy+45, sx, sy+45,
    				tocolor(255,255,255,255), 1, "default-bold", "center", "center")
    			end
    
    			dxDrawText("Use 'k' to " .. str,
    			sx, sy-20, sx, sy-20,
    			tocolor(255,255,50,255), 1, "default-bold", "center", "center")
    		end
    	end
    )
    
    
    addEventHandler("onClientPlayerWasted", localPlayer,
    	function()
    		dropWeapon(getPedWeaponSlot(localPlayer))
    	end
    )
    
    addEventHandler("onClientElementDestroy", getRootElement(),
    	function()
    		if(getElementType(source) == "groundweapon") then
    			client_destroyGroundWeapon(source)
    		end
    	end
    )
    
    addEventHandler("onClientColShapeHit", getResourceRootElement(),
    	function(element,dimension)
    		local_activate(source, element,dimension)
    	end
    )
    
    addEventHandler("onClientColShapeLeave", getResourceRootElement(),
    	function(element,dimension)
    		if(element == localPlayer) then
    			currentGround = nil
    			for i,p in ipairs(getElementsByType("colshape")) do
    				if(isElementWithinColShape(localPlayer, p) == true) then
    					local_activate(p, localPlayer,true)
    					else
    				if( not isElementWithinColShape(localPlayer, p) ) then
    					break
    					end
    				end
    			end
    		end
    	end
    )
    
    addCommandHandler("pickup/swap weapon", function() pickupCurrentWeapon() end)
    
    addCommandHandler("drop weapon", function() dropWeapon(slots[getPedWeapon(localPlayer)]) end)
    
    function callServerFunction(funcname, ...)
        local arg = { ... }
        if (arg[1]) then
            for key, value in next, arg do
                if (type(value) == "number") then arg[key] = tostring(value) end
            end
        end
        -- If the serverside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element
        triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg))
    end
    
    function callClientFunction(funcname, ...)
        local arg = { ... }
        if (arg[1]) then
            for key, value in next, arg do arg[key] = tonumber(value) or value end
        end
        loadstring("return "..funcname)()(unpack(arg))
    end
    addEvent("onServerCallsClientFunction", true)
    addEventHandler("onServerCallsClientFunction", resourceRoot, callClientFunction)

    server.lua (Server-Side Script):

    function createGroundWeapon(weaponid, ammo, clip, posX, posY, posZ, rotX, rotY, rotZ, interior, dimension)
    	local temp = createElement("groundweapon")
    	setElementData(temp, "weaponid", weaponid)
    	setElementData(temp, "ammo", ammo)
    	setElementData(temp, "clip", clip)
    	setElementData(temp, "posX", posX)
    	setElementData(temp, "posY", posY)
    	setElementData(temp, "posZ", posZ)
    	setElementData(temp, "rotX", rotX)
    	setElementData(temp, "rotY", rotY)
    	setElementData(temp, "rotZ", rotZ)
    	setElementData(temp, "interior", interior)
    	setElementData(temp, "dimension", dimension)
    	for i,p in ipairs(getElementsByType("player")) do
    		callClientFunction(p, "client_createGroundWeapon", temp)
    	end
    	return temp
    end
    
    addEventHandler("onResourceStop", getResourceRootElement(),
    	function(startedRes)
    		if(startedRes == getThisResource()) then
    			for i,p in pairs(getElementsByType("groundweapon")) do
    				destroyElement(p)
    			end
    		end
    	end
    )
    
    function callServerFunction(funcname, ...)
        local arg = { ... }
        if (arg[1]) then
            for key, value in next, arg do arg[key] = tonumber(value) or value end
        end
        loadstring("return "..funcname)()(unpack(arg))
    end
    addEvent("onClientCallsServerFunction", true)
    addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction)
    
    function callClientFunction(client, funcname, ...)
        local arg = { ... }
        if (arg[1]) then
            for key, value in next, arg do
                if (type(value) == "number") then arg[key] = tostring(value) end
            end
        end
        triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {}))
    end

    Like always, Thanks for any Answers and/or Solutions you people come up with!..

    Gr.xboxxxxd

     

    EDIT: If you want to, just make it in someway possible to replace all the call function's into events or somthing, ;)

  5. Hmm let's not close it yet..

    I now got another tricky problem:

    ive noticed that its madness to change alot of value's and settings with the zombies resource, with createZombie,

    so now i want to use the 'slothbot' resource, and do basicly the same as with createZombie from zombies resource,

    but..

    as i am intending to add more boss event's, i also want to merge all the boss event's into 1 EventHandler,

    for Slothbot it's "onBotWasted", the same type of EventHandler as onZombieWasted,

    also, the Creation of these boss event's are already done.

    (If you wonder: 'spawnBot' is the creation event of slothbot).

    i'l show what i am stuck with:

    zombie_server.lua (server-side, from zombies resource):

    addEvent("onBotWasted", true)
    addEventHandler("onBotWasted", root, function()
    if  then  -- <- Between if & then, i am lost on how to make it check if the element (burner) Wasted, as in: onPedWasted & burner alive is false.
    	triggerClientEvent(root, "bosseventreward", root, "burner")
    end -- <- And this seems to work as it is, don't ask me why.
    if  then -- <- Same here as burner.
    	triggerClientEvent(root, "bosseventreward", root, "nemesis")
    end
    end
    end)

    for the client-side .lua (ps: anything wrong in this script i can solve myself, but i can't se it's effect if the code above won't work correctly, also posted here to make it easyer for a fix/solution):

    function bosseventrewards(select)
    	if select == "burner" then
    		outputChatBox ('#AFAFAF[#BD0202ZTown#AFAFAF]: #EF0C0CThe #F24B4BBurner #EF0C0CHas been killed! #AFAFAF(#BD0202Burner Miniboss Event#AFAFAF)', root, 255, 255, 255, true)
    givePlayerMoney ( attacker, 17500 ) 
    destroyElement ( myBlip1 )
    triggerClientEvent(root, "event", root, "stop")
    setTimer(function()
    		outputChatBox ('#AFAFAF[#BD0202ZTown#AFAFAF]:#F24B4B ' .. getPlayerName(attacker) .. ' #EF0C0CEarned 17,500$ by killing a #F24B4BBurner#EF0C0C! #AFAFAF(#BD0202Burner Miniboss Event#AFAFAF)', root, 255, 255, 255, true)
    end,2500,1)
    	elseif select == "nemesis" then
    		outputChatBox ('#AFAFAF[#BD0202ZTown#AFAFAF]: #EF0C0CThe #F24B4BNemesis #EF0C0CHas been killed! #AFAFAF(#BD0202Nemesis Boss Event#AFAFAF)', root, 255, 255, 255, true)
    givePlayerMoney ( attacker, 25000 ) 
    destroyElement ( myBlip )
    triggerClientEvent(root, "event", root, "stop")
    setTimer(function()
    		outputChatBox ('#AFAFAF[#BD0202ZTown#AFAFAF]:#F24B4B ' .. getPlayerName(attacker) .. ' #EF0C0CEarned 25,000$ by killing a #F24B4BNemesis#EF0C0C! #AFAFAF(#BD0202Nemesis Boss Event#AFAFAF)', root, 255, 255, 255, true)
    end,2500,1)
    	elseif select == "minions" then
    givePlayerMoney ( attacker, 7500 ) 
    setTimer(function()
    		outputChatBox ('#AFAFAF[#BD0202ZTown#AFAFAF]:#F24B4B ' .. getPlayerName(attacker) .. ' #EF0C0CEarned 7,500$ by killing a #F24B4BMinion#EF0C0C! #AFAFAF(#BD0202Nemesis Boss Event#AFAFAF)', root, 255, 255, 255, true)
    end,2500,1)
    end
    end
    addEvent("bosseventreward", true)
    addEventHandler("bosseventreward", root, bosseventrewards)

    I hope sombady can help me out on this one!..

    Gr.xboxxxxd

  6. Hey pa3ck.

    Thanks for your answer,

    the main problem was i didnt had arguments set up in the function behind the onZombie/NemesisWasted Event,

    Thats why i didnot succeed in making this work..

    But now i had the problem with sync'ing up the agruments of onZombieWasted, ahh well.. Just Cloned it and added a 1 after the functions name.

    And about the Server <> Server and Client <> Client Event Triggers, i already knew that, but i used it the wrong way by using it as a shared library instead of a collab of code,

    So after all of that i managed to merge both .lua's that i posted the code of, and put it inside the main resource (zombies) server side event inside another Event..

    Then it finally worked.. but i noticed i didnt get money, well... i am not really sure why, but givePlayerMoney does not want to work on both serverside or shared,

    anyways, i added another event for that, a reward kind of event, put the remaining code of the nemesis reward back to a new script as shared,

    now it worked.. weird..

    After some load of Editing, your code doesnt even look like what i made, but it works.. Thanks for it!.

     

    I am also testing and scripting these kinds of things on my self hosted server, if you ever wonder what else i do..

    just PM me and i'l hook you up with info.

     

    Gr.xboxxxxd

     

    I am new, Uhmm... how to close a Topic or?..

  7. [Alright, first of all: I just joined the Forums, so if i do anything wrong, just tell me.]

    Ok, so i got a problem, it's about an event i want to trigger on a certain amount of zombie's, or on a certain timer, that's all fine and such..

    But, i want to merge some event's into a resource called "zombies", like the 'onZombieWasted' event, but then for a seperated Event,

    What i mean with that is i want to have a new 'onNemesisWasted' event working together with the 'onZombieWasted',

    but they need to sync up with the (if possible exported) createZombie function from the "zombies" resource.

    And i am aiming to make it to a elementData trigger, that i locally created as for example: local Nemesis = export.zombies:createZombie(etc,etc..),

    So when i check for that element's data on the name 'Nemesis' by existence (as in: if ( isElement ( Nemesis ) ) then) and in combination on the 'onNemesisWasted'-

    event to check if that export of createZombie (ped works aswel) is dead or not, after all of that if the createZombie (ped) is actually dead,

    then i wan't it to trigger the reward system together with the other piece's of code.

     

    To clear out this idea and problem, i also recorded the ZTown Nemesis Event Script and also post the 2 main scripts that hold me from finishing the Nemesis:

    The Video of me, quickly explaining what, how, and showing the problem:

    "youtube"

    And the 2 script's, there both Server-Side,

    The Nemesis.lua is changed to test it's functionality and quick testing, but feel free to change the code and re-post it here to function with 'onNemesisWasted' additions!..

    the first setTimer(function() is there to prevent complication problems from other zombie resource's and scripts, just delaying it for better run's.

    Also, the second setTimer(function() is just to delay it's Blip creation and Attaching to prevent the Blip not being attached to the createZombie named nemesis.

    Nemesis.lua (start/event):

    function nemesisON()
    setTimer(function()
        if ( not isElement ( Nemesis ) ) then
          local nemesis = exports.zombies:createZombie ( 2343, 57, 26.5, 90, 38, 0, 0, nemesis, 0, "hunting", true )
                setPedHeadless(nemesis, true)
                exports.extrahealth:setElementExtraHealth ( nemesis, 150 )
          setElementData ( nemesis, "nemesis", true  )
    setTimer(function()
            myBlip = createBlipAttachedTo ( nemesis, 23 )
            outputChatBox ('#FFFFFF[#7CFC00ZTown#FFFFFF]: #00BFFF A #00FFFFNemesis #00BFFFHas been spawned inside ZTown! #FFFFFF(#7CFC00Nemesis Boss Event#FFFFFF)', root, 255, 255, 255, true)
            triggerClientEvent(root, "event", root, "start")
    end,2500,1)
    end
    end,2500,1)
    end
    addEventHandler ( "onResourceStart", getRootElement(), nemesisON)

    monemesi.lua (check/reward):

    addEvent ( "onNemesisWasted", true )
    addEventHandler ( "onNemesisWasted", root,
        function ( killer )
        if ( isElement ( Nemesis ) ) then
    givePlayerMoney(killer,math.random(5000,25000))
    killer = getPlayerName(killer)
    destroyElement ( myBlip )
            outputChatBox ('#FFFFFF[#7CFC00ZTown#FFFFFF]: #00BFFF The #00FFFFNemesis #00BFFFHas been killed! #FFFFFF(#7CFC00Nemesis-Boss Event#FFFFFF)', root, 255, 255, 255, true)
            triggerClientEvent(root, "event", root, "stop")
    end
    end
    )

    I hope sombady could find a way to make this function correctly, because i have try'ed loads of ways, and the way to use slothbot together with zombies resource... nahh, won't work, they wil keep fighting together like d*cks.

     

    EDIT: if ( isElement ( Nemesis ) ) = nemesis, i already changed that, but right after i posted it, derp..

     

    Gr.xboxxxxd

×
×
  • Create New...