• Announcements

    • jhxp

      Forums are online again after a maintenance.   18/03/17

      MTA Forums maintenance is completed, although some automatic time-heavy tasks are still in process and will be finished eventually in background. Expect some features such as Forum Search to not display all results until all processes are finished. Please let us know if you spot a forum feature that worked correctly before the maintenance but does not work anymore now. Thanks. --MTA Team
    • jhxp

      Multi Theft Auto: San Andreas 1.5.4 is out!   21/04/17

      Click the link in the announcement for more details.  

knightscript

Members
  • Content count

    105
  • Joined

  • Last visited

Community Reputation

0 Neutral

About knightscript

  • Rank
    Punk-@ss B*tch
  • Birthday 17/11/99

Details

  • Gang
    1337
  • Location
    New Hampshire
  • Occupation
    Web Programmer for living
  • Interests
    Gaming, Developing stuff, Gaming
  1. Alright, Ill try it out and let you know how it goes, thank you
  2. Alright, one last thing, this should do the trick, replace this: amount = str:gsub('%A',amount) with this: amount = string.gsub('%A',amount)
  3. Alright, try changing if (string.count(amount,"-")) then to this: if (string.count(tostring(amount),"-")) then
  4. You could use string.count to check if "amount" contains a negative "-" symbol, and use Split to remove it from the string, EDIT: function string.count (text, search) if ( not text or not search ) then return false end return select ( 2, text:gsub ( search, "" ) ); end addCommandHandler("pay", function(player, cmd, name, amount) local amount = tonumber(amount) if name and amount then local target = findPlayer(name) local money = getPlayerMoney(target) if (string.count(amount,"-")) then amount = str:gsub('%A',amount) end if money >= amount then takePlayerMoney(player, amount) givePlayerMoney(target, amount) outputChatBox("#FFffFF Átutaltál neki: #c8c8c8" .. getPlayerName(target) .. " #0088ff" .. amount .. " Forintot.", player, 0, 255, 0, true) outputChatBox("#c8c8c8 " .. getPlayerName(player) .. " #FFffFFutalt neked #0088ff" .. amount .. " Forintot.", target, 0, 255, 0, true) else outputChatBox("#FFffFF Nincs elég pénzed.", target, 255, 0, 0, true) end end end ) Try this
  5. Hello, I have been looking for a way to check if melee damage was dealt with a weapon, because I want to add a gears of war animation when hit with a weapon, I was looking at the MTA Damage Types, found this: Does anyone have an Idea what can I use to accomplish this? thanks!
  6. Actually, its very simple to do this, you basically need 4 files: -meta.xml (where you define where your vehicle files are) -vehicle.dff -vehicle.txd -replace.lua (where you define the vehicle you want to replace) I will show you the basic meta file: "vehicle.txd" /> "vehicle.dff" /> file: replace.lua txd = engineLoadTXD("vehicle.txd") --import the file engineImportTXD(txd, 602) --vehicle ID you want to modify (you can see the IDS here: [url=https://wiki.multitheftauto.com/wiki/Vehicle_IDs]https://wiki.multitheftauto.com/wiki/Vehicle_IDs[/url]) dff = engineLoadDFF("vehicle.dff", 602) --import the other file engineReplaceModel(dff, 602) --vehicle ID you want to modify (you can see the IDS here: [url=https://wiki.multitheftauto.com/wiki/Vehicle_IDs]https://wiki.multitheftauto.com/wiki/Vehicle_IDs[/url]) and of course you want to create a folder, and put your files in there, here is an example of how your folder would look like:
  7. Actually, its very simple to do this, you basically need 4 files: -meta.xml (where you define where your vehicle files are) -vehicle.dff -vehicle.txd -replace.lua (where you define the vehicle you want to replace) I will show you the basic meta file: "vehicle.txd" /> "vehicle.dff" /> file: replace.lua txd = engineLoadTXD("vehicle.txd") --import the file engineImportTXD(txd, 602) --vehicle ID you want to modify (you can see the IDS here: [url=https://wiki.multitheftauto.com/wiki/Vehicle_IDs]https://wiki.multitheftauto.com/wiki/Vehicle_IDs[/url]) dff = engineLoadDFF("vehicle.dff", 602) --import the other file engineReplaceModel(dff, 602) --vehicle ID you want to modify (you can see the IDS here: [url=https://wiki.multitheftauto.com/wiki/Vehicle_IDs]https://wiki.multitheftauto.com/wiki/Vehicle_IDs[/url]) and of course you want to create a folder, and put your files in there, here is an example of how your folder would look like:
  8. What group system are you using?
  9. Forgot that getAccountData needs an account, not an element, thank you @1LoL1
  10. well you can check the group using getAccountData, for example if your group system records the clan in an accountdata called "dayzclan" you can use: local playerclan = getAccountData(source,"dayzclan") and then compare if the clan is allowed to open the gate: if (playerclan == "exampleclan") then --whatever end For the distance thing, you can use what our friend here suggested, which is getDistanceBetweenPoints3D, an example, without me testing it, would be using the X Y and Z of the gate, and compare it to the players location: local plx,ply,plz = getElementPosition(source) local distance = getDistanceBetweenPoints3D ( 8378,1064.3000488281,1771,19.700000762939, plx,ply,plz ) if (distance < "50") then --rest of the code end
  11. Hello, I am trying to make a function which will check if the player´s element data is over 0, and if its not over 0 then it will kill the player, this is what i´ve made so far: function checkblood(source) local sourceAccount = getPlayerAccount ( source ) if isGuestAccount ( sourceAccount ) then else local blood = getElementData(source, "health" ) if (blood <= "0") then outputChatBox( "SANGRE NEGATIVA",getRootElement(),255,0,0 ) end end end setTimer(checkblood, 1000, 0, source) I have never used setTimer before, and because of that I dont know how can I achieve this, is there any other good alternative? thank you!.
  12. Thanks so much tosfera! always helping me out
  13. Thanks tosfera, one last thing, this is my code: function printAllData ( thePlayer ) local allAccounts = getAccounts(); for i = 1,#allAccounts do local account = getAccountName( allAccounts[i] ) local text = getAccountData (allAccounts[i], "antiheadshot" ); outputChatBox("ACCOUNT: "..account.."RESULT: "..text) end end addCommandHandler( "getall", printAllData ) I would like to show the account that has the account data, this shows the first entry but it gives me an error on debugscript: [13:17:55] ERROR: [gameplay]/headshot/vipantiheadshot.lua:33: attempt to concate nate local 'text' (a boolean value) Thanks!. EDIT: It was happening because an account doesnt have that accountdata, is there a way to skip it or just show N/A for example? thanks!. EDIT: Fixed it, hahaha, i just added an else, which shows N/A instead of the result of the local "text", here is my full code for someone that needs it: function printAllData ( thePlayer ) local allAccounts = getAccounts(); for i = 1,#allAccounts do local account = getAccountName( allAccounts[i] ) local text = getAccountData (allAccounts[i], "antiheadexpira" ); if (text) then outputChatBox("cuenta: "..account.."TEXTO: "..text) else outputChatBox("cuenta: "..account.."TEXTO: N/A") end end end addCommandHandler( "getall", printAllData )
  14. Hello, going back to the output thing, I have never used "FOR" before, I´ve searched on google but haven´t found anything, can you give me a small example or a usage tutorial? thanks. EDIT: Found this tutorial: https://wiki.multitheftauto.com/wiki/GetAllElementData gonna adapt it to what I need, thanks
  15. Thanks @tosfera, one more question, is there a way to set an account data of an account that is offline? this is what I am trying: local offlineacc = getAccount(online) local antihead = setAccountData( offlineacc, "antiheadshot", "on" ) local antiheadexpire = setAccountData( offlineacc, "antiheadexpira", ending) but i think the problem is I need to write the password in, and I dont have that, thanks EDIT: just checked out "password" is an optional argument, but I am getting this error on debugscript: [12:40:30] WARNING: [gameplay]/headshot/vipantiheadshot.lua:15: Bad argument @ ' setAccountData' [Expected account at argument 1, got boolean] LINE 15: local antiheadexpire = setAccountData( offlineacc, "antiheadexpira", ending) EDIT: fixed it, i was passing the wrong variable, in getAccount, thanks!.