Jump to content

Benevolence

Members
  • Posts

    367
  • Joined

  • Last visited

Everything posted by Benevolence

  1. A: To protect his cookies from the cookie monster. Q: Tiger?
  2. A: Yes. But Mac only for everything else but epic gaming. Q: Teach me LUA like a pro?
  3. A: To make him feel good because he doesn't have one. Q: Going to buy the iPhone 4S when it comes out?
  4. Why didn't you take our advice and just NOT USE SERVERFFS in the first place?
  5. So I'm trying to make it so if the player is in the safe zone (a rectangular colShape) then that is when he can access the Weapon Shop GUI (by pressing f1). If he's not in the safe zone, then he can't access it. Right now, the player can access it from anywhere he wants. I'm guessing I need to use isElementWithinColShape but the script is kind of messy since I didn't make it so I don't know exactly how and where to put it. This is the full script: -- server side addEvent ("viewGUI", true) function showGui (hitPlayer, matchingDimension) triggerClientEvent ("viewGUI", hitPlayer) end addCommandHandler("shop",showGui) addEvent ("weapBuy", true) addEventHandler ("weapBuy", getRootElement(), function(id, cost, name, ammo) if (getPlayerMoney (source) >= tonumber(cost)) then outputChatBox ("-------------------------------WEAPON SHOP-------------------------------", source, 255, 0, 0, false) outputChatBox ("You Bought a " .. name, source, 255, 0, 0, false) --outputChatBox ("ID: " .. id, source, 255, 0, 0, false) outputChatBox ("Cost: $" .. cost, source, 255, 0, 0, false) outputChatBox ("------------------------------------------------------------------------------------", source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost)) giveWeapon(source, tonumber(id),1000) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end) addEvent ("carBuy", true) addEventHandler ("carBuy", getRootElement(), function(id2, cost2, name2,x, y, z, sRz) if (getPlayerMoney (source) >= tonumber(cost2)) then outputChatBox ("Bought a " .. name2, source, 255, 0, 0, false) outputChatBox ("ID: " .. id2, source, 255, 0, 0, false) outputChatBox ("Cost: " .. cost2, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost2)) local x,y,z = getElementPosition (source) local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) warpPedIntoVehicle(source, vehicle) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end) function vExplode () toggleVehicleRespawn ( source, false ) setTimer(destroyElement, 5000, 1, source) end addEventHandler ( "onVehicleExplode", getResourceRootElement(getThisResource()), vExplode ) function skillButton (id, cost) if (id == "0") then skillBuyPlayer (250,source,69) elseif (id == "1") then skillBuyPlayer (2000,source,70) elseif (id == "2") then skillBuyPlayer (500,source,71) elseif (id == "3") then skillBuyPlayer (5800,source,72) elseif (id == "4") then skillBuyPlayer (11000,source,73) elseif (id == "5") then skillBuyPlayer (7500,source,74) elseif (id == "6") then skillBuyPlayer (5500,source,75) elseif (id == "7") then skillBuyPlayer (7000,source,76) elseif (id == "8") then skillBuyPlayer (8000,source,77) elseif (id == "9") then skillBuyPlayer (10000,source,78) elseif (id == "10") then skillBuyPlayer (10000,source,79) end end addEvent ("skillBuy", true) addEventHandler ("skillBuy", getRootElement(),skillButton) function skillBuyPlayer (cash,player,id) if (getPlayerMoney (player) >= cash) then takePlayerMoney (player,cash) setPedStat(player, id, 999) else outputChatBox ("You are too poor!", player, 255,0,0) end end -- client side shopWindow = guiCreateWindow(367,105,334,435,"Shop",false) guiSetVisible (shopWindow, false) guiSetAlpha(shopWindow,1) guiWindowSetSizable(shopWindow,false) tabPanel = guiCreateTabPanel(11,23,314,372,false,shopWindow) --tab = guiCreateTab("Vehicles",tabPanel) --carGrid = guiCreateGridList(4,6,305,291,false,tab) --guiGridListSetSelectionMode(carGrid,0) --carColumn = guiGridListAddColumn(carGrid,"Vehicle",0.5) costColumn = guiGridListAddColumn(carGrid,"$",0.3) --carButton = guiCreateButton(107,308,100,29,"Buy Vehicle",false,tab) tab2 = guiCreateTab("Weapons",tabPanel) weapGrid = guiCreateGridList(4,6,305,291,false,tab2) guiGridListSetSelectionMode(weapGrid,0) weapColumn = guiGridListAddColumn(weapGrid,"Weapon",0.5) costColumn = guiGridListAddColumn(weapGrid,"Cost",0.3) weapButton = guiCreateButton(107,308,100,29,"Buy Weapon",false,tab2) --tab3 = guiCreateTab("Skills",tabPanel) --skillsGrid = guiCreateGridList(4,6,305,291,false,tab3) --guiGridListSetSelectionMode(skillsGrid,0) --costColumn = guiGridListAddColumn(skillsGrid,"ID",0.3) --skillsColumn = guiGridListAddColumn(skillsGrid,"Skill name",0.5) --costColumn = guiGridListAddColumn(skillsGrid,"$",0.3) --skillsButton = guiCreateButton(107,308,100,29,"Buy Skill",false,tab3) local weapons = {{31,3500},{4,15000},{5,500},{6,1500},{7,3500},{8,10000},{9,12000},{22,2500},{23,2700},{24,4000},{25,4200},{26,9000},{27,8000},{28,6500},{29,7000},{30,3500},{32,7800},{33,11000},{34,16000},{16,20000}} for i,v in ipairs (weapons) do local itemName = getWeaponNameFromID (v[1]) local row = guiGridListAddRow (weapGrid) guiGridListSetItemText (weapGrid, row, 1, itemName, false, true) guiGridListSetItemText (weapGrid, row, 2, tostring(v[2]), false, true) end guiSetAlpha(weapGrid,1) closeButton = guiCreateButton(112,401,113,24,"Close Shop",false,shopWindow) --local vehicles = {{579,60000},{400,60000},{404,28000},{489,65000},{505,65000},{479,45000},{442,45000},{458,45000},{602,100000},{496,42500},{401,41000},{518,60000},{527,75000},{589,75000},{419,45000},{533,75000},{526,50000},{474,55000},{545,50000},{517,45000},{410,41000},{600,50000},{436,41000},{580,50000},{439,75000},{549,75000},{491,45000},{445,45000},{507,45000},{585,45000},{587,100000},{466,55000},{492,50000},{546,45000},{551,45000},{516,45000},{467,45000},{426,47500},{547,45000},{405,55000},{409,75000},{550,45000},{566,45000},{540,45000},{421,50000},{529,45000},{402,250000},{542,65000},{603,150000},{475,75000},{562,175000},{565,95000},{559,125000},{561,50000},{560,125000},{558,100000},{429,150000},{541,150000},{415,150000},{480,95000},{434,100000},{494,200000},{502,200000},{503,200000},{411,300000},{506,150000},{451,300000},{555,95000},{477,95000},{499,25000},{498,25000},{578,50000},{486,70000},{406,500000},{573,250000},{455,75000},{588,50000},{403,75000},{423,1000000},{414,50000},{443,75000},{515,75000},{514,75000},{531,12000},{456,45000},{422,45000},{482,95000},{530,12000},{418,45000},{572,12000},{582,50000},{413,50000},{440,50000},{543,65000},{583,12000},{478,35000},{554,50000},{536,75000},{575,75000},{534,75000},{567,75000},{535,75000},{576,75000},{412,75000},{568,75000},{457,12000},{483,45000},{508,40000},{571,10000},{500,55000},{444,250000},{556,250000},{557,250000},{495,100000},{539,75000},{485,12000},{431,60000},{438,45000},{437,60000},{574,12000},{420,45000},{525,75000},{408,50000},{428,65000}} --for i,v in ipairs (vehicles) do --local carName = getVehicleNameFromModel (v[1]) --local row = guiGridListAddRow (carGrid) --guiGridListSetItemText (carGrid, row, 1, carName, false, true) --guiGridListSetItemText (carGrid, row, 2, tostring(v[2]), false, true) --end skillsTable = {{"0","Colt-45 Skill","250"},{"1","Silenced-Pistol Skill","500"},{"2","Desert-Eagle Skill","2000"},{"3","Shotgun Skill","5800"},{"4","Sawed-off Skill","11000"},{"5","Spaz-12 Skill","7500"},{"6","Uzi Skill","5500"},{"7","MP5 Skill","8000"},{"8","AK-47 Skill","10000"},{"9","M4 Skill","9000"},{"10","Sniper","17000"}} for i,v in ipairs (skillsTable) do local row = guiGridListAddRow (skillsGrid) guiGridListSetItemText (skillsGrid, row, 1, v[1], false, true) guiGridListSetItemText (skillsGrid, row, 2, v[2], false, true) guiGridListSetItemText (skillsGrid, row, 3, v[3], false, true) end function closeShop() if guiGetVisible(shopWindow) then guiSetVisible(shopWindow,false) showCursor(false) end end addEventHandler ("onClientGUIClick", closeButton, closeShop) addEvent ("viewGUI", true) function viewGUI () if (getLocalPlayer() == source) then guiSetVisible (shopWindow, true) showCursor (true) end end addEventHandler ("viewGUI", getRootElement(), viewGUI) function onClientWeapBuy (button, state, absoluteX, absoluteYe) if (source == weapButton) then guiSetVisible (shopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (weapGrid)) then local itemName = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 1) local itemID = getWeaponIDFromName (itemName) local itemCost = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 2) triggerServerEvent ("weapBuy", getLocalPlayer(), itemID, itemCost, itemName) end end end addEventHandler ("onClientGUIClick", weapButton, onClientWeapBuy) function onClientCarBuy (button, state, absoluteX, absoluteYe) if (source == carButton) then guiSetVisible (shopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (carGrid)) then local carName = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem (carGrid), 1) local carID = getVehicleModelFromName (carName) local carCost = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem (carGrid), 2) triggerServerEvent ("carBuy", getLocalPlayer(), carID, carCost, carName) end end end addEventHandler ("onClientGUIClick", carButton, onClientCarBuy) function onClientSkillBuy (button, state, absoluteX, absoluteYe) if (source == skillsButton) then guiSetVisible (shopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (skillsGrid)) then local id = guiGridListGetItemText (skillsGrid, guiGridListGetSelectedItem (skillsGrid), 1) local cost = guiGridListGetItemText (skillsGrid, guiGridListGetSelectedItem (skillsGrid), 2) triggerServerEvent ("skillBuy", getLocalPlayer(), id, cost) end end end addEventHandler ("onClientGUIClick", skillsButton, onClientSkillBuy) function ToggleShop() if guiGetVisible(shopWindow) == true then guiSetVisible(shopWindow,false) showCursor(false) else guiSetVisible(shopWindow,true) showCursor(true) end end bindKey("F1","down",ToggleShop)
  6. Benevolence

    Gun sounds

    Well what's the function I need to use?
  7. Benevolence

    Gun sounds

    Could you fix the script then?
  8. Benevolence

    Gun sounds

    Yes Jason. It's client side, I will copy paste my semi-messy but working script. Don't forget to load the gun sound file (for example sniper.wav) in Meta. Ignore the commented stuff, all it does is make you go into slow motion when you shoot someone. It also blows up vehicles, I'm sure you know what res fiddycal is. function firedFiddyCal(weapon, ammo, clipammo, x, y, z, element) if ( weapon == 34) then -- sniper local px, py, pz = getElementPosition(source) local sound = playSound3D("sniper.wav", px, py, pz) setSoundMaxDistance(sound, 150) --if ( element and source == getLocalPlayer() and ( getElementType(element) == "vehicle" or getElementType(element) == "player" ) ) then -- we are the shooter --setGameSpeed(0.3) --setTimer(setGameSpeed, 6000, 1, 1.0) --triggerServerEvent("50cal", getLocalPlayer(), element) --end if ( element and getElementType(element) == "player" ) then -- make blood fxAddBlood(x, y, z, 0, 0, 1, 1000, 1) fxAddBlood(x, y, z, 1, 0, 0, 1000, 1) fxAddBlood(x, y, z, 0, 1, 1, 1000, 1) fxAddBlood(x, y, z, 1, 1, 1, 1000, 1) fxAddBlood(x, y, z, 0, 1, 0, 1000, 1) end end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), firedFiddyCal)
  9. It's server side. Is there something wrong with it? I THINK that sometimes it loads my guns and sometimes not. Like, I got a weapon with some ammo, relogged and I had the gun and ammo. I restarted the whole server and I didn't have the gun and ammo. I restarted the save resource (which has this script) and then I logged in and alll my guns appeared after I bought another gun. It's weird. Perhaps something wrong with the script? function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then setAccountData (playeraccount, "s.weap0", getPedWeapon ( source, 0 )) setAccountData (playeraccount, "s.weap1", getPedWeapon ( source, 1 )) setAccountData (playeraccount, "s.weap2", getPedWeapon ( source, 2 )) setAccountData (playeraccount, "s.ammo2", getPedTotalAmmo ( source, 2 )) setAccountData (playeraccount, "s.weap3", getPedWeapon ( source, 3 )) setAccountData (playeraccount, "s.ammo3", getPedTotalAmmo ( source, 3 )) setAccountData (playeraccount, "s.weap4", getPedWeapon ( source, 4 )) setAccountData (playeraccount, "s.ammo4", getPedTotalAmmo ( source, 4 )) setAccountData (playeraccount, "s.weap5", getPedWeapon ( source, 5 )) setAccountData (playeraccount, "s.ammo5", getPedTotalAmmo ( source, 5 )) setAccountData (playeraccount, "s.weap6", getPedWeapon ( source, 6 )) setAccountData (playeraccount, "s.ammo6", getPedTotalAmmo ( source, 6 )) setAccountData (playeraccount, "s.weap7", getPedWeapon ( source, 7 )) setAccountData (playeraccount, "s.ammo7", getPedTotalAmmo ( source, 7 )) setAccountData (playeraccount, "s.weap8", getPedWeapon ( source, 8 )) setAccountData (playeraccount, "s.ammo8", getPedTotalAmmo ( source, 8 )) setAccountData (playeraccount, "s.weap9", getPedWeapon ( source, 9 )) setAccountData (playeraccount, "s.ammo9", getPedTotalAmmo ( source, 9 )) setAccountData (playeraccount, "s.weap10", getPedWeapon ( source, 10 )) setAccountData (playeraccount, "s.weap11", getPedWeapon ( source, 11 )) setAccountData (playeraccount, "s.weap12", getPedWeapon ( source, 12 )) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) local root = getRootElement() addEventHandler("onPlayerLogin", root, function() local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local weap0 = getAccountData(playeraccount, "s.weap0") local weap1 = getAccountData(playeraccount, "s.weap1") local weap2 = getAccountData(playeraccount, "s.weap2") local ammo2 = getAccountData(playeraccount, "s.ammo2") local weap3 = getAccountData(playeraccount, "s.weap3") local ammo3 = getAccountData(playeraccount, "s.ammo3") local weap4 = getAccountData(playeraccount, "s.weap4") local ammo4 = getAccountData(playeraccount, "s.ammo4") local weap5 = getAccountData(playeraccount, "s.weap5") local ammo5 = getAccountData(playeraccount, "s.ammo5") local weap6 = getAccountData(playeraccount, "s.weap6") local ammo6 = getAccountData(playeraccount, "s.ammo6") local weap7 = getAccountData(playeraccount, "s.weap7") local ammo7 = getAccountData(playeraccount, "s.ammo7") local weap8 = getAccountData(playeraccount, "s.weap8") local ammo8 = getAccountData(playeraccount, "s.ammo8") local weap9 = getAccountData(playeraccount, "s.weap9") local ammo9 = getAccountData(playeraccount, "s.ammo9") local weap10 = getAccountData(playeraccount, "s.weap10") local weap11 = getAccountData(playeraccount, "s.weap11") local weap12 = getAccountData(playeraccount, "s.weap12") giveWeapon ( source, weap0, 1 ) giveWeapon ( source, weap1, 1 ) giveWeapon ( source, weap2, ammo2 ) giveWeapon ( source, weap3, ammo3 ) giveWeapon ( source, weap4, ammo4 ) giveWeapon ( source, weap5, ammo5 ) giveWeapon ( source, weap6, ammo6 ) giveWeapon ( source, weap7, ammo7 ) giveWeapon ( source, weap8, ammo8 ) giveWeapon ( source, weap9, ammo9 ) giveWeapon ( source, weap10, 1 ) giveWeapon ( source, weap11, 1 ) giveWeapon ( source, weap12, 1 ) end end )
  10. Honestly, I'd like to see someone create a stunt server. Not a Race server, but a stunt server. It's very popular in SA-MP but not in MTA.
  11. edited my post, added the link. Great.
  12. If I were you I'd post this here https://forum.multitheftauto.com/viewtopic.php?f=108&t=25351
  13. qaisjp is the check necessary? What's the point. And that's not AeroXBird's sig, I've seen it elsewhere so everyone is free to use it.
  14. To honor him I'm going to buy the iPhone 4S now which comes out October 14.
  15. I've used this house before in my mappings. Search for it in map editor I don't know the ID. Probably filter it to like houses or whatever to find it faster.
  16. Steve Jobs, Founder and Former CEO of Apple has died. Read more here: http://news.yahoo.com/steve-jobs-dies--apple-chief-created-personal-computer--ipad--ipod--iphone.html It's a shame. He will be missed.
  17. Could you provide a link to the community page for this?
  18. It works pretty good, thanks. Though, when zombies pile up in front of your truck and you hit the gas, it won't let you go forward. But I guess this is good enough.
  19. Doesn't seem to make a difference and it's probably because of the warning: Bad argument @ 'getElementType' On if ( getElementType(attacker) == "vehicle" ) then
  20. Okay so everyone hates that on Zombie servers when you ram the zombies, most of the times due to lag (i think) or slow speed, it just stops the car and damages it with doing little or no damage to zombies. How could I create a script that makes it so if you hit a zombie while in a moving vehicle in the direction that you are going, it makes the zombie fall (you run him over) and die? Also, if a vehicle is on top of a zombie, it instantly kills the zombie. So if a car falls from out of nowhere onto a zombie, instead of it falling on top then rolling aside of the zombie. Which would be realistic, you ram someone, full speed or not in real life and they will fall under the car. I mean look at this, lol vehicles on a zombie server = crap. I'm creating a zombie GM and I want to make it good and sort of realistic. Like that monster isn't heavy enough to crush them.
  21. This is the script. function playerQuit() local playeracc = getPlayerAccount(source) if ( playeraccount == true ) then local playercash = getPlayerMoney(source) setAccountData(playeracc, "cash", playercash) end end function playerLogin() local playeracc = getPlayerAccount(source) if (playeracc == true) then local playerbank = getAccountData(playeracc, "cash") if (playerbank == true) then setPlayerMoney(source, playerbank) else outputChatBox("You are broke.", source, 255, 0, 0) end end end addEventHandler("onPlayerLogin", getRootElement(), playerLogin) addEventHandler("onPlayerQuit", getRootElement(), playerQuit) addEventHandler("onPlayerLogout",root ,playerQuit) I am logged in. I set my money to like $555 for example then I disconnect and connect and then re-login. My money is 0. Why isn't this working?
×
×
  • Create New...