Jump to content

knightscript

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by knightscript

  1. Nice map, quality looks ok to me .
  2. WTF dude I just could watch till minute 3, got dizzy hahaha, but nice map!.
  3. Here you go, remember to make the script CLIENT SIDE!. theped = createPed ( 255, 0, 0, 3 ) --saves the ped on a global function cancelPedDamage ( attacker ) --the function if source == theped then --checks if the ped that is being attacked is the global cancelEvent() -- cancel any damage done to ped end --ends the check end --ends the function addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) --adds the event
  4. To play a sound to all players on the server, when you type the command /sound: META: <meta> <file src="mysound.mp3" /> <!--Your MP3 File--> <script src="client.lua" type="client" /> <!--REMEMBER to add this client side --> </meta> function playSound () playSound("mysound.mp3") --plays the sound end addCommandHandler("sound", playSound) --adds the command And if you want to disable the music, you can do it with this code by using the command /stopsound function stopsound() stopSound( mysound ) end addCommandHandler ( "stopsound", stopsound ) --using the command 'stopsound' will stop the sound EDIT: I just discovered you CANT have a function name on the commandhandler.
  5. Show us your code, what are you currently trying to do?.
  6. What do you mean with ped.ifp? You need to give us a better description of your problem. EDIT: From what I see on the MTA Wiki, there was a way to do this, but the function has been disabled, you can see more information here: https://wiki.multitheftauto.com/wiki/EngineLoadIFP
  7. I don´t want to fight or anything, but @Dealman is right, i know some other programming languages like PHP, and adapting to LUA has been pretty easy, I have even scripted around 90% of my server on my own, and in my opinion, the MTA Wiki is pretty well documented, but the Wiki wont give you exactly what you want, you have to adapt the code, lets say the wiki gives you the base. Also if you have questions, there is not 1 question I have made on the forum that hasn´t been answered and ended on success!. I wish you luck! (and myself too haha).
  8. Testing!. Edit: it works excelent! Congrats!.
  9. Thanks guys! you are really helping me out!. LUA is so easy in comparation to other programming languages, I´m scripting this gamemode without any base and I hope i´m able to open it soon, I have learned a lot with the of many of you and I just want to thank you all! EDIT: Credits for the HUD: #RooTs
  10. Hello, I dont know why but it is still showing the same message again and again:
  11. Hello, thanks for the code snippet, well I have my duel system right here: function quitarrejas() destroyElement(reja1) destroyElement(reja2) end function InvitacionDuelo (player, opponent) addCommandHandler("aceptarduelo", function(source) if (source == opponent) then setElementData(source,"enduelo","1") setElementData(player,"enduelo","1") outputChatBox(getPlayerName(source).." ha aceptado tu duelo!", player, 255, 165, 0) outputChatBox("Has aceptado el duelo de "..getPlayerName(player).."!.", source, 255, 165, 0) local antiheadshotsource = getElementData(source,"antiheadshot") local antiheadshotplayer = getElementData(player,"antiheadshot") x,y,z = getElementPosition(source) x1,y1,z1 = getElementPosition(player) sourceaccount = getAccount(getPlayerName(source)) playeraccount = getAccount(getPlayerName(player)) if antiheadshotsource == "1" then setElementData(source,"temporalantiheadshot","1") setElementData(source,"antiheadshot","0") outputChatBox("Tu casco ha sido desactivado durante el duelo!.",source) end if antiheadshotplayer == "1" then setElementData(player,"temporalantiheadshot","1") setElementData(player,"antiheadshot","0") outputChatBox("Tu casco ha sido desactivado durante el duelo!.",player) end reja1 = createObject(971, 2440.8, 2448, 72, 0, 0, 42) reja2 = createObject(971, 2394.5, 2493.8999, 72, 0, 0, 42) setElementPosition(source,2392.86, 2495.01, 69.47) setElementPosition(player,2442.01, 2446.62, 69.47) takeAllWeapons(source) takeAllWeapons(player) giveWeapon ( source, weaponid, 999 ) giveWeapon ( player, weaponid, 999 ) setTimer(quitarrejas, 4000, 1) triggerClientEvent ( source, "Countdown", source) triggerClientEvent ( player, "Countdown", player) end end) end addCommandHandler("duelo", function(source, cmd, arg, weapon) if (arg) then local player = getPlayerFromName(arg) local checarsienduelo1 = getElementData(source,"enduelo") local checarsienduelo2 = getElementData(player,"enduelo") local antiheadshotsource = getElementData(source,"antiheadshot") local antiheadshotplayer = getElementData(player,"antiheadshot") if checarsienduelo1 == "1" then outputChatBox("Tu ya estas en un duelo!",source) cancelEvent() end if checarsienduelo2 == "1" then outputChatBox("Ese jugador ya esta en un duelo!",source) cancelEvent() end weaponid = getWeaponIDFromName (weapon) if (player) then if checarsienduelo1 == "0" and checarsienduelo2 == "0" then outputChatBox(getPlayerName(source).." Te ha enviado una invitación de duelo con "..weapon.." ("..weaponid.."). /aceptarduelo para iniciarlo!", player, 255, 165, 0) outputChatBox("Has enviado la solicitud de duelo a "..getPlayerName(player).." con el arma "..weapon.." ("..weaponid.."). Espera a que acepte tu duelo!", source, 255, 165, 0) InvitacionDuelo(source, player) end end end end) function CuandoMuere(totalAmmo, killer, killerWeapon, bodypart, stealth) setElementData(source,"enduelo","0") setElementData(killer,"enduelo","0") local sourceacc = getAccount(getPlayerName(source)) local killeracc = getAccount(getPlayerName(killer)) local checarcascosource = getElementData(source,"temporalantiheadshot") local checarcascokiller = getElementData(killer,"temporalantiheadshot") if checarcascosource == "1" then setElementData(source,"antiheadshot","1") outputChatBox("Tu casco se te ha regresado!",source) end if checarcascokiller == "1" then setElementData(killer,"antiheadshot","1") outputChatBox("Tu casco se te ha regresado!",killer) end if sourceacc == sourceaccount then setElementPosition(source, x, y, z) end if killeracc == playeraccount then setElementPosition(killer, x1, y1, z1) end if sourceacc == playeraccount then setElementPosition(source, x, y, z) end if killeracc == sourceaccount then setElementPosition(killer, x1, y1, z1) end local resource = getResourceFromName("duelos") restartResource(resource) end addEventHandler ("onPlayerWasted", getRootElement(), CuandoMuere) the problem is, each time a duel is finished, i have to restart the resource because the gate doesnt disappear, do you know what is the problem?
  12. THANKS Sarrum!, it worked perfectly! Thanks tosfera!, always there when I ask for help
  13. Its displaying the same message
  14. Hello, i have a problem, when i remove world objects and put other objects, they sometimes become invisible, here are 2 screenshots: I hope to see how to resolve this.
  15. Hello, im trying to make a random messages script, im using the following code: local mensajes = { {"test"}, {"test2"} } local mensajes = mensajes[math.random( #mensajes)] local elmensaje = unpack(mensajes) function map () outputChatBox(elmensaje,getRootElement(), 0, 0, 255, true) end setTimer ( map, 6000, 0 ) But it is only showing 1 message, how can i fix this? Thanks
  16. Fixed it, just added this to my "OnPlayerChat": local playerAccount = getPlayerAccount(source) and on each chat acl I added getAccountData(playerAccount,"Group") EXAMPLE: addEventHandler ( "onPlayerChat", root, function ( message, type ) local playerAccount = getPlayerAccount(source) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Owners" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#990000*[ #0000FF"..getAccountData(playerAccount,"Group").."]#FFFFFF- " .. getPlayerName(source) .. ":#FFFFFF " .. message, getRootElement(), r, g, b, true ) end end)
  17. Hello, im trying to show the clan tag of the players on the chatbox, im using the following code to fetch the players clan/group: function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "money") if (accountData) then playerclan = getAccountData(theCurrentAccount,"Group") end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) and on the chatbox: addEventHandler ( "onPlayerChat", root, function ( message, type ) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Everyone" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#FFFFFF*[ #000FFF"..playerclan.."#FFFFFF ]- " .. getPlayerName(source) .. ":#FFFFFF " .. message, getRootElement(), r, g, b, true ) My problem is, that the clan is the same for everyone, how can I fix this?
  18. Hello, im mapping a duel arena, but i have a problem, i don´t know how to make the script for it, what i want to do, is that when a player wants to make a duel with another player, he writes down for example /duel playername, and that if the other player writes down /acceptduel they will both be warped to my map, where they will be in separate cages, i know how to warp the players to a place (SetElementPosition, source, x, y, z), and i want to create a timer which will remove the gate, but i know how to do that too, but what i dont know how to script is the /duel part, is there any tutorial on how to do this?
  19. Hello! Nice hud!, but i have a problem, with resolutions like 800 x 600 it has a bad layout, look: Image link: http://s28.postimg.org/o7aka1pfx/Untitled.png
  20. I didnt kill myself, i killed another player, his deaths were incremented but my kills wasn´t, what can it be?
  21. Hello @Army@1, i´ve just tested your code, the deaths are updating correctly but the kills aren´t, i copied the same exact code, what can be wrong?
  22. What functions should I use for this?
  23. Nice ViRuZ, i will test it out, so canceling the event would null the damage by default right? that is great, because i was having problems with setweaponproperty!
×
×
  • Create New...