Jump to content

knightscript

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by knightscript

  1. 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!
  2. 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:
  3. 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:
  4. What group system are you using?
  5. Forgot that getAccountData needs an account, not an element, thank you @1LoL1
  6. 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
  7. 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!.
  8. Thanks so much tosfera! always helping me out
  9. 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 )
  10. 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
  11. 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!.
  12. Hello, I have a doubt, i would like to know if there is a way to output the account name of all accounts that have for example the AccountData "admin", if there is a way what functions should I use, thanks!
  13. Any errors on debugscript? What im thinking is maybe you can move the convertNumber function over the rest of the script,
  14. "Try" words didn't work with me. He is gonna try to help you, he doesnt have an obligation to do it, so if "try" doesnt work for you then hire a scripter
  15. You have the simplest example on the website: function convertPlayerMoney() local pMoney = getPlayerMoney() --get the players money local convertedMoney = convertNumber(pMoney) --converts it and saves it in variable outputChatBox(convertedMoney) --outputs it end addCommandHandler("money", convertPlayerMoney) You would just have to change the local pMoney to get the value of the vehicle, and that would be it, but if you need more help you can post the code,
  16. you mean you want to convert any number that has 3 digits or more?
  17. Puedes utilizar este resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=488
  18. No se si sea lo que estas buscando pero puedes ver mis tutoriales aqui: Auto privado por grupo ACL Auto privado por usuario
  19. Hay 2 formas de hacer lo que quieres, una sería setAccountData para guardar la información en la cuenta, y otra sería setElementData , esta sería para elementos, como dice la propia funcion, pero por ahora te mostraré como se hace con AccountData, function setheads( source, cmd, value ) local playerAccount = getPlayerAccount(source) local myheads = setAccountData(playerAccount,"headshots",tonumber(value)) if (myheads == true) then outputChatBox("Éxito") end end addCommandHandler("setheads",setheads) Este comando lo que hace es que al poner /setheads 20, te pone en tu cuenta en el campo "headshots" la cantidad de 20, sin embargo hay otra manera de hacer esto: function addtokens(source, cmd, target, amount) local targetPlayer = getPlayerFromName ( target ) if (targetPlayer) and (amount) then local targettokens = getElementData(targetPlayer,"tokens") local thetokens = targettokens + amount local settargettokens = setElementData(targetPlayer,"tokens",thetokens) end end addCommandHandler("addtokens",addtokens) este de aquí lo que hace es que al poner /addtokens (nombre del jugador) (cantidad) agrega la cantidad de "tokens" que definas, ejemplo: /addtokens Knight 30 (agregará a el jugador conectado "Knight" la cantidad de 30 tokens) function settokens(source, cmd, target, amount) local targetPlayer = getPlayerFromName ( target ) if (targetPlayer) and (amount) then local targettokens = getElementData(targetPlayer,"tokens") local thetokens = amount local settargettokens = setElementData(targetPlayer,"tokens",thetokens) end end addCommandHandler("settokens",settokens) este lo que hace es remplaza el valor de "tokens" al que tu quieras, se utiliza igual que el anterior, solo que este en vez de agregar, lo remplaza.
  20. Adding you, thanks, what i mean is, why is it showing what I added on my meta "clan" and "status", and its showing another field when i change it to the script´s name: BASE-AEROLV-final.clan? Thanks,
  21. Hello, I´m trying to edit a setting that I added to my resource, but i have a problem, the field is somehow "duplicating"? here is a picture of what I mean: I dont know why this happens, it happens only with the resources I create, my meta file is this: <meta> <info author="KnightScript" type="map" name="Base-AEROLV1.0" /> <settings> <setting name="*clan" value="Ninguno" /> <setting name="*status" value="off" /> </settings> <map src="Base-AEROLV.map" dimension="0"></map> <script src="puerta.lua" type="server" /> <script src="mapEditorScriptingExtension_s.lua" type="server"></script> <script src="mapEditorScriptingExtension_c.lua" type="client" validate="false"></script> </meta> Thanks guys!.
  22. Indeed that is the function, here is a small example that will start playing "mymusic.mp3" when the player connects: function onplayerjoin (source) local sound = playSound("mymusic.mp3") setSoundVolume(sound, 0.3) -- set the sound volume to 30%, it can be less if its a background music end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), onplayerjoin) --add the event handler and of course you will want to add this to your meta file: <file src="mymusic.mp3" />
  23. Yes, it is equivalent, If you create object on server side - synced for all players. If you create on client side - synced only for local player. You CAN create an object on client side but would affect sync i think, so my recommendation would be to make it server-sided.
  24. Maybe changing the id´s? im not understanding quite well, if you can be more detailed, perhaps a picture?.
×
×
  • Create New...