Jump to content

DRW

Members
  • Posts

    364
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by DRW

  1. DRW

    Dual wield flag

    Actually there is a resource that does that perfectly, but it's buggy and compiled, so the weapons sometimes stop being dual-wielded and things like that: https://community.multitheftauto.com/index.php?p= ... ls&id=5840
  2. DRW

    Dual wield flag

    So I'm making a simple script that sets a weapon dual wielded when a player is "pro". The problem is that anims don't work well, the weapons like AK47, Spaz12 and others keep their arms up and look like they aren't shooting in front of them. I want to make the weapons shoot like a Tec9 or a Uzi (Being able to run with the dual-wielded guns and having the same shooting and movin anims) addEventHandler ("onPlayerWeaponSwitch", getResourceRootElement(getThisResource()), function () setWeaponProperty(23,"pro","flags",0x000800) setWeaponProperty(24,"pro","flags",0x000800) setWeaponProperty(25,"pro","flags",0x000800) setWeaponProperty(26,"pro","flags",0x000800) setWeaponProperty(27,"pro","flags",0x000800) setWeaponProperty(28,"pro","flags",0x000800) setWeaponProperty(29,"pro","flags",0x000800) setWeaponProperty(30,"pro","flags",0x000800) setWeaponProperty(31,"pro","flags",0x000800) setWeaponProperty(33,"pro","flags",0x000800) setWeaponProperty(34,"pro","flags",0x000800) end)
  3. DRW

    No negative money

    God dammit, I'm an idiot, I combined serverside and clientside things, lol. Thank you so much
  4. I tried to remove negative money by doing this: local money = getPlayerMoney (source) addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), function () setTimer (function () if (money < 0) then setPlayerMoney (source, 0) end end end), 10000,0) Not working, says that is a ) expected to close function in line 4 ( I try to make it another way but it's not working, edited a lot of times and still giving me errors... What can I do?
  5. So I want to execute a function when time is 21:00 (in-game). I've been looking at the wiki for getTime, but I don't understand what to do, it just gives an example of how to get the current time, not how to get a specific time and execute a function.
  6. Hello, I'm making a upgrade system, it basically creates a script that creates a marker, when you hit it, a GUI window appears where you can buy a stat, but if you have a stat upgraded to max then it will cancel and say that you can't buy them, for now it works perfectly, but the problem is that when I start the script, if I have less money than needed I can't buy it, but even if I have a more money than needed, it still doesn't let me buy it, only when I restart the resource. Also, when I click other part of the GUI window except the buttons, the GUI reacts like I clicked all of the buttons and gives me stats without even having clicked on it. Server: markerbuy = createMarker (-509,2632,52.5,"cylinder",1.0,0,150,255,255) addEventHandler("onMarkerHit",markerbuy,function(plr) if plr then triggerClientEvent (plr,"actventana",plr) end end) addEvent("addstat1",true) addEventHandler ("addstat1", root, function () local weaponState = getPedStat (source,69) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 69, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end) addEvent("addstat2",true) addEventHandler ("addstat2", root, function () local weaponState = getPedStat (source,73) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 73, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Escopeta Recortada.",source,255,255,255) end) addEvent("addstat3",true) addEventHandler ("addstat3", root, function () local weaponState = getPedStat (source,75) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 75, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Subfusiles.",source,255,255,255) end) addEvent("addstat4",true) addEventHandler ("addstat4", root, function () local weaponState = getPedStat (source,79) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 79, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Francotirador.",source,255,255,255) end) addEvent("addstat5",true) addEventHandler ("addstat5", root, function () local weaponState = getPedStat (source,78) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 78, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de M4.",source,255,255,255) end) addEvent("addstat6",true) addEventHandler ("addstat6", root, function () local weaponState = getPedStat (source,71) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 71, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Desert Eagle.",source,255,255,255) end) addEvent("addstat7",true) addEventHandler ("addstat7", root, function () local weaponState = getPedStat (source,72) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 72, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Escopeta.",source,255,255,255) end) addEvent("addstat8",true) addEventHandler ("addstat8", root, function () local weaponState = getPedStat (source,74) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,0,0) return end setPedStat (source, 74, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Arma Antigravedad.",source,255,255,255) end) addEvent("addstat9",true) addEventHandler ("addstat9", root, function () local weaponState = getPedStat (source,76) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 76, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de MP5.",source,255,255,255) end) addEvent("addstat10",true) addEventHandler ("addstat10", root, function () local weaponState = getPedStat (source,77) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 77, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de AK-47.",source,255,255,255) end) addEvent("addstat11",true) addEventHandler ("addstat11", root, function () local weaponState = getPedStat (source,22) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 22, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Resistencia.",source,255,255,255) end) addEvent("addstat12",true) addEventHandler ("addstat12", root, function () local weaponState = getPedStat (source,24) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 24, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Vida Máxima.",source,255,255,255) end) Client: rRoot = getResourceRootElement(getThisResource()) local money = getPlayerMoney(thePlayer) local screenW, screenH = guiGetScreenSize() ventanamejoras = guiCreateWindow((screenW - 669) / 2, (screenH - 412) / 2, 669, 412, "ZNEXT: Sistema de habilidades", false) guiWindowSetSizable(ventanamejoras, false) mejora1 = guiCreateButton(13, 115, 288, 45, "+2 Puntos de mejora: Colt 45", false, ventanamejoras) guiSetProperty(mejora1, "NormalTextColour", "FF05F7F9") mejora2 = guiCreateButton(13, 160, 288, 45, "+2 Puntos de mejora: Escopeta recortada", false, ventanamejoras) guiSetProperty(mejora2, "NormalTextColour", "FF00EFFE") mejora3 = guiCreateButton(13, 205, 288, 45, "+2 Puntos de mejora: Subfusiles", false, ventanamejoras) guiSetProperty(mejora3, "NormalTextColour", "FF00EFFE") mejora4 = guiCreateButton(13, 250, 288, 45, "+2 Puntos de mejora: Francotirador", false, ventanamejoras) guiSetProperty(mejora4, "NormalTextColour", "FF00EFFE") mejora5 = guiCreateButton(13, 295, 288, 45, "+2 Puntos de mejora: M4", false, ventanamejoras) guiSetProperty(mejora5, "NormalTextColour", "FF00EFFE") mejora6 = guiCreateButton(13, 340, 288, 45, "+2 Puntos de mejora: Desert Eagle", false, ventanamejoras) guiSetProperty(mejora6, "NormalTextColour", "FF00EFFE") mejora7 = guiCreateButton(371, 115, 288, 45, "+2 Puntos de mejora: Escopeta", false, ventanamejoras) guiSetProperty(mejora7, "NormalTextColour", "FF00EFFE") mejora8 = guiCreateButton(371, 160, 288, 45, "+2 Puntos de mejora: Arma Antigravedad", false,ventanamejoras) guiSetProperty(mejora8, "NormalTextColour", "FFFB9A02") mejora9 = guiCreateButton(371, 205, 288, 45, "+2 Puntos de mejora: MP5", false, ventanamejoras) guiSetProperty(mejora9, "NormalTextColour", "FFAAAAAA") mejora10 = guiCreateButton(371, 250, 288, 45, "+2 Puntos de mejora: AK-47", false, ventanamejoras) guiSetProperty(mejora10, "NormalTextColour", "FF00EFFE") mejora11 = guiCreateButton(371, 295, 288, 45, "+2 Puntos de mejora: Resistencia", false, ventanamejoras) guiSetProperty(mejora11, "NormalTextColour", "FF53FC00") mejora12 = guiCreateButton(371, 340, 288, 45, "+2 Puntos de mejora: Vida máxima", false, ventanamejoras) guiSetProperty(mejora12, "NormalTextColour", "FF53FC00") labelmejora = guiCreateLabel(197, 31, 268, 48, "Comprar mejoras", false, ventanamejoras) guiSetFont(labelmejora, "sa-gothic") cerrarmejoras = guiCreateButton(629, 21, 20, 19, "x", false, ventanamejoras) guiSetProperty(cerrarmejoras, "NormalTextColour", "FFFF0000") addEventHandler ("onClientResourceStart", rRoot, function () guiSetVisible(ventanamejoras, false) end) addEvent ("actventana",true) addEventHandler ("actventana",root, function () guiSetVisible (ventanamejoras,true) showCursor(true) guiBringToFront(ventanamejoras) end ) addEventHandler ("onClientGUIClick", cerrarmejoras, function() showCursor (false) guiSetVisible (ventanamejoras, false) end) addEventHandler ("onClientGUIClick", mejora1, function() if (money < 1000) --HERE IS THE MAIN PROBLEM then return else triggerServerEvent ("addstat1", localPlayer) end end) addEventHandler ("onClientGUIClick", mejora2, function() triggerServerEvent ("addstat2", localPlayer) end) addEventHandler ("onClientGUIClick", mejora3, function() triggerServerEvent ("addstat3", localPlayer) end) addEventHandler ("onClientGUIClick", mejora4, function() triggerServerEvent ("addstat4", localPlayer) end) addEventHandler ("onClientGUIClick", mejora5, function() triggerServerEvent ("addstat5", localPlayer) end) addEventHandler ("onClientGUIClick", mejora6, function() triggerServerEvent ("addstat6", localPlayer) end) addEventHandler ("onClientGUIClick", mejora7, function() triggerServerEvent ("addstat7", localPlayer) end) addEventHandler ("onClientGUIClick", mejora8, function() triggerServerEvent ("addstat8", localPlayer) end) addEventHandler ("onClientGUIClick", mejora9, function() triggerServerEvent ("addstat9", localPlayer) end) addEventHandler ("onClientGUIClick", mejora10, function() triggerServerEvent ("addstat10", localPlayer) end) addEventHandler ("onClientGUIClick", mejora11, function() triggerServerEvent ("addstat11", localPlayer) end) addEventHandler ("onClientGUIClick", mejora12, function() triggerServerEvent ("addstat12", localPlayer) end)
  7. Not working. :3 i pretty sure that u didn't try it by yourself addEvent("addstat1",true) addEventHandler ("addstat1", root, function () local weaponState = getPedStat (source,69) if tonumber (weaponState) >= 1000 then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end setPedStat (source, 69, tonumber(weaponState)+20) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end) addEvent("addstat1",true) addEventHandler ("addstat1", root,function () if not (getPedStat (source,69,1000)) then setPedStat (source, 69, (getPedStat (source, 69)+20)) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) else outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) return end end) I did this, not working. You've done it way better, thank you so much, man
  8. I'm making a kind of a stat upgrade system, I made an event that is supposed to give you 20 stat points to the Colt45 for example, cancel the event and output a chat message when you have the weapon stat upgraded to the max. The script gives 20 stat points and works perfectly: addEvent("addstat1",true) addEventHandler ("addstat1", root,function () setPedStat (source, 69, (getPedStat (source, 69)+20)) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end) but when I try to cancel event when on max stats: addEvent("addstat1",true) addEventHandler ("addstat1", root,function () if getPedStat (source,69,1000) then outputChatBox ("NO PUEDES MEJORAR.",source,255,255,255) cancelEvent() else setPedStat (source, 69, (getPedStat (source, 69)+20)) outputChatBox ("Has mejorado 2 puntos de Colt 45.",source,255,255,255) end end) This one is not working.
  9. Hello, I'm trying to make zombies to get killed when they get shot in the body. It actually works, but peds don't die properly, they appear as dead, but don't count as dead, even when you get a little far from them, they appear as walking without moving from the position where they died. Here's the function that I'm talking about. function Zheadhit ( ped,attacker, weapon, bodypart) if (getElementData (ped, "zombie") == true) then setElementHealth(ped,( getElementHealth(ped)-math.random(35))) setPedHeadless ( ped, false ) end end
  10. I'm creating a scrpt that creates a marker and opens a GUI, when you press a button it will give you a random weapon with random ammo, how can I make the script to tell the weapon you received on the chatbox? Client rRoot = getResourceRootElement(getThisResource()) function cerrarmystery () guiSetVisible(mystery,false) showCursor (false) end local weapons = { 12, 14, 15, 20, 30, 31 } function abrirmystery () guiSetVisible (mystery, true) showCursor (true) end function mysterymoney (thePlayer) local money = getPlayerMoney(thePlayer) if (money < 8000) then outputChatBox ("NO TIENES SUFICIENTE DINERO") return else triggerServerEvent ("quitardinero",localPlayer) outputChatBox ("HAS COMPRADO LA CAJA MISTERIOSA") playSound ("mysbox.mp3",false) triggerServerEvent ("dararma", localPlayer) end end addEvent ("cajamisterio", true) addEventHandler ("cajamisterio", localPlayer, abrirmystery) addEventHandler ("onClientResourceStart", rRoot,cerrarmystery) local screenW, screenH = guiGetScreenSize() mystery = guiCreateWindow((screenW - 699) / 2, (screenH - 152) / 2, 699, 152, "CAJA MISTERIOSA", false) guiWindowSetSizable(mystery, false) mysterylabel = guiCreateLabel(55, 23, 592, 46, "¿Quieres comprar la caja aleatoria?", false, mystery) guiSetFont(mysterylabel, "sa-header") mysterybutton1 = guiCreateButton(460, 81, 187, 48, "NO.", false, mystery) guiSetFont(mysterybutton1, "default-bold-small") guiSetProperty(mysterybutton1, "NormalTextColour", "FFFF0000") mysterybutton2 = guiCreateButton(55, 81, 187, 48, "SÍ (8.000$)", false, mystery) guiSetFont(mysterybutton2, "default-bold-small") guiSetProperty(mysterybutton2, "NormalTextColour", "FF84FF00") addEventHandler ("onClientGUIClick", mysterybutton1, cerrarmystery, false) addEventHandler ("onClientGUIClick", mysterybutton2, mysterymoney, false) Server mysterymarker = createMarker (-514,2649,52.5, "cylinder", 2.0,255,255,255,255) local weapons = { 25,26,27,28,29,32,30,31,33,34,38,22,23,24,14,41,12,15} local ammo = {100,120,150,180,200,250,400,500,600,700,800,900,1000} function mysteriomarker (plr) if plr then triggerClientEvent(plr,"cajamisterio",plr) end end addEventHandler ("onMarkerHit", mysterymarker, mysteriomarker) function fueradinero () takePlayerMoney (source, 8000 ) end addEvent ("quitardinero",true) addEventHandler ("quitardinero", root, fueradinero) addEvent ("dararma",true) addEventHandler ("dararma", root, function () giveWeapon( source, weapons[ math.random( #weapons ) ] , ammo[math.random(#ammo)] , true) ; end )
  11. DRW

    givePlayerMoney

    FINALLY, THANK YOU VERY MUCH!
  12. DRW

    givePlayerMoney

    function fueradinero () takePlayerMoney (source, 8000 ) end addEvent ("quitardinero",true) addEventHandler ("quitardinero", root, fueradinero Like this? It's not working...
  13. DRW

    givePlayerMoney

    function fueradinero () takePlayerMoney (source, 8000 ) end Still not working, also, nothing in debugscript.
  14. DRW

    givePlayerMoney

    Tried clientside, not working. Tried serverside, not working. Client function mysterymoney (thePlayer) local money = getPlayerMoney(thePlayer) if (money < 8000) then cancelEvent () if (money < 8000) then outputChatBox ("NO TIENES SUFICIENTE DINERO") else triggerServerEvent ("quitardinero",thePlayer) end end end Server function fueradinero (player) takePlayerMoney (player, 8000 ) end addEvent ("quitardinero",true) addEventHandler ("quitardinero", fueradinero)
  15. DRW

    givePlayerMoney

    Hello, I'm making a kind of script that gives you a random weapon with random ammo and reproduces a sound (Like in Black Ops Zombies, but I'm still working with the GUI. Alright, the problem is that I created a button that detects if you have less money than 8000 and says you don't have enough and cancels the event, that works, but when you have enough, you are supposed to lose 8000, but you don't, actually it does nothing. Client: rRoot = getResourceRootElement(getThisResource()) function cerrarmystery () guiSetVisible(mystery,false) showCursor (false) end function abrirmystery () guiSetVisible (mystery, true) showCursor (true) end function mysterymoney (thePlayer) local money = getPlayerMoney(thePlayer) if (money < 8000) then cancelEvent () if (money < 8000) then outputChatBox ("NO TIENES SUFICIENTE DINERO") else givePlayerMoney (-8000) end end end addEvent ("cajamisterio", true) addEventHandler ("cajamisterio", localPlayer, abrirmystery) addEventHandler ("onClientResourceStart", rRoot,cerrarmystery) local screenW, screenH = guiGetScreenSize() mystery = guiCreateWindow((screenW - 699) / 2, (screenH - 152) / 2, 699, 152, "CAJA MISTERIOSA", false) guiWindowSetSizable(mystery, false) mysterylabel = guiCreateLabel(55, 23, 592, 46, "¿Quieres comprar la caja aleatoria?", false, mystery) guiSetFont(mysterylabel, "sa-header") mysterybutton1 = guiCreateButton(460, 81, 187, 48, "NO.", false, mystery) guiSetFont(mysterybutton1, "default-bold-small") guiSetProperty(mysterybutton1, "NormalTextColour", "FFFF0000") mysterybutton2 = guiCreateButton(55, 81, 187, 48, "SÍ (8.000$)", false, mystery) guiSetFont(mysterybutton2, "default-bold-small") guiSetProperty(mysterybutton2, "NormalTextColour", "FF84FF00") addEventHandler ("onClientGUIClick", mysterybutton1, cerrarmystery, false) addEventHandler ("onClientGUIClick", mysterybutton2, mysterymoney, false)
  16. Hello! I have a problem with GUIs, for example, login panels, because when I try to type the password containing a "t" then the chat activates and it's very annoying. What should I do to prevent chat activation when pressing T while the GUI is open?
  17. DRW

    Turf zone leaving

    where should I add that?
  18. I'm using a turfing script that creates specific turfs and lets gang members conquer the turf zones, but when players enter they start conquering, and when they leave the zone the turf is still being conquered even if there are no players from the gang inside the turf colshape. What can I do? Server-Side: ------------------------------------------------------ -- Scripting By Sasuke* -- Por Favor, no remuevas los creditos. -- Copyright © 2013 - Todos los derechos reservados. ------------------------------------------------------ local turfPos = { { 2133.1950683594, 633.66455078125, 0, 197.5, 92, 90 }, { 2486.5935058594, 678.20172119141, 0, 245, 133, 30 }, { 1856.2864990234, 627.07629394531, 0, 138.25, 152.75, 90 }, { 1576.8956298828, 662.84362792969, 0, 181, 120.5, 90 }, { 1577.6783447266, 943.66607666016, 0, 190, 190, 90 }, { 1383.4364013672, 909.61499023438, 0, 142, 230, 90 }, { 956.94744873047, 1011.635925293, 0, 220, 140, 90 }, { 1017.7476196289, 1203.4068603516, 0, 180, 165, 90 }, { 1017.623046875, 1383.4741210938, 0, 190, 290, 90 }, { 917.99707031253, 1623.6003417969, 0, 80, 220, 90 }, { 1017.7178955078, 1862.6740722656, 0, 140, 180, 90 }, { 912.50573730469, 1958.6761474609, 0, 90, 230, 90 }, { 1017.3455200195, 2063.38671875, 0, 150, 300, 90 }, { 1300.7644042969, 2095.5100097656, 0, 200, 140, 90 }, { 1398.1997070313, 2323.5505371094, 0, 160, 65, 90 }, { 1578.1955566406, 2284.0825195313, 0, 180, 110, 90 }, { 1237.6285400391, 2581.4663085938, 0, 450, 130, 90 }, { 1780.478515625, 2567.2121582031, 0, 130, 130, 90 }, { 1698.2750244141, 2724.494140625, 0, 200, 150, 90 }, { 2237.9494628906, 2723.7814941406, 0, 180, 110, 90 }, { 2498.6853027344, 2704.6188964844, 0, 300, 140, 90 }, { 2798.1267089844, 2303.9643554688, 0, 120, 300, 90 }, { 2557.5688476563, 2243.4963378906, 0, 100, 230, 90 }, { 2532.5830078125, 2063.4118652344, 0, 100, 150, 90 }, { 2558.1779785156, 1624.0816650391, 0, 100, 300, 90 }, { 2437.685546875, 1483.7209472656, 0, 160, 120, 90 }, { 2077.7106933594, 1203.5559082031, 0, 340, 170, 90 }, { 2082.3193359375, 979.23583984375, 0, 270, 210, 90 } } local areaPos = { { 2130, 630, 200, 100 }, { 2488.8793945313, 680.78289794922, 250, 130 }, { 1858, 623, 140, 165 }, { 1577, 663, 180, 130 }, { 1577, 943, 185, 190 }, { 1383, 909, 120, 230 }, { 956, 1011, 220, 140 }, { 1017, 1203, 180, 165 }, { 1017, 1383, 190, 290 }, { 917, 1623, 80, 220 }, { 1017, 1862, 140, 180 }, { 912, 1958, 90, 240 }, { 1017, 2063, 150, 300 }, { 1300, 2092, 200, 140 }, { 1398, 2323, 160, 65 }, { 1578, 2284, 180, 110 }, { 1237, 2581, 450, 130 }, { 1780, 2567, 130, 130 }, { 1698, 2724, 200, 150 }, { 2237, 2723, 180, 110 }, { 2498, 2704, 300, 140 }, { 2798, 2303, 120, 300 }, { 2557, 2243, 100, 230 }, { 2532, 2063, 100, 150 }, { 2558, 1624, 100, 300 }, { 2437, 1483, 160, 120 }, { 2077, 1203, 340, 170}, { 2082, 979, 270, 210 } } local turfElement = {} local turfTimer = {} checkComplete = false language = "Spanish" -- Pon "Spanish" para español -- Put "English" for english text addEventHandler("onResourceStart", resourceRoot, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS Turf_System ( Turfs TEXT, GangOwner TEXT, r INT, g INT, b INT)") local check = executeSQLQuery("SELECT * FROM Turf_System" ) if #check == 0 then for i=1,#turfPos do executeSQLQuery("INSERT INTO Turf_System(Turfs,GangOwner,r,g,b) VALUES(?,?,?,?,?)", "Turf["..tostring(i).."]", "Nadie", 0, 255, 0) end end for i,v in ipairs(turfPos) do local sqlData = executeSQLQuery("SELECT * FROM Turf_System WHERE Turfs=?", "Turf["..tostring(i).."]") local turfCol = createColCuboid(unpack(v)) setElementData(turfCol, "getTurfGang", sqlData[1].GangOwner) local arg1,arg2,arg3,arg4 = unpack(areaPos[i]) local turfArea = createRadarArea(arg1, arg2, arg3, arg4, sqlData[1].r, sqlData[1].g, sqlData[1].b, 175) turfElement[turfCol] = {turfCol, turfArea, i} end if language == "Spanish" then outputDebugString("Sistema de turf by Sasuke* ha iniciado correctamente!") else outputDebugString("Turf System by Sasuke* was started correctly!") end end ) function radar ( player, md ) if getElementType ( player ) ~= "player" or not md then return end if not getElementData(source, "getTurfGang") then return end local t = turfElement[source] if type(t) ~= "table" then return end local turf,area,id = unpack(t) if turf and area and source == turf then local playerGang = getElementData ( player, "gang" ) local turfGang = executeSQLQuery("SELECT GangOwner FROM Turf_System WHERE Turfs=?", "Turf["..tostring(id).."]" ) if ( turfGang[1].GangOwner == playerGang ) then if language == "Spanish" then outputChatBox("Este territorio ya pertenece a "..turfGang[1].GangOwner or "Nadie", player, 0, 255, 0, false) else outputChatBox("This territory already belongs to "..turfGang[1].GangOwner or "None", player, 0, 255, 0, false) end else if not getPlayerTeam(player) then return end local team = getPlayerTeam ( player ) local team = getPlayerTeam ( player ) if ( getTeamName( team ) == "Jugadores" ) then local playerGang = getElementData ( player, "gang" ) if ( isTimer ( turfTimer[source] ) ) then return end if ( playerGang ) then local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) setRadarAreaFlashing ( area, true ) if turfGang[1].GangOwner ~= "Nadie" then if language == "Spanish" then outputChatBox("Estás en la zona de "..turfGang[1].GangOwner..". ¡Espera 2 minutos para conquistar el territorio!", player, 0, 255, 0, false) else outputChatBox("You enter into de "..turfGang[1].GangOwner.."'s turf zone. Wait 2 minutes to capture the turf and win 4k", player, 0, 255, 0, false) end else if language == "Spanish" then outputChatBox("¡Éste turf no pertenece a nadie, sobrevive 2 minutos y lo conseguirás! ", player, 0, 255, 0, false) else outputChatBox("This turf do not belong to anyone. Wait 2 minutes to capture the turf and win 4k", player, 0, 255, 0, false) end end turfTimer[source] = setTimer ( function ( ) local beachTurfCplayers = getElementColShape ( turf ) local players = getElementsWithinColShape ( turf, "player" ) setRadarAreaColor ( area, tonumber(r), tonumber(g), tonumber(b), 175 ) for _, player in ipairs ( players ) do if getElementData(player, "gang") == playerGang then if language == "Spanish" then outputChatBox("¡Tu clan ha conquistado el territorio!", player, 0, 255, 0, false) else outputChatBox("Congratulations. You capture the turf. +4K!", player, 0, 255, 0, false) end triggerClientEvent("onTakeTurf", player) givePlayerMoney ( player, 7000 ) executeSQLQuery("UPDATE Turf_System SET GangOwner=?,r=?,g=?,b=? WHERE Turfs=?", playerGang, tonumber(r), tonumber(g), tonumber(b), "Turf["..tostring(id).."]" ) -- setElementData ( turf, "getTurfGang", playerGang ) end end setRadarAreaFlashing ( area, false ) end ,120000, 1) -- 120000 end end end end end addEventHandler ( "onColShapeHit", root, radar ) Client-Side: addEventHandler("onClientResourceStart", resourceRoot, function() setDevelopmentMode(true) end) function music() local sound = playSound("missionDone.mp3") end addEvent("onTakeTurf", true) addEventHandler("onTakeTurf", getLocalPlayer(), music)
  19. THANK YOU VERY MUCH! Also, I want to cancel the zone conquering action if the conquering gang is out of the colshape, what can I do?
  20. I don't know at which line to put it
  21. Hello, I'm using a "tuf war" resource that creates turf zones and permits people from gangs to be able to capture the zones, so when a player enters and stays for 2 minutes he will start taking the zone and the created radararea will start flashing until those 2 minutes had passed. The problem is that I don't want players to be able to conquer from a vehicle, also when all players of the attacking gang quit the zone, the zone will stop flashing and will become normal again. I've tried to "if isPlayerInVehicle (thePlayer) then cancelEvent()" , but it's not working and I know it isn't as simple as two short lines. What can I do? Server-Side: ------------------------------------------------------ -- Scripting By Sasuke* -- Por Favor, no remuevas los creditos. -- Copyright © 2013 - Todos los derechos reservados. ------------------------------------------------------ local turfPos = { { 2133.1950683594, 633.66455078125, 0, 197.5, 92, 90 }, { 2486.5935058594, 678.20172119141, 0, 245, 133, 30 }, { 1856.2864990234, 627.07629394531, 0, 138.25, 152.75, 90 }, { 1576.8956298828, 662.84362792969, 0, 181, 120.5, 90 }, { 1577.6783447266, 943.66607666016, 0, 190, 190, 90 }, { 1383.4364013672, 909.61499023438, 0, 142, 230, 90 }, { 956.94744873047, 1011.635925293, 0, 220, 140, 90 }, { 1017.7476196289, 1203.4068603516, 0, 180, 165, 90 }, { 1017.623046875, 1383.4741210938, 0, 190, 290, 90 }, { 917.99707031253, 1623.6003417969, 0, 80, 220, 90 }, { 1017.7178955078, 1862.6740722656, 0, 140, 180, 90 }, { 912.50573730469, 1958.6761474609, 0, 90, 230, 90 }, { 1017.3455200195, 2063.38671875, 0, 150, 300, 90 }, { 1300.7644042969, 2095.5100097656, 0, 200, 140, 90 }, { 1398.1997070313, 2323.5505371094, 0, 160, 65, 90 }, { 1578.1955566406, 2284.0825195313, 0, 180, 110, 90 }, { 1237.6285400391, 2581.4663085938, 0, 450, 130, 90 }, { 1780.478515625, 2567.2121582031, 0, 130, 130, 90 }, { 1698.2750244141, 2724.494140625, 0, 200, 150, 90 }, { 2237.9494628906, 2723.7814941406, 0, 180, 110, 90 }, { 2498.6853027344, 2704.6188964844, 0, 300, 140, 90 }, { 2798.1267089844, 2303.9643554688, 0, 120, 300, 90 }, { 2557.5688476563, 2243.4963378906, 0, 100, 230, 90 }, { 2532.5830078125, 2063.4118652344, 0, 100, 150, 90 }, { 2558.1779785156, 1624.0816650391, 0, 100, 300, 90 }, { 2437.685546875, 1483.7209472656, 0, 160, 120, 90 }, { 2077.7106933594, 1203.5559082031, 0, 340, 170, 90 }, { 2082.3193359375, 979.23583984375, 0, 270, 210, 90 } } local areaPos = { { 2130, 630, 200, 100 }, { 2488.8793945313, 680.78289794922, 250, 130 }, { 1858, 623, 140, 165 }, { 1577, 663, 180, 130 }, { 1577, 943, 185, 190 }, { 1383, 909, 120, 230 }, { 956, 1011, 220, 140 }, { 1017, 1203, 180, 165 }, { 1017, 1383, 190, 290 }, { 917, 1623, 80, 220 }, { 1017, 1862, 140, 180 }, { 912, 1958, 90, 240 }, { 1017, 2063, 150, 300 }, { 1300, 2092, 200, 140 }, { 1398, 2323, 160, 65 }, { 1578, 2284, 180, 110 }, { 1237, 2581, 450, 130 }, { 1780, 2567, 130, 130 }, { 1698, 2724, 200, 150 }, { 2237, 2723, 180, 110 }, { 2498, 2704, 300, 140 }, { 2798, 2303, 120, 300 }, { 2557, 2243, 100, 230 }, { 2532, 2063, 100, 150 }, { 2558, 1624, 100, 300 }, { 2437, 1483, 160, 120 }, { 2077, 1203, 340, 170}, { 2082, 979, 270, 210 } } local turfElement = {} local turfTimer = {} checkComplete = false language = "Spanish" -- Pon "Spanish" para español -- Put "English" for english text addEventHandler("onResourceStart", resourceRoot, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS Turf_System ( Turfs TEXT, GangOwner TEXT, r INT, g INT, b INT)") local check = executeSQLQuery("SELECT * FROM Turf_System" ) if #check == 0 then for i=1,#turfPos do executeSQLQuery("INSERT INTO Turf_System(Turfs,GangOwner,r,g,b) VALUES(?,?,?,?,?)", "Turf["..tostring(i).."]", "Nadie", 0, 255, 0) end end for i,v in ipairs(turfPos) do local sqlData = executeSQLQuery("SELECT * FROM Turf_System WHERE Turfs=?", "Turf["..tostring(i).."]") local turfCol = createColCuboid(unpack(v)) setElementData(turfCol, "getTurfGang", sqlData[1].GangOwner) local arg1,arg2,arg3,arg4 = unpack(areaPos[i]) local turfArea = createRadarArea(arg1, arg2, arg3, arg4, sqlData[1].r, sqlData[1].g, sqlData[1].b, 175) turfElement[turfCol] = {turfCol, turfArea, i} end if language == "Spanish" then outputDebugString("Sistema de turf by Sasuke* ha iniciado correctamente!") else outputDebugString("Turf System by Sasuke* was started correctly!") end end ) function radar ( player, md ) if getElementType ( player ) ~= "player" or not md then return end if not getElementData(source, "getTurfGang") then return end local t = turfElement[source] if type(t) ~= "table" then return end local turf,area,id = unpack(t) if turf and area and source == turf then local playerGang = getElementData ( player, "gang" ) local turfGang = executeSQLQuery("SELECT GangOwner FROM Turf_System WHERE Turfs=?", "Turf["..tostring(id).."]" ) if ( turfGang[1].GangOwner == playerGang ) then if language == "Spanish" then outputChatBox("Este territorio ya pertenece a "..turfGang[1].GangOwner or "Nadie", player, 0, 255, 0, false) else outputChatBox("This territory already belongs to "..turfGang[1].GangOwner or "None", player, 0, 255, 0, false) end else if not getPlayerTeam(player) then return end local team = getPlayerTeam ( player ) local team = getPlayerTeam ( player ) if ( getTeamName( team ) == "Jugadores" ) then local playerGang = getElementData ( player, "gang" ) if ( isTimer ( turfTimer[source] ) ) then return end if ( playerGang ) then local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) setRadarAreaFlashing ( area, true ) if turfGang[1].GangOwner ~= "Nadie" then if language == "Spanish" then outputChatBox("Estás en la zona de "..turfGang[1].GangOwner..". ¡Espera 2 minutos para conquistar el territorio!", player, 0, 255, 0, false) else outputChatBox("You enter into de "..turfGang[1].GangOwner.."'s turf zone. Wait 2 minutes to capture the turf and win 4k", player, 0, 255, 0, false) end else if language == "Spanish" then outputChatBox("¡Éste turf no pertenece a nadie, sobrevive 2 minutos y lo conseguirás! ", player, 0, 255, 0, false) else outputChatBox("This turf do not belong to anyone. Wait 2 minutes to capture the turf and win 4k", player, 0, 255, 0, false) end end turfTimer[source] = setTimer ( function ( ) local beachTurfCplayers = getElementColShape ( turf ) local players = getElementsWithinColShape ( turf, "player" ) setRadarAreaColor ( area, tonumber(r), tonumber(g), tonumber(b), 175 ) for _, player in ipairs ( players ) do if getElementData(player, "gang") == playerGang then if language == "Spanish" then outputChatBox("¡Tu clan ha conquistado el territorio!", player, 0, 255, 0, false) else outputChatBox("Congratulations. You capture the turf. +4K!", player, 0, 255, 0, false) end triggerClientEvent("onTakeTurf", player) givePlayerMoney ( player, 7000 ) executeSQLQuery("UPDATE Turf_System SET GangOwner=?,r=?,g=?,b=? WHERE Turfs=?", playerGang, tonumber(r), tonumber(g), tonumber(b), "Turf["..tostring(id).."]" ) -- setElementData ( turf, "getTurfGang", playerGang ) end end setRadarAreaFlashing ( area, false ) end ,120000, 1) -- 120000 end end end end end addEventHandler ( "onColShapeHit", root, radar ) Client-Side addEventHandler("onClientResourceStart", resourceRoot, function() setDevelopmentMode(true) end) function music() local sound = playSound("missionDone.mp3") end addEvent("onTakeTurf", true) addEventHandler("onTakeTurf", getLocalPlayer(), music)
×
×
  • Create New...