knightscript

Members
  • Content count

    107
  • Joined

  • Last visited

Community Reputation

1 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. [HELP] Elevator Script (car goes through object)

    Hello, sorry for late reply, just tried using setElementFrozen, and it just freezes the vehicle and the elevator object goes through the car and goes up Hello, sorry for late reply, tried this yesterday and the problem persists Hello, I fixed it in a funny way, what I did is add a second elevator object, and made its alpha 0 (invisible) and attached it to the original elevator, it works now, I´ll leave the code for whoever needs it local elevatorcolshape = createColRectangle ( 1666, 1188, 30.6, 20.0 ) local elevator = createObject(3115, 1676.9, 1197.8, 24.2) local elevatorclone = createObject(3115, 1676.9, 1197.8, 24.2) attachElements(elevatorclone,elevator ) setElementAlpha(elevatorclone, 0 ) local elevatorSTATE = "techo" function elevator1337(source,command,goto ) local playeraccount = getPlayerAccount( source ) local accname = getAccountName( playeraccount ) local playerx,playery,playerz = getElementPosition( source ) local elevatorx,elevatory,elevatorz = getElementPosition(elevator) local distance = getDistanceBetweenPoints3D(playerx, playery, playerz, elevatorx,elevatory,elevatorz ) if (accname == "knight") then if (goto) then if getPedOccupiedVehicle ( source ) then outputDebugString( distance ) -- get the vehicle element local playerVehicle = getPlayerOccupiedVehicle ( source ) attachElements(playerVehicle, elevator,0,0,1) -- get the current freeze status setElementFrozen ( playerVehicle, true ) setTimer(setElementFrozen, 1950, 1, playerVehicle,false ) setTimer(detachElements, 1950, 1, playerVehicle,elevator ) end if (goto == "piso") then if (elevatorSTATE ~= "piso") then if (isElementWithinColShape(source, elevatorcolshape ) and playerz < 20) then outputChatBox( "[BASE 1337]: NO PUEDES LLAMAR EL ELEVADOR PORQUE TE VA A APLASTAR",source,255,0,0,true ) else -- local isinveh = isPedInVehicle( source ) -- if (isinveh) then -- attachElements(getPedOccupiedVehicle(source),elevator,0,0,15) -- end elevatorSTATE = "piso" outputChatBox( "[BASE 1337]: ELEVADOR MOVIENDOSE A: "..goto,source,0,255,0,true ) moveObject( elevator, 500, 1676.9, 1197.8, 18.2) setTimer(moveObject, 750, 1, elevator, 500, 1685.9, 1197.8, 18.2) setTimer(moveObject, 1500, 1, elevator, 500, 1685.9, 1197.8, 9.7) -- if (isinveh) then -- setTimer(detachElements,3000, 1,getPedOccupiedVehicle(source),elevator) -- end end else outputChatBox( "[BASE 1337]: EL ELEVADOR YA ESTA EN: "..goto,source,255,0,0,true ) end end if (goto == "techo") then if (elevatorSTATE ~= goto) then -- local isinveh = isPedInVehicle( source ) -- if (isinveh) then -- attachElements(getPedOccupiedVehicle(source),elevator,0,0,15) -- end elevatorSTATE = goto outputChatBox( "[BASE 1337]: ELEVADOR MOVIENDOSE A: "..goto,source,0,255,0,true ) moveObject( elevator, 500, 1685.9, 1197.8, 18.2) setTimer(moveObject, 750, 1, elevator, 500, 1676.9, 1197.8, 18.2) setTimer(moveObject, 1500, 1, elevator, 500, 1676.9, 1197.8, 24.2) -- if (isinveh) then -- setTimer(detachElements,3000, 1,getPedOccupiedVehicle(source),elevator) -- end else outputChatBox( "[BASE 1337]: EL ELEVADOR YA ESTA EN: "..goto,source,255,0,0,true ) end end end end end addCommandHandler("elev", elevator1337 ) Thanks for the help guys
  2. Hello, I am trying to make an elevator script using an createObject, moveObject and attachElements to attach a vehicle to the object, the problem is, the vehicle goes through the object even if I add an Z offset, this is my code: local elevatorcolshape = createColRectangle ( 1666, 1188, 30.6, 20.0 ) local elevator = createObject(3115, 1676.9, 1197.8, 24.2) local elevatorSTATE = "techo" function elevator1337(source,command,goto ) local playeraccount = getPlayerAccount( source ) local accname = getAccountName( playeraccount ) local playerx,playery,playerz = getElementPosition( source ) local elevatorx,elevatory,elevatorz = getElementPosition(elevator) if (accname == "knight") then if (goto) then if (goto == "piso") then if (elevatorSTATE ~= "piso") then if (isElementWithinColShape(source, elevatorcolshape ) and playerz < 20) then outputChatBox( "[BASE 1337]: NO PUEDES LLAMAR EL ELEVADOR PORQUE TE VA A APLASTAR",source,255,0,0,true ) else local isinveh = isPedInVehicle( source ) if (isinveh) then attachElements(getPedOccupiedVehicle(source),elevator) end elevatorSTATE = "piso" outputChatBox( "[BASE 1337]: ELEVADOR MOVIENDOSE A: "..goto,source,0,255,0,true ) moveObject( elevator, 1000, 1676.9, 1197.8, 18.2) setTimer(moveObject, 1250, 1, elevator, 1000, 1685.9, 1197.8, 18.2) setTimer(moveObject, 2500, 1, elevator, 1000, 1685.9, 1197.8, 9.7) if (isinveh) then setTimer(detachElements,3000, 1,getPedOccupiedVehicle(source),elevator) end end else outputChatBox( "[BASE 1337]: EL ELEVADOR YA ESTA EN: "..goto,source,255,0,0,true ) end end if (goto == "techo") then if (elevatorSTATE ~= goto) then local isinveh = isPedInVehicle( source ) if (isinveh) then attachElements(getPedOccupiedVehicle(source),elevator,0,0,3) end elevatorSTATE = goto outputChatBox( "[BASE 1337]: ELEVADOR MOVIENDOSE A: "..goto,source,0,255,0,true ) moveObject( elevator, 500, 1685.9, 1197.8, 18.2) setTimer(moveObject, 750, 1, elevator, 500, 1676.9, 1197.8, 18.2) setTimer(moveObject, 1500, 1, elevator, 500, 1676.9, 1197.8, 24.2) if (isinveh) then setTimer(detachElements,3000, 1,getPedOccupiedVehicle(source),elevator) end else outputChatBox( "[BASE 1337]: EL ELEVADOR YA ESTA EN: "..goto,source,255,0,0,true ) end end end end end addCommandHandler("elev", elevator1337 ) I would like to know if there is a way to avoid the car going through the item and fall, thanks
  3. A way to check if melee damage dealt with a weapon

    Alright, Ill try it out and let you know how it goes, thank you
  4. How to fix this in the pay script?

    Alright, one last thing, this should do the trick, replace this: amount = str:gsub('%A',amount) with this: amount = string.gsub('%A',amount)
  5. How to fix this in the pay script?

    Alright, try changing if (string.count(amount,"-")) then to this: if (string.count(tostring(amount),"-")) then
  6. How to fix this in the pay script?

    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
  7. 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!
  8. Vehicles moded

    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:
  9. Vehicles moded

    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:
  10. Gate Help

    What group system are you using?
  11. Gate Help

    Forgot that getAccountData needs an account, not an element, thank you @1LoL1
  12. Gate Help

    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
  13. [HELP] setTimer to check elementdata

    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!.
  14. [HELP] Output accounts by AccountData

    Thanks so much tosfera! always helping me out
  15. [HELP] Output accounts by AccountData

    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 )