• Announcements

    • jhxp

      Forums are online again after a maintenance.   18/03/17

      MTA Forums maintenance is completed, although some automatic time-heavy tasks are still in process and will be finished eventually in background. Expect some features such as Forum Search to not display all results until all processes are finished. Please let us know if you spot a forum feature that worked correctly before the maintenance but does not work anymore now. Thanks. --MTA Team

kewizzle

Members
  • Content count

    54
  • Joined

  • Last visited

Community Reputation

0 Neutral

About kewizzle

  • Rank
    Snitch
  • Birthday 11/12/96

Details

  • Gang
    Nigger
  • Location
    Chicago, USA
  • Occupation
    Scripter
  • Interests
    MTASA, Zombies, Scripting, Programming
  1. doesnt work it works when i die once but then if i die again i lose all my weapons.
  2. sorry i keep posting here im not a noob to scripting mta resources but im also not a god.. with that said i got an error on the second death and it said [18:10:05] ERROR: zombies\save\saver.lua:17: bad argument #1 to 'pairs' (table e xpected, got nil) and i lost all my weapons. local tempData = { } addEventHandler ( "onPlayerWasted", getRootElement(), function ( ) tempData [ source ] = { weapons = getWeaponsTable ( source ), skin = getElementModel ( source ) } end ) addEventHandler ( "onPlayerSpawn", getRootElement(), function ( ) if ( tempData [ source ] ) then setElementModel ( source, tempData [ source ].skin ) for weapon, ammo in pairs ( tempData [ source ].weapons ) do giveWeapon ( source, weapon, ammo, true ) end end end ) function getWeaponsTable ( thePlayer ) local weapons = { } local hasAnyWeapon = false for slot = 0, 12 do local weapon = getPedWeapon ( thePlayer, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( thePlayer, slot ) if ( ammo > 0 ) then weapons [ weapon ] = ammo hasAnyWeapon = true end end end if ( hasAnyWeapon ) then return weapons end end (yes i got this script from someone else.)
  3. doesnt work but are you a scriptor?
  4. okay so it almost works but when i kill more than one enemy it wont let me pick up the other pickups and it only picks up the last pickup made. outputServerLog ( "***Drop System Loaded ***" ) local state = {} local function bindState(player) bindKey(player, "f", "down", function(player) if isElement(getElementData(player,"pickup")) then usePickup(getElementData(player,"pickup"),player) removeElementData(player,"pickup") end end) end function getElementsWithinMarker(marker) if (not isElement(marker) or getElementType(marker) ~= "marker") then return false end local markerColShape = getElementColShape(marker) local elements = getElementsWithinColShape(markerColShape) return elements end addEventHandler("onResourceStart", resourceRoot, function() for _, player in pairs(getElementsByType ("player")) do bindState(player) end end) addEventHandler("onPlayerJoin", root, function() bindState(source) end) function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies if ( killer ) then if ( getElementType ( killer ) == "player" ) then x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z dropped = createPickup ( x, y, z, 2, math.random(22, 34), 15000, math.random(1,3)) dropmarker = createMarker ( x, y, z-0.5, "cylinder", 1, math.random(1, 255), math.random(1, 255), math.random(1, 255), 255) addEventHandler("onPickupHit", dropped, HitPick) addEventHandler("onMarkerHit", dropmarker, function(player) if isElement(player) and getElementType(player) == 'player' then setElementData(player,"pickup",dropped) end end) setTimer(destroyElement, 15000, 1, dropped) setTimer(destroyElement, 15000, 1, dropmarker) end end end addEventHandler("onPedWasted", getRootElement(), createDeathPickup) function HitPick ( ) if isElement ( dropped ) then cancelEvent() end end
  5. i tried to use onClientClick to pickup weapons but it doesn't seem to recognize them as an element? Does it not work with pickups?
  6. it works but one issue,my player picks the pickup up and then if i press F it picks it up a second time.
  7. i got an error server.lua:39: then expected near '='
  8. So basically i have a drop system and well i just got it to work thanks to some people here when you hold a button and then hit a pickup it picks it up. But my issue is when you hit the pickup without holding the button then press the button to pick it up nothing will happen. So i want to make it so if the player is within the marker that the pickup is in and the button is pressed it will pick the weapon up and give it to the player. heres my current code. outputServerLog ( "***Drop System Loaded ***" ) local state = {} local function bindState(player) state[player] = true bindKey(player, "f", "both", function(player) state[player] = not state[player] end) end addEventHandler("onResourceStart", resourceRoot, function() for _, player in pairs(getElementsByType ("player")) do bindState(player) end end) addEventHandler("onPlayerJoin", root, function() bindState(source) end) function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies if ( killer ) then if ( getElementType ( killer ) == "player" ) then x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z dropped = createPickup ( x, y, z, 2, math.random(22, 34), 15000, math.random(1,3)) dropmarker = createMarker ( x, y, z-0.5, "cylinder", 1, math.random(1, 255), math.random(1, 255), math.random(1, 255), 255) addEventHandler("onPickupHit", dropped, function(player) cancelEvent(state[player]) end) setTimer(destroyElement, 15000, 1, dropped) setTimer(destroyElement, 15000, 1, dropmarker) end end end addEventHandler("onPedWasted", getRootElement(), createDeathPickup)
  9. if its not possible maybe thinking of creating a marker thats invisible on a dropped item and then destroying it on pickup and it would be like if(isElementWithinMarker(marker) == true then somefunction binded L to use the pickup.
  10. is there a way to make it so if you press L while standing on it itll pick it up aswell?
  11. alright lets see works thanks so much
  12. it works but the pickup is destroyed still if l isnt pressed and so when it gets destroyed and i press l to pick it up it wont because its destroyed. oh i see you have to hold l down so it doesnt pick it up is there a way to make it so you can hold it down to pick it up? i want it to be set to where you have to hold it to pick it up.
  13. I did some more work and the event isnt cancelling at all. what am i doing wrong? Server outputServerLog ( "***Drop System Loaded ***" ) function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies if ( killer ) then if ( getElementType ( killer ) == "player" ) then x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z dropped = createPickup ( x, y, z, 2, math.random(22, 34), 0, math.random(1,3)) setTimer(destroyElement, 15000, 1, dropped) addEventHandler("onPlayerPickupHit",getRootElement(),checkPickupServer) else end end end addEventHandler ( "onPedWasted", getRootElement(), createDeathPickup ) function checkPickupServer(killer) if (getPickupType(dropped) == 2) then -- If it's an armour pickup triggerClientEvent ("checkPickup",killer,checkPickup) end end Client addEvent("checkPickup",true) addEventHandler("checkPickup",root, function () if getKeyState("l") == false then cancelEvent() else end end)
  14. oh :~ yeah youre right one second okay so now ive done this but player still picks the weapon up without asking first. server function checkPickupServer() triggerClientEvent ("checkPickup",source,checkPickup) end outputServerLog ( "***Drop System Loaded ***" ) function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies if ( killer ) then if ( getElementType ( killer ) == "player" ) then x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z dropped = createPickup ( x, y, z, 2, math.random(22, 34), 0, math.random(1,3)) addEventHandler("onPickupHit", dropped, destroyPickup) setTimer(destroyElement, 15000, 1, dropped) addEventHandler("onPickupHit", dropped, checkPickupServer) else end end end addEventHandler ( "onPedWasted", getRootElement(), createDeathPickup ) client addEvent("checkPickup",true) addEventHandler("checkPickup",root, function () if getKeyState("l") == false then cancelEvent() end end)
  15. i did this but i get this [09:19:17] ERROR: zombies\drops\server.lua:2: attempt to call global 'getKeyStat e' (a nil value)