Jump to content

ShayF2

Members
  • Posts

    230
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ShayF2

  1. ShayF2

    My Code

    This isn't a help thread, more of an information thread, considering I post a lot on here to help people. I want everyone to know that when I provide code that it is NOT tested, unless I say it is in the thread. I do use forms of oop, and advanced/organized code, without unnecessary spaces and using ' instead of " quotes when working with strings. This is professional styled lua code, however it is taught in coding schools when using tabs to space the code that you should use 2 spaces instead of a tab and also use spaces when separating elements commonly after commas, I do not do either of these, I use tabs in order to make the code fast and simple to edit, and I do not use spaces after separating elements to make the code as compact and organized as possible. If I do not post code to help you, it will be a brief comment (possibly with a redirection) due to lack of information and or too much to decipher. I am good at coding lua, I'm not by any means a professional, but I am good. If you need help just let me know. I will not code big scripts, only parts of scripts. You can contact me by email, skype, or discord. I made this thread because many people have been making rude comments towards me and I felt like justifying. Have a nice day everyone.
  2. I'd save player data to the sql and use the save's index number as the players id.
  3. You can only use unpack with a function that allows multiple OPTIONAL values. Maybe this will work better for you. local position = { {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 getRandomPosition() local r = math.random(#position) return position[r][1],position[r][2],position[r][3] end function myteleport(player,command) local element local x,y,z = getRandomPosition() local vehicle = getPedOccupiedVehicle(player) if vehicle then element = vehicle else element = player end if isElement(element) then setElementPosition(element,x,y,z) end end addCommandHandler('test',myteleport)
  4. addEventHandler('onClientPedDamage',root,function(attacker,weapon,bodyPart,loss) if loss then local boss = getElementData(source,'boss') if boss then -- if you want to get its actual data.. if boss == 'yes its the :Oin boss xD' then cancelEvent() setElementHealth(source,(getElementHealth(source)-(loss%5))) -- this is if you want the boss to SLOWLY lose health.. end end end) --[[ getElementData(element element, string dataName [, inherit = true/false]) setElementData(element element, string dataName, var value [, bool sync = true/false]) ]] Everything inside [] are optional arguments, the rest is required (usually). Note that it is Element First, meaning ped, player, vehicle, whatever you are targeting.. Then after element is the data name..
  5. ShayF2

    Help me

    Check a decompiled version of MTA DayZ for reference on element data.
  6. ShayF2

    Vehicle shot

    addEventHandler('onClientPlayerWeaponFire',root,function(weapon,ammo,aic,x,y,z,hitElement) if hitElement then if getElementType(hitElement) == 'vehicle' then local components = getVehicleComponents(hitElement) for i=1,#components do local 2x,2y,2z = getComponentWorldPosition(components[i]) if x == 2x and y == 2y and z == 2z then return components[i] end end end end end) function getComponentWorldPosition(vehicle,component) local m = getElementMatrix(vehicle) local x,y,z = getVehicleComponentPosition(vehicle,component) local wX = x*m[1][1]+y*m[2][1]+z*m[3][1]+m[4][1] local wY = x*m[1][2]+y*m[2][2]+z*m[3][2]+m[4][2] local wY = x*m[1][3]+y*m[2][3]+z*m[3][3]+m[4][3] return wX,wY,wZ end This only works if you shoot dead center of the component. So you may have to modify it to do what you want. This is as far as I can help. Sorry.
  7. Use an app called Solo Learn, for sql teachings, the class is short and fast. It tell's everything about sql. This might help you. SELECT password,username,user_id,token FROM users WHERE username = ?
  8. Use source, source is the player...
  9. function compareStringToNumber(text) if text then local number = tonumber(text) if number then return number else return false end end end -- Then use it like so local comparedNumber = compareStringToNumber('250') --[[ comparedNumber is now 250, instead of '250' This will return false instead of nil so that no errors are produced. If you try compareStringToNumber('text') or compareStringToNumber('this is text') then it will return false You can also use this as a check, Like shown below. --]] local num = '5000' if compareStringToNumber(num) then outputChatBox(num..' is a number!') end
  10. nothing is outputted to chatbox? or what?
  11. I think it would be better to replace a model that doesn't have collisions and detects when your player hits it. Much more simple than coding 40 lines of dx.
  12. ShayF2

    Help Me!!

    local daily = {} addEventHandler('onPlayerLogin',resourceRoot,function runEvent() local serial = getPlayerSerial(source) if not daily[serial] then daily[serial] = false end if daily[serial] == false then daily[serial] = true local newMoney = math.random(1000) setPlayerMoney(source,getPlayerMoney(source)+newMoney) outputChatBox('You have received your daily reward of $'..newMoney..' enjoy!',source,0,255,255) setTimer(function() daily[serial] = false end,86400000,1) end end) 86,400,000 is milliseconds, it represents a day. 1 second = 1,000 milliseconds 1 minute = 60 seconds 1 hour = 60 minutes 1 day = 24 hours 1,000*60*60*24 = 86,400,000
  13. if ur talkin the mta main menu then ur :Oed, nothing u can do mate. EXCEPT IMPORT THEMES BRO. CMON..
  14. Simple solution, hire a cardboard scripter (me) for about 80 or so dollars/day.
  15. Well son. See a forum is simply a board. A board to post all of your fancy things. And see, to make it work with MTA. You need a special type of board. This special type of board is known as The Great Platinum Grade Spray Painted Aluminum Finished Laminated and Coated With 3 Layers of Paper, Cardboard. And see my friend, I've used this board all of my life. I use it when I script. I use it to watch Cardboard Youtube. I use it to look up things on Cardboard Google. I have pictures all over my Cardboard Profile of all my fancy Cardboard. I even have a 5 thousand dollar portable Cardboard gaming rig. I'd like to show you exactly what it is that I am talking about. I wish you the best of luck with your cardboard adventure. ~Shay
  16. ShayF2

    [Help] With text

    WELL SINCE THE DANG FLABBIN TIMER DOESN'T WANNA DIE, I WANT SOME FRIGGIN CARDBOARD MY BRUTHA. GOT SOME CARDBOARD I CAN BORRA FOR A MIN? I NEED SOME CARDBOARD FOR MY COMPUTER SO THAT IT CAN PRINT MORE CARDBOARD SO THAT I CAN WIPE MY BOOTY IN DA MORNIN...
  17. ARE YOU EXPORTING CARDBOARD?!?
  18. ShayF2

    antiban

    Go script lua on a cardboard box. Sometimes writing it down right in front of your eyes with nice ole sharpie will give you some neat inspiration. Myself, I like to store all of my awesome scripting work from within a cardboard hard drive box. So that when I log into my cardboard computer, the thing fires right up. And when it doesn't I throw it all in the woodstove and start over again with a sharpie and a pair of scissors. If only you could understand the importance and efficiency of a nice vaneer of platinum grade spray painted cardboard then you could maybe, just maybe get on my level. I receive my professionalism from my spiritual cardboard gods. My inspiration originates from the first cardboard of its time. I will show you the ways of the cardboard. My good friend please focus your attention to my platinum grade brown spray painted rare piece of artwork cardboard computer where all of my scripting skill started. Good day.
  19. You may add my discord as well, ShayF#0259 And I forgot to change this but replace your wasted function with this. Sorry about that. function wasted() local var = sounds[getElementModel(localPlayer)] or sounds['none'] local rs = getRandom(var) local sound = playSound(var[rs][1],false) setSoundVolume(sound,var[rs][2]/100) end
  20. ShayF2

    ped color

    Yes, simply attach a light element to the player, instead of using a shader. I think that would help you.
  21. No problem mate, I hope you enjoy. If you need any other help you can contact me by email or by Skype. Email: [email protected] Skype: cemour.burkoff Have a nice day, Shaio Fencski
  22. Alright I've finished making it for specific skins, here's the template, I hope this works for you. local sounds = {} souds['none'] = {-- this is for if the player does not have a skin that you manually inputted here. {'sound2.wav',100}, {'sound3.wav',100}, {'sound4.wav',100}, {'sound5.wav',100} } sounds[131] = {-- you can make more of these for each skin, just put the skin id within the [] {'The_Incredible_Coneman_Death1.wav',100}, {'The_Incredible_Coneman_Death2.wav',100}, {'The_Incredible_Coneman_Death3.wav',100} } local previous function getRandom(t) local r = math.random(1,#t) if r ~= previous then previous = r return r else getRandom(t) end end function wasted() local var = sounds[getElementModel(localPlayer)] or sounds['none'] local rs = math.random(1,#var) local sound = playSound(var[rs][1],false) setSoundVolume(sound,var[rs][2]/100) end addEventHandler('onClientPlayerWasted',localPlayer,wasted)
  23. try this function loadBrowser() if source == theBrowser then loadBrowserURL(source,'http://www.youtube.com') showCursor(true) win = true addEventHandler('onClientBrowserDocumentReady',resourceRoot,SetURL) end end addEventHandler('onClientBrowserCreated',resourceRoot,loadBrowser)
  24. I'm sorry I'm quite blind lol. I found a mistake in my code, I have fixed it here. It was a really simple fix and explains why it wasn't working. Please try this code. local sounds = { --Format: {sound/url,volume(0-100)}, {'The_Incredible_Coneman_Death.wav',100}, {'sound2.wav',100}, {'sound3.wav',100}, {'sound4.wav',100}, {'sound5.wav',100}-- always leave the last one without a comma } -- this is our function to get random sound, and avoid getting the same on as the previous.. local previous function getRandom(t) local r = math.random(1,#t) if r ~= previous then previous = random return random else getRandom(t) end end function wasted() local rs = getRandom(sounds)-- we use the function we just created and input the sounds table. -- it will return a valid index number different from the previous one.. local sound = playSound(sounds[rs][1],false)-- so we use the first variable, the sound url to create the sound. setSoundVolume(sound,sounds[rs][2]/100)-- and the second variable to set the volume. -- divide the volume by 100 so that mta reads it as the regular decimal value end addEventHandler('onClientPlayerWasted',localPlayer,wasted) After I get home I will work on an advanced way for skins and their own sounds.
  25. Looked into the code, research SQL commands and then rewrite line 96 on server side. Good Luck.
×
×
  • Create New...