Jump to content

qaisjp

Retired Staff
  • Posts

    2,344
  • Joined

  • Days Won

    10

Everything posted by qaisjp

  1. Wow it looks like you took thought and time to write such a long message, ^^ I +1 Remi-X's post.
  2. If you dont support this, stop saying it over and over again.
  3. Please visit the updated tutorial instead! In the modification on the server, there are multiple resources to make a server. There are many resources already shipped with MTA, however you may wish to edit or create some. Basic components of resources meta.xml file - States what needs to be loaded and other metadata scripts - What is the use of this resource, without scripts? Scripts do the action In this tutorial we will make a PM system. Let's think what we need to do, we need to make a command and attach that to the function. We need to manipulate who we are sending to and the text we are sending. First we need to make our resource folder, generally the resources folder is in in MTA 1.1, they support multiple sub-dir's so let's make a subfolder called "[TUT]". It can be anything you want, but this just makes the resources folder organised. Make sure it has '[' and ']'. Inside [TUT] make a folder called 'pm-system' - this will be our working directory and our main resource folder. Inside our folder, we create a file named 'meta.xml' and we need to type a few lines to make sure our resource is loaded correctly. Inside the meta file we will type this: <meta> <script src="script.lua" type="server"/> </meta> The first and third line is MANDATORY, meaning it must be there. The second line tells MTA to load our script (which we will soon make ahead of this tutorial) ' 'type="server"' - What side the script will operate on, can be server or client Making the script First we need to create a command handler and a function for it too function pmHandler() -- create function end addCommandHandler ( "pm", pmHandler ) -- attach handler to function When we do /pm nothing should happen, we need to add the target person and the text and also the output function pmHandler(player, _, to, text) -- create function. end addCommandHandler ( "pm", pmHandler ) -- attach handler to function player - the person who wrote the command to - the person we want to send the pm to text - the text function pmHandler(player, _, to, text) -- create function. local personToReceive = getPlayerFromName(to) -- We get the player from the name if personToReceive then-- if the person in the above line exists, then continue -- We send the messages! end end addCommandHandler ( "pm", pmHandler ) -- attach handler to function In the above code we are using getPlayerFromName to match the player by his name and we are checking if there is a player. function pmHandler(player, _, to, text) -- create function. local personToReceive = getPlayerFromName(to) -- We get the player from the name if personToReceive then-- if the person in the above line exists, then continue outputChatBox("PM --> #FFFFFF "..getPlayerName(personToReceive)..": ".. text, player, 255,0,0,true) outputChatBox("[PM] "..getPlayerName(player).."#FFFFFF: ".. text, personToReceive, 255,0,0,true) end end addCommandHandler ( "pm", pmHandler ) -- attach handler to function In the fourth line we tell the sender (John) we have sent it, we would get some sort of message when we type /pm qais hi PM --> Qais: hi and the receiver (Qais)gets [PM] John: hi If we type '/pm qais hi Qais this is doesnt work' we wont get the spaces, let's implement that. function pmHandler(player, _, to, ...) -- create function. local text = table.concat({...}," ") local personToReceive = getPlayerFromName(to) -- We get the player from the name if personToReceive then-- if the person in the above line exists, then continue outputChatBox("PM --> #FFFFFF "..getPlayerName(personToReceive)..": ".. text, player, 255,0,0,true) outputChatBox("[PM] "..getPlayerName(player).."#FFFFFF: ".. text, personToReceive, 255,0,0,true) end end addCommandHandler ( "pm", pmHandler ) -- attach handler to function (is it an abrupt ending)
  4. ..GOD Not, god. FOR THE LOVE OF EVGENIZ! - Well, where would we put tutorials in the 'Other' section?
  5. 1. We cannot give errors in every script we give, that is just misleading. Only sometimes, and if we have realised the person has debugged it themselves afterwards. 2. Giving whole code, but also fails in making it? and then shows ' '
  6. qaisjp

    setCamera?

    function setCameraOnPlayerJoin() -- slowly fade the camera in to make the screen visible fadeCamera(source, true, 5) -- set the player's camera to a fixed position, looking at a fixed point setTimer ( fadeCamera, source, 1, 5000, 1, 0.5 ) setCameraMatrix(source, 1000.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) setTimer ( fadeCamera, source, 1, 5000, 1, 0.5 ) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) I've left two errors in, where you made a big mistake. Find them via debug in game .
  7. qaisjp

    Tour

    exports.toursa:startSATour() (in the client)(make sure toursa is started)
  8. fat 'n'juicy penis -we aint fighting lol-
  9. I want has beta testing please:)
  10. idk Bennyxamix2000000009 why dooo youu keep changinngangs?
  11. GOD! Are you serious in this, or you are here just to say "Yeah, would be good"? start doing what... eh?
  12. and shitty and retarded p.s stop it
  13. because_capy is_so effin_lame p.s lame.
×
×
  • Create New...