Jump to content

knightscript

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by knightscript

  1. vx89: local spawns = { { 816.59997558594, -7209.2998046875, 32.799999237061 }, { 707.20001220703, -7272.6000976563, 32.700000762939 }, { 710.5, -7412.8999023438, 32.799999237061 }, { 798.70001220703, -7654, 32.5 }, { 816.09997558594, -7471.3999023438, 30 }, { 812.40002441406, -7321.6000976563, 32.799999237061 }, } function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) number2 = {216, 220, 222, 226, 230} numberskin2 = number2 [ math.random ( #number2 ) ] skins = {} local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, true) local randomSpawn = spawns[math.random( #spawns)] local sX, sY, sZ = unpack(randomSpawn) setTimer (spawnPlayer, 1000, 1, source, sX, sY, sZ, 0, numberskin2, 0, 0, getPlayerTeam(source)) --setTimer (setCameraTarget, 1250, 1, source, source) --setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, 24, 100, true) setTimer (giveWeapon, 2000, 1, source, 25, 100, true) setTimer (giveWeapon, 2000, 1, source, 30, 100, true) end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) I commented out SetCameraTarget and fadeCamera because it didnt solve my problem, what do you think?
  2. Im getting this error on my debugscript: The code I have: local _spawnPlayer = spawnplayer function spawnPlayer(thePlayer) local spawns = { { 816.59997558594, -7209.2998046875, 32.799999237061 }, { 707.20001220703, -7272.6000976563, 32.700000762939 }, { 710.5, -7412.8999023438, 32.799999237061 }, { 798.70001220703, -7654, 32.5 }, { 816.09997558594, -7471.3999023438, 30 }, { 812.40002441406, -7321.6000976563, 32.799999237061 }, } local lucky = math.random ( #spawns ) _spawnPlayer(thePlayer,spawns[lucky][1],spawns[lucky][2],spawns[lucky][3]) return true end addEventHandler ("onPlayerWasted", getRootElement(), spawnPlayer) Thanks,
  3. Alright ViRuZGamiing, but, is there any other gang/group resource that has an integrated GPS system?. Thank you.
  4. Excuse me, vx89, i tried many ways and i had no success with using your code, can you tell me wherethat would go? Thank you
  5. Hello, i did this and it sent me into the water, could you please send me the whole snippet please? thank you.
  6. Hello, i was using a script that would let me add 3 spawn points but not more, and i would like to add more, i have the following table: local spawns = { { 816.59997558594, -7209.2998046875, 32.799999237061 }, { 707.20001220703, -7272.6000976563, 32.700000762939 }, { 710.5, -7412.8999023438, 32.799999237061 }, { 798.70001220703, -7654, 32.5 }, { 816.09997558594, -7471.3999023438, 30 }, { 812.40002441406, -7321.6000976563, 32.799999237061 }, } local random = math.random ( #spawns ) but after this, i have no idea what to do, my current code is this: function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then number2 = {216, 220, 222, 226, 230} numberskin2 = number2 [ math.random ( #number2 ) ] skins = {} fadeCamera (source, true) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, numberskin2, 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) I tried using the same structure as my random skin function, but it doesnt work.
  7. What i mean, is that i want to limit to 2 weapon types, for example: Slot 1: 1 melee Slot 2: 1 handgun I don´t know if i explain myself, i want to have only 2 weapons available.
  8. Hello, i would like to know if SetWeaponProperty can be used for a single user account, and if not, is there any other way to modify the damage of a weapon? thanks!.
  9. Hello, i would like to know if there is a way to limit to 2 weapon slots, for example, 1 sniper and 1 pistol, or, 1 shotgun and 1 assault rifle. if so, what function/s do i need to use?. Thanks!
  10. I´m currently using the mta resource, but what I don´t know how to do is to check which users can survive 1 headshot, lets say I saw a zombie resource that does the following: CLIENT SIDE: helmetzombies = {13,22,23,24} function zombiedamaged ( attacker, weapon, bodypart ) if getElementType ( source ) == "ped" then if (getElementData (source, "zombie") == true) then if ( bodypart == 9 ) then helmeted = "no" local zskin = getElementModel ( source ) for k, skin in pairs( helmetzombies ) do if skin == zskin then helmeted = "yes" end end if helmeted == "no" then triggerServerEvent ("headboom", source, source, attacker, weapon, bodypart ) end end end end end addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged ) SERVER SIDE: addEvent( "headboom", true ) function Zheadhit ( ped,attacker, weapon, bodypart) if (getElementData (ped, "zombie") == true) then killPed ( ped, attacker, weapon, bodypart ) setPedHeadless ( ped, true ) end end addEventHandler( "headboom", getRootElement(), Zheadhit ) Maybe there is a way to adapt this code to check for users?
  11. Hello, what i want to do is to be able to stand 1 headshot. what functions should i use? Thank you
  12. I just found this code: root = getRootElement () color = { 0, 255, 0 } players = {} resourceRoot = getResourceRootElement ( getThisResource () ) function onResourceStart ( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do if ( players[player] ) then createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end function onPlayerSpawn ( spawnpoint ) if ( players[source] ) then createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) end end function onPlayerQuit () destroyBlipsAttachedTo ( source ) end function onPlayerWasted ( totalammo, killer, killerweapon ) destroyBlipsAttachedTo ( source ) end function setBlipsColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then color = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } for id, player in ipairs( getElementsByType ( "player" ) ) do destroyBlipsAttachedTo ( player ) if ( players[player] ) then createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end end function setBlipColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then destroyBlipsAttachedTo ( source ) players[source] = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) end end addCommandHandler ( "setblipscolor", setBlipsColor ) addCommandHandler ( "setblipcolor", setBlipColor ) addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerWasted", root, onPlayerWasted ) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end It creates the blip for all players online, but i dont know how to edit it to show only teammates, maybe there is another group system out there?
  13. Hello, i just tryed to do it and it doesnt show no error, this is what I tried: function gps(player) local group = getElementData(player,"Group") local name = getPlayerName(player) if group == "N/A" then return end for k,v in ipairs ( getElementsByType("player") ) do local g = getElementData(v,"Group") if g == group then local myBlip = createBlipAttachedTo ( name, 52 ) end end end and of course the event handler addEventHandler ("OnResourceStart", root,gps) the problem is, it doesnt show anything on the map. Thanks
  14. Solved with the following code: addEventHandler( "onPlayerQuit", getRootElement( ),function() if (isElement(getElementData(source, "knightcar1"))) then destroyElement(getElementData(source, "knightcar1")) outputDebugString ( "1 car by Knight Destroyed." ) end end)
  15. Hey WhoAmI, when i disconnect, my car stays there, how can i fix this?
  16. Or, if there is a better option (clan system with gps marker), i am open for suggestions. Thanks
  17. Hello, i´m using al3grab group system, (https://forum.multitheftauto.com/viewtopic.php?f=108&t=57237), and i saw on a DayZ server that you can mark on gps and map where your teammate is, i dont know what functions to use, and i would like to do it, i do not want someone to make it for me, i want to learn how to do it. Thanks
  18. Hello, i would like to remove this: I don´t know how this is actually called, if someone could tell me, i would appreciate it.
  19. Wow, it works, thank you so much, one last thing, i have the following code: function OwnerCar(player) local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Owners")) then x,y,z = getElementPosition(player) veh = createVehicle("602",x,y,z) end end and its CommandHandler addCommandHandler("MyCar",OwnerCar) I would like to know how can i despawn my old car? because if i put /MyCar twice it will spawn a new one, and i just want to spawn 1. i know it is with DestroyElement, but i do not know exactly how, thank you.
  20. Hello, i would like to change the handling for only 1 vehicle, i saw on the wiki the function is "setModelHandling", but I don´t have idea on how to change the handling of a single vehicle. Thank you.
  21. And how can I add this to a non-dayz gamemode?
  22. Then how does the DayZ gamemode for MTA does it?
  23. Thanks for your reply, i know how to add weapons, but what I want to do is add different models and sounds for 1 weapon id, lets say 2 M4´s -M4A1 -M4A3
×
×
  • Create New...