Jump to content

Xabache

Members
  • Posts

    134
  • Joined

  • Last visited

Everything posted by Xabache

  1. My joinquit with the wiki for fileCreate attached. Produces no file in the resource directory. Ideas? addEventHandler('onClientPlayerJoin', root, function() outputChatBox('JOIN: ' .. getPlayerName(source) .. '', 0, 128, 255) local newFile = fileCreate("test.txt") -- attempt to create a new file if (newFile) then -- check if the creation succeeded fileWrite(newFile, "This is a test file!") -- write a text line fileClose(newFile) -- close the file once you're done with it end end )
  2. Caveat Emptor = Let the buyer beware (Not Seller be forced to conform so the buyer may remain naive.) If you download a public resource that comes luac'd on both sides and post it on your server it is at your own risk. Or better, could come with an MTASA disclaimer on loading, and even on player join, "Warning: this script is compiled without our oversight, it may contain malicious code, you should absolutely beware of this script!!" A simple clear protection that would not unduly violate the security of good natured, script writing, remote server owners as your current policy does; that rather than warn the buyer of this age old wisdom to be wary of things unknown, MTASA has chosen the big government approach... regulation without justification. You mandate any luac'd file must go through you because the buyer can't be bothered to be aware. Everyone online is aware of everything all the time. Don't impose regulation without justification. Your point is invalid. I'll hear greater cause if such exists... Until such time there is no valid justification to require server side MTASA approved luac'd files that I know of. This rule stands as an unjustifiable imposition threatening the Intellectual Property Rights of the author to propagate naivety amongst potential users.
  3. Does the https://luac.multitheftauto.com/ compiling rule for MTA apply only to client side scripts? By my understanding, this rule forces the script writer to use luac.mtasa as the only compiler -- to protect mta users from potentially malicious scripts by automatically reviewing them beforehand or forcing them to remain open source and viewable to all users. But server side scripts would suffer no such scrutiny nor need for luac'ing except where remote hosting came into consideration and security was your average MTA Sever owner's greatest concern, for which having mtasa luac'd client side scripts and third party server side luac'd scripts would seem ideal. Giving no one but the author the chance to ever have both sets in lua format. So does your client prevent third party luac'd files from running server side only, and if so, what potential security threat to MTA users justifies this?
  4. To locate maps use /sp and type in coordinates. Very nice fire station in LS, thanks Wafflecakes!
  5. Very nice code^^ ..almost there. The Ped has no weapon or ammo. It is just a ped on whose death reveals a ""hidden"" weapon that is the same as the one the player used to kill it. So a weaponless ped is killed, to reveal it has 50 ammo of weaponID X == the player's gun. In otherwords, I kill it with a minigun, it gives me minigun ammo. I kill it with a knife it gives me a knife. It is a complex problem with a simple solution, all i need is for the server to tell me the players weapon ID. How?
  6. Sorry, but that wasn't at all my question. And I see your request for greater specifics now. When the player, kills a ped onPedWasted (serverside only) I want a weapon to be dropped by that ped. I want that weapon to be the same as the weapon used by the player to kill them. So I need to know, what weapon is in the hand of the player when the onPedWasted event occurs serverside for which getPedWeapon(source) and getPedWeapon(player) both return 0 despite the weapon of choice being the minigun. This base code could be used to test it. all i need is the player weaponID on wasted function createMoney(player) local x, y, z = getElementPosition(player); local x1, y1, x2, y2; x1 = (x-2)+(math.random()*4); y1 = (y-2)+(math.random()*4); x2 = (x-2)+(math.random()*4); y2 = (y-2)+(math.random()*4); local moneyAmmount = getPlayerMoney(player); moneyAmmount = math.floor(moneyAmmount/2); takePlayerMoney(player, moneyAmmount); moneyAmmount = math.floor(moneyAmmount/2); setElementData(createPickup(x1, y1, z, 3, 1212), "ammount", moneyAmmount); setElementData(createPickup(x2, y2, z, 3, 1212), "ammount", moneyAmmount); end function moneyPickupHit(player) local money = getElementData(source, "ammount"); if money then givePlayerMoney(player, money); destroyElement(source); end end function playerJustGotDied(ammo, attacker, weapon, bodypart) if (isElement(attacker)) then createMoney(source) end end addEventHandler("onPickupUse", getRootElement(), moneyPickupHit); addEventHandler("onPlayerWasted", getRootElement(), playerJustGotDied);
  7. Thanks for the advice will clean up those Sets. And not working here, maybe posting your test code would help me.
  8. outputChatBox ( "play " .. getPedWeapon(player) ) returns play 0 regardless of weapon
  9. This is entirely serverside. From a server side event how do I get the players weapon id in hand?
  10. This creates a pickup on the death of a ped, so element data is being set so the pickup has the name "weapon" so that onpickuse and pickuphit know what to do. and the ammo value 50-100. addEventHandler("onPickupUse", getRootElement(), PickupHit); The part that creates this serverside event is onpedwasted triggering this money creator is expanded to also do weapons. All i need is to know the weapon in hand of the player who wasted the ped. function createMoney(player) local x, y, z = getElementPosition(player); local x1, y1, x2, y2; x1 = (x-1)+(math.random()*1); y1 = (y-1)+(math.random()*1); x2 = (x-2)+(math.random()*2); y2 = (y-2)+(math.random()*2); x3 = (x-3)+(math.random()*3); y3 = (y-3)+(math.random()*3); x4 = (x-4)+(math.random()*4); y4 = (y-4)+(math.random()*4); x5 = (x-5)+(math.random()*5); y5 = (y-5)+(math.random()*5); local money = math.random( 1, 8 ); -- locaPlayer player if money > 3 then local am1 = createPickup(x1, y1, z, 3, 1212) setElementData(am1, "amount1", math.random( 1, 25 ) ); setTimer(function() if (isElement(am1)) then destroyElement(am1) end end, 10000, 1) if money > 4 then local weaptype = math.random(1,10) if weaptype == 1 then local we = createPickup(x5, y5, z, 2, myRandom()) setElementData(we, "weapon", math.random( 50, 100 ) ); setTimer(function() if (isElement(we)) then destroyElement(we) end end, 10000, 1) else outputChatBox ( "play " .. getPedWeapon(player) ) local we = createPickup(x5, y5, z, 2, getPedWeapon(playerSource) ) setElementData(we, "weapon", math.random( 50, 100 ) ); setTimer(function() if (isElement(we)) then destroyElement(we) end end, 10000, 1) Specifically this bit: local we = createPickup(x5, y5, z, 2, getPedWeapon(playerSource) ) setElementData(we, "weapon", math.random( 50, 100 ) ); setTimer(function() if (isElement(we)) then destroyElement(we) end end, which works fine when it works like this: local we = createPickup(x5, y5, z, 2, myRandom()) setElementData(we, "weapon", math.random( 50, 100 ) ); setTimer(function() if (isElement(we)) then destroyElement(we) end end, 10000, 1)
  11. and now an unrelated question... i want this to create the weapon in hand of the player instead of a random weapon setElementData(createPickup(x5, y5, z, 2, getPedWeapon( client ) ), "weapon", math.random( 50, 100 ) );
  12. Not working... setElementData(createPickup(x5, y5, z, 2, getPedWeapon( client ) ), "weapon", math.random( 50, 100 ) );
  13. I want this money to disappear 15 seconds after being created, like in the real game. How do I make it timeout in the easiest manner? local money = math.random( 1, 8 ); if money > 3 then setElementData(createPickup(x1, y1, z, 3, 1212), "amount1", math.random( 1, 25 ) );
  14. Xabache

    Telewire

    Am trying to remove telephone wires. Have tried this and this nothing is working... removeWorldModel(7646,10000,0,0,0) removeWorldModel(11460,10000,0,0,0) removeWorldModel(17046,10000,0,0,0) removeWorldModel(7075,10000,0,0,0) removeWorldModel(7076,10000,0,0,0) removeWorldModel(7077,10000,0,0,0) removeWorldModel(7078,10000,0,0,0) removeWorldModel(7079,10000,0,0,0) removeWorldModel(7080,10000,0,0,0) removeWorldModel(7081,10000,0,0,0) removeWorldModel(7082,10000,0,0,0) removeWorldModel(7083,10000,0,0,0) removeWorldModel(7084,10000,0,0,0) removeWorldModel(7085,10000,0,0,0) removeWorldModel(7086,10000,0,0,0) removeWorldModel(7087,10000,0,0,0) removeWorldModel(13861,10000,0,0,0) removeWorldModel(13862,10000,0,0,0) removeWorldModel(13863,10000,0,0,0) removeWorldModel(13864,10000,0,0,0) removeWorldModel(17429,10000,0,0,0) removeWorldModel(17430,10000,0,0,0) removeWorldModel(17431,10000,0,0,0) removeWorldModel(17432,10000,0,0,0) removeWorldModel(18470,10000,0,0,0) removeWorldModel(18471,10000,0,0,0) removeWorldModel(18472,10000,0,0,0) removeWorldModel(7646,10000,0,0,0) removeWorldModel(11460,10000,0,0,0) removeWorldModel(17046,10000,0,0,0) for i= 7075,7087 do removeWorldModel(i,10000,0,0,0) end for i= 13861,13864 do removeWorldModel(i,10000,0,0,0) end for i= 17429,17432 do removeWorldModel(i,10000,0,0,0) end for i= 18470,18472 do removeWorldModel(i,10000,0,0,0) end Yet this easily removes buildings removeWorldModel(16138,1000,-300,1556,75) for i= 16615,16617 do removeWorldModel(i,10000,0,0,0) end
  15. Remember those old favorites? Golden Oldies weren't they? MTA resources seem to store all their info in SQlite, yes? In my world we used far more simple systems to write ordinary data to ordinary files... write writeini fwrite readini read & fread Did I miss this part of lua/mta? Can I simply write info to a normal .txt .ini file and store it openly where it is easy to access and control? If so, how? If not, why not--and what otherwise comes closer to IRC's ideal than MTA's encoding it into a corruptible alien language impossible to work with.... I mean SQlite
  16. Client: local vehicleHealth = getElementHealth ( vehicle ) / 10 triggerServerEvent( "takeRepairMoney", getLocalPlayer(), resourceRoot, vehicleHealth - 100 ) Server: function takeRepairMoney ( thePlayer, command, amount ) -- when the takeRepairMoney command is called takePlayerMoney ( thePlayer, tonumber(amount) ) -- take the amount of money from the player end addCommandHandler ( "takeRepairMoney", takeRepairMoney ) -- add a handler function for the command "takecash" It displays vehicle health but wont charge accordingly. It gives the error: [2015-02-16 06:53:48] ERROR: Client (=[T]=) triggered serverside event takeRepairMoney, but event is not added serverside. Yet it is...
  17. From Freeroam: --------------------------- -- Weapon window --------------------------- function addWeapon(leaf, amount) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf then return end end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Give weapon', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Weapon', attr='name'} }, rows={xml='weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='add', onclick=addWeapon}, {'btn', id='close', closeswindow=true} } } function giveWeaponCommand(cmd, weapon, amount) weapon = tonumber(weapon) or getWeaponIDFromName(weapon) if not weapon then return end amount = amount and tonumber(amount) or 500 server.giveMeWeapon(math.floor(weapon), amount) end addCommandHandler('give', giveWeaponCommand) addCommandHandler('wp', giveWeaponCommand) I've divided my weapons .xml into categories <catalog type="weapon"> <group name="Hand"> <weapon id="1" name="Brass knuckles" /> <weapon id="5" name="Baseball bat" /> <weapon id="15" name="Cane" /> <weapon id="9" name="Chainsaw" /> <weapon id="2" name="Golf club" /> <weapon id="7" name="Pool cue" /> <weapon id="8" name="Katana" /> <weapon id="4" name="Knife" /> <weapon id="3" name="Nightstick" /> <weapon id="6" name="Shovel" /> </group> <group name="Special"> <weapon id="14" name="Flowers" /> <weapon id="43" name="Camera" /> <weapon id="42" name="Fire extinguisher" /> <weapon id="45" name="Infrared goggles" /> <weapon id="44" name="Night vision goggles" /> <weapon id="46" name="Parachute" /> </group> <group name="Everyone"> <weapon id="24" name="Desert eagle" /> <weapon id="22" name="Pistol" /> <weapon id="23" name="Silenced" /> <weapon id="32" name="TEC-9" /> <weapon id="17" name="Tear gas" /> </group> <group name="Members"> <weapon id="26" name="Sawn-off shotgun" /> <weapon id="25" name="Shotgun" /> <weapon id="28" name="Uzi" /> <weapon id="30" name="AK47" /> <weapon id="33" name="Country sniper" /> <weapon id="37" name="Flame thrower" /> <weapon id="18" name="Molotov" /> </group> <group name="Supporters"> <weapon id="27" name="SPAZ-12" /> <weapon id="29" name="MP5" /> <weapon id="31" name="M4" /> <weapon id="34" name="Sniper" /> <weapon id="16" name="Grenade" /> </group> <group name="Moderators"> <weapon id="35" name="Rocket launcher" /> <weapon id="36" name="Heat seeking RPG" /> <weapon id="38" name="Minigun" /> <weapon id="39" name="Satchel" /> <weapon id="40" name="Satchel detonator" /> </group> </catalog> And the server: function giveMeWeapon(weapon, amount) if weapon and weapon > 50 then return end if table.find(getOption('weapons.disallowed'), weapon) then errMsg((getWeaponNameFromID(weapon) or tostring(weapon)) .. 's are not allowed', source) else giveWeapon(source, weapon, amount, true) end end ...which delivers all weapons to everyone despite my notations that some weapons only go to some groups. I added an acl list for Members but do not know what function to allow. The weapons groups Hand, Special and Everyone are for all. How do I limit the last three groups to the preferred player's groups: Members, Supporters and Moderators?
  18. Taken from MTA Freeroam: function repairVehicle() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then server.fixVehicle(vehicle) end end I want to make this only accessible if the damage is below 50% or it has not been accessed in the last minute by that specific user. I found no getVehicleDamage
  19. If it is so truly liked... make it an option in MTA > settings. Your vote is clear, the people like it, yet just as clearly some have reasons to not want it there. so why not give those people great choices? This is what the options menu is for. Make 'Display Watermark' an option.
  20. I can create a vehicle like object: <object id="object (la_fuckcar1) (58)" breakable="true" interior="0" collisions="true" alpha="255" model="3594" doublesided="false" scale="1" dimension="0" posX="580.40002" posY="842.09998" posZ="-19.2" rotX="0" rotY="0" rotZ="93.994"></object> And I can create an object like vehicle: <vehicle id="vehicle (Monster 2) (1)" paintjob="0" interior="0" alpha="255" model="556" plate="NR6HXSV" dimension="0" color="245,245,245,245,245,245,0,0,0,0,0,0" posX="504.39999" posY="814" posZ="-8.6" rotX="0" rotY="0" rotZ="281.997" upgrades="1010,1025"></vehicle> What I want to do is create a vehicle that is an object. Or at its most basic: an indestructible vehicle, that hopefully cannot be moved, and interact-ability is not required. Can anything get me close to this?
  21. Pardon me i did mean "how do i make my PLAYER suffer real world damage such as falling accidents or zombie attacks while remaining effectively invulnerable to damage caused by other players such as shooting or punching?"
  22. This event handler protects the player from all damage except sudden death addEventHandler ( "onClientPlayerDamage", localPlayer, function ( _, _, _, loss ) local playerHealth = getElementHealth ( getLocalPlayer() ) outputChatBox ( "Your health: " .. playerHealth) outputChatBox ( "Your health: " .. loss) if ( playerHealth and playerHealth > 0 ) then cancelEvent ( ) end end ) This event handler protects vehicles from all damage except punching, and allows real world damage such as accidents. addEventHandler ( "onClientVehicleDamage", root, function ( _, _, loss ) local vehicleHealth = getElementHealth ( source ) outputChatBox ( "Your health: " .. vehicleHealth) outputChatBox ( "Your health: " .. loss) if ( vehicleHealth and vehicleHealth > 0 ) then cancelEvent ( ) end end ) What is the difference that gives two nearly identical bits of code different capabilities? Or to my point, how do i make my ped suffer real world damage such as falling accidents or zombie attacks while remaining effectively invulnerable to damage caused by other players such as shooting or punching?
×
×
  • Create New...