Jump to content

Danz

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by Danz

  1. local cam1 = createObject ( 1886,1592.1999511719,-1370.0999755859,34.299999237061, 10, 0, 0 ) function gotoCam1( ) local v = getPedOccupiedVehicle(localPlayer) if v and getElementModel(v) == 596 then --596 is Police LS, 597 SF and 598 LV setCameraMatrix ( 1592.1999511719,-1370.0999755859,34.299999237061, 1593.0999755859, -1397.3000488281, 27.799999237061,0,100 ) outputChatBox("Camera 01", 0, 255, 0) else outputChatBox ( 'You are not in a police car.', 255, 0, 0 ) return end end addCommandHandler ( 'cctv1', gotoCam1 ) Here you go, it should work.
  2. Danz

    Help

    You need to also set the Dimension of the Pickup check in your admin panel when you select yourself in what dimension you are, after that use setElementDimension
  3. anyway check my edited post, i've done what you asked
  4. Instead of being a "know-it-all" why don't you help him, give him an example of how to do what he requested when your "Scripting skill is 92%"? Anyway here, this should block all of the weapons you requested (Taken from the Wiki, i just added some more IDs) WeaponID = { [38] = true, --Minigun [35] = true, --Rocket Launcher [36] = true, --HS Rocker Launcher [24] = true, --Deagle [16] = true, --Grenade [27] = true, --Combat Shotgun [33] = true, --Country Rifle [29] = true, --MP5 [32] = true, --Tec9 [30] = true, --AK-47 } function blockWeaponsOnSwitch (previousWeaponID, currentWeaponID) if WeaponID[currentWeaponID] then toggleControl(source, "aim_weapon", false) toggleControl(source, "fire", false) else toggleControl(source, "aim_weapon", true) toggleControl(source, "fire", true) end end addEventHandler("onPlayerWeaponSwitch", root, blockWeaponsOnSwitch) Make sure to place this script in a SERVER-SIDE script/file I could not find a way to block vehicles, do you want to block vehicles from being spawned, or block them from being entered? i want then to only be spawned by admins. i want them enterable if they are spawned though. so basically i want a block on spawning them. and by the way thanks for the script. i add it in like any other resource right? server/mods/deathmatch/resources? Yes, but make sure that resource is Server-Sided in the meta.xml file EDIT: This should do the trick for you function restrictVehicleSpawn (player, command, id) local accountName = getAccountName(getPlayerAccount(player)) if not isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) then outputChatBox("This feature is restricted to Admins only", player, 255, 0, 0) else if not id or not tonumber(id) then outputChatBox("Usage: /createveh ") return false end local id = math.floor(tonumber(id)) --Yet these 2 IDs do not exist, i just used them so that you can spawn the vehicle ID: 400 and 611 if id and id > 399 and id < 612 then local x, y, z = getElementPosition(player) local _, _, rz = getElementRotation(player) vehicle = createVehicle(id, x, y, z, _, _, rz) setVehicleColor(vehicle, 255, 255, 255) warpPedIntoVehicle(player, vehicle) outputChatBox("You have created a "..getVehicleNameFromModel(id).." (ID: "..id..")", player, 0, 255, 0) else outputChatBox("Invalid ID Entered, use IDs from 400 to 611", player, 255, 0, 0) end end end addCommandHandler("createveh", restrictVehicleSpawn) function restrictVehicleEntering (player) local accountName = getAccountName(getPlayerAccount(player)) if not isElement(vehicle) then return end if not isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) then outputChatBox("You cannot enter this vehicle", player, 255, 0, 0) cancelEvent() end end addEventHandler("onVehicleStartEnter", root, restrictVehicleEntering)
  5. Client function enterveh () triggerServerEvent("check",localPlayer) txd = engineLoadTXD("infernus.txd", 411 ) engineImportTXD(txd, 411) dff = engineLoadDFF("infernus.dff", 411 ) engineReplaceModel(dff, 411) end addEventHandler ( "onClientPlayerVehicleEnter", getRootElement(), enterveh ) Server function permission (source) local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then end end addEvent("check",true) addEventHandler("check",root,permission) Try this
  6. Instead of being a "know-it-all" why don't you help him, give him an example of how to do what he requested when your "Scripting skill is 92%"? Anyway here, this should block all of the weapons you requested (Taken from the Wiki, i just added some more IDs) WeaponID = { [38] = true, --Minigun [35] = true, --Rocket Launcher [36] = true, --HS Rocker Launcher [24] = true, --Deagle [16] = true, --Grenade [27] = true, --Combat Shotgun [33] = true, --Country Rifle [29] = true, --MP5 [32] = true, --Tec9 [30] = true, --AK-47 } function blockWeaponsOnSwitch (previousWeaponID, currentWeaponID) if WeaponID[currentWeaponID] then toggleControl(source, "aim_weapon", false) toggleControl(source, "fire", false) else toggleControl(source, "aim_weapon", true) toggleControl(source, "fire", true) end end addEventHandler("onPlayerWeaponSwitch", root, blockWeaponsOnSwitch) Make sure to place this script in a SERVER-SIDE script/file I could not find a way to block vehicles, do you want to block vehicles from being spawned, or block them from being entered?
  7. As far as i'm concerned you don't even need the Server-side event to give money, you can give money to the player client-side function panel() w = guiCreateWindow(x,y,w,h,"money",false) b =guiCreateButton(x,y,w,h,"moneyb", true, w) end function trigger () if source == b then givePlayerMoney(10000, localPlayer) end end addEventHandler("onClientGUIClick", guiRoot, trigger) If you have further problems than this, please post the full code
  8. is there any errors in the /debugscript 3?
  9. function rewardOnWasted ( ammo, attacker, weapon, bodypart ) if ( attacker ) then givePlayerMoney ( attacker, 5000 ) else return end end I haven't tested this as i cannot (because my local server doesn't have players)
  10. Danz

    I Need help

    What line is this error on? EDIT: It's line 90 in the code i posted, and the error occurs when i attempt to buy Speed AND Crack together Edited the main post, sorry if i confused you, 226 is the bugged line WITH THE GUI, but this code doesn't have the GUI so, sorry
  11. Danz

    I Need help

    I am attempting to make a drug system to release on the MTA Community but there are some bugs which i cannot for the life of me find, here is the code; When i attempt to buy Heroin and Weed it just doesn't do anything, when i attempt to buy Crack AND Speed, it just says in the debug, "attempt to compare number with nil", and when i buy Steroids and God, it works as it triggers the server-side event (even tho it is not added yet, but works), thank you if you can help me
  12. You should add to the Tables section, an example, how to use tables in a function or something similar i hope you get what i'm trying to say lol
  13. This has been driving me nuts for a long ass time, but the problem that i am facing now is that i'm trying to balance weapons, changing weapons' accuracy, damage etc. Here is the thing, is there a way to change Minigun's accuracy to the point where the your crosshair's size increases, here is an example, i am currently shooting the AK-47, the crosshair increases due to it's weak accuracy, and the bullets "follow" the crosshair making a circle thingy (That probably didn't make sense) but this is not the same case as i'm firing the minigun and the crosshair doesn't increase, AND EVEN IF i use setWeaponProperty("minigun", "pro", "accuracy", 0.4) it only increases the crosshairs size, but the bullets still are in the middle of the cross, they don't "form" a circle like the AK does, this is really hard to explain, but you think what i want, i want to decrease minigun's just like the AK. I see no functions that do this on the MTA Wiki, only thing i saw was setWeaponProperty and that does jack shit, sorry for this kind of behavior, but this is really pissing me off. All i want to know is that, are there any functions that support this?
  14. So i got bored and decided to create the simple Mystery bag script, the way this works is that the bag will spawn around San Andreas (I only made 4 locations in the table for testing purposes, you can always add more locations if you want to (Just press F8, write getpos and press Enter, copy and paste it into the table)) Get it, and you'll get the following rewards; -Random Amount of Health; -Random Amount of Armour; -A Random Gun, and a random amount of ammo for that gun; -A Random wad of cash. NOTE: You are allowed to edit this script to your liking, but please, keep the credits, Thank You. Upcoming Projects; -Hijack Vehicle thingy; (Status: Done) -Briefcase thingy. (Status: Not Yet Done) P.S: I know i was really inactive since my last uploaded resource, but i'll try to keep you updated, cheers! Link: https://community.multitheftauto.com/in ... s&id=11612 --------------------------------------------------------------------------------------------------------------------------------------------- Hijack Vehicle; As promised in my last resource's description https://community.multitheftauto.com/in ... p;id=11612 a "project" was promised which is the "Hijack Vehicle", the way THIS works is that a random vehicle will spawn around San Andreas (20 locations are given in the table), when you enter the vehicle a delivery point will be placed on your map as a little truck (10 delivery locations), you will get rewarded the following; -Just $50,000 ;D although you can add some more rewards to this, it's your choice since you're free to edit this NOTE: You are allowed to edit this script to your liking, but please keep the credits, Thank You! Link: https://community.multitheftauto.com/in ... s&id=11616
  15. One bug i noticed is in The "Commands" section, in the "callbackFunct" Line 9, You get "attempt to compare nil with number", it should be like this if ( arg1 > 400 and arg1 < 611 ) then This is a great tutorial, but i wanted to take into notice this little problem, because most newbie scripters will not notice this. I'm out.
  16. Thanks for the tip Mrb, i'll include it in the next version Tho the problem is i'm still a newbie in scripting so, i will have to learn some more, thanks anyway.
  17. ughh, i'll give DX a try, since i never used it... but thanks for the feedback guys.
  18. Yo everyone, i was amazed by the feedback on my last resource that i went out and made this one, these are what most people call, Car Spawners. Let me jump into this. This resource adds vehicle spawning markers to every hospital in San Andreas. To use it, just go to a marker in whatever hospital, walk into it, and spawn your vehicle, really easy. What does this do? -Well first of all this script uses tables to store vehicle names in them, check spawner_c.lua to see more. -This resource spawns vehicles that are selected in the gridlist when you are in the appropriate marker. What is the purpose of this? -This script was intended for roleplay servers that want vehicle spawners in front of every hospital. Installation Guide: -Step 1: Locate your MTA San Andreas Folder. -Step 2: Open your downloaded Zip File. -Step 3: In your MTA Folder head over to your resources folder, which should be server\mods\deathmatch\resources. -Step 4: In the resource folder, just drop the Zip file in this very folder. -Step 5: Head into your server, press F8, and type "refresh" without the ". -Step 6: Then type start -Step 7: Enjoy. NOTE: I didn't copy this script from anybody. NOTE2: You are free to edit this script as long as you keep the credits. NOTE3: I forgot to add a screenshot to the script on the community. TIP: To add more vehicles, just add the names in the table, and do some copying and that's it (Idk if i explained that normally lol) Screenshot: http://postimg.org/image/onpvjubhb/ -Version 1.0 First Release. --Plans for future versions: -To add a command to destroy the spawned vehicle. Download Link: https://community.multitheftauto.com/in ... s&id=10686 If you liked this script, please, give me some feedback and maybe even suggestions on what to do, this is the second big thing i made by now. Im out. Peace
  19. client: function cVeh () local x, y, z = getElementPosition (source) carModel = guiComboBoxGetItemText ( combo, guiComboBoxGetSelected ( combo ) ) carName = getVehicleModelFromName( carModel ) if (carName) then triggerServerEvent("spawnvehicle", root, carModel, x, y, z) end end server: function create() createVehicle(carModel, x, y, z) end addEvent("spawnvehicle", true) addEventHandler("spawnvehicle", root, create) Bad argument @ createVehicle [Expected number at argument 1, got nil]
  20. This worked ^^ but i cannot enter the vehicle which is kinda a problem
  21. Ugh, didn't work... why? idk. I inserted what you posted, it didn't have any errors in the debug, nor did it do anything so...
  22. Oh you mean that each machine sells different stuff? sure that could work.
  23. EDIT AGAIN: I tried this. function createTheVehicle (veh) local x, y, z = getElementPosition (localPlayer) carModel = guiComboBoxGetSelected(combo, tonumber, carName) carName = getVehicleNameFromModel( carModel ) if getElementType (carModel) == "vehicle" then createVehicle(carModel, x, y + 2, z) end en I got this: Bad argument @ 'getElementType' [Expected element at argument 1, got number '1'
×
×
  • Create New...