Jump to content

'LinKin

Members
  • Posts

    636
  • Joined

  • Last visited

Everything posted by 'LinKin

  1. Hello, Time ago, I saw that servers' admins could read and talk in the servers' chatbox via web, so they logged somewhere and they began talking. AFAIK this is something that all mta servers brings, but the question is, what is it? I'd like to be able to read and talk in the chatbox of the mta server via web. Thanks.
  2. As I want to allow just some resources, I thought of making a table, and checking if the arg passed to onChatMessage is contained in that table.. That way I'd validate whether it's a resource or not.
  3. Hello, onChatMessage has two arguments, where the second one is: resource / element theElement How can I detect if the argument is a resource? I already know how to identify if it's a player by using getElementType, But if I use getElementType, passing a resource as the argument, it will return a warning.. Thanks.
  4. I'm afraid you can't access that folder... Check out fileRead and xmlLoadFile filePath: The filepath of the file in the following format: ":resourceName/path". 'resourceName' is the name of the resource the file is in, and 'path' is the path from the root directory of the resource to the file. --Answering your 2nd reply.: But that's what I am telling you, use getBoundKeys.... I've done a script for it.. Binds Checker
  5. Which file contains all that info? (Tell me the file's extention too)
  6. Hello, I've some script that mutes a player in main chat or globally; So inside of those, in order to prevent a player talking in the chatbox, I use cancelEvent() inside onPlayerChat. I want to make another script that does something each time any message is output in the chatBox (by using onChatMessage) But I've one issue, this event will be triggered even if a muted player tries to chat, how could I prevent this without touching the other scripts that mute the player? I tried using wasEventCancelled() inside onChatMessage but it won't work. Thanks for your time.
  7. https://wiki.multitheftauto.com/wiki/GetBoundKeys
  8. Thank you CiBeR. @Feche1320: I've tried with your code (you just added the connection at the end of the script for not using the include function, right?) and it didn't work either. It keeps telling me that it could not connect... But I'm wondering.. Why does the PHP SDK works when communicating from Server to the Website? I can perfectly use callRemote to a .php page, do some code there, and return something else to the server.
  9. Well yes, it's a free host. I've tested it in a paid one, and it worked correctly. I've not tested your code tho, I didn't see it earlier when I readed your post. I'd like to ask something a little bit off-topic. - How can I detect a color code (#FF9911 for example) with php? - How can I break a string and turn it into 2 sub-strings? I'd research it myself but my time on the internet is quite restricted.. Thanks for your colaboration!
  10. This is the code: <?php include("sdk/mta_sdk.php"); $user = "LinKin"; $pass = "mypasshere"; $resource = "chattest"; $callFunction = "outputRemote"; $message = "LINKIN"; $mtaServer = new mta("23.235.234.83", 22020,$user,$pass); $mtaServer->getResource($resource)->call($callFunction,$message); ?> After trying some times, it showed another error: But it showed it just once, now it keeps showing the 'Could not connect' error.. What do you mean by making sure I can use the port on the webserver? And how everything should be set?
  11. Does someone have a working example? I still can't make it, it keeps throwing the same error.
  12. Hmm but what should I put as user and pass? Is that nessesary?, Like mandatory?
  13. Hello, I want to call a Lua function from my website, so using PHP SKD, I wrote this code inside a test2.php file in my website: <?PHP include("sdk/mta_sdk.php"); #$mtaServer = new mta("190.13.42.65", 22003); $mtaServer = new mta("190.168.1.4", 22003); $resource = $mtaServer->getResource ( "test" ); $retn = $resource->call ( "exportedFunction", "LINKIN" ); // $retn is an array containing the values the function returned ?> As you see I have 2 IP's. The first one is the IP address than is recognized by a webserver (I've another php file that prints the IP of the server). And the second one is the IP that appears in the server browser. The 22003 is the server's port (Not the HTTP port). I also tried with the server's HTTP port which is 22005, but it didn't work either. This is the message that appears in the internet browser when executing 'test2.php' file. Black rectangles are covering the path to the folder(s). This is the server-sided Lua script: function exportedFunction(arg) outputChatBox("ARG;: "..arg) end And this is the meta.xml <meta> <info name="Test" author="LinKin" type="script" version="1.0" description="PHP SDK Test" /> <min_mta_version client="1.3.4-0.00000" server="1.3.4-0.00000" /> <script src="server.lua" type="server" /> <export function="exportedFunction" type="server" http="true"/> </meta> I really don't know what to do here.
  14. Hello, I've been working with MTA SDK, and I got one question; Can people see the code that is inside the .php file in the website? I've readed it's not possible to take the php code from a page, but I want to make sure Thanks.
  15. Hello, I've some scripts that work with a MySQL database that accepts external connections; However, I have noticed that some hosting companies kinda block the function dbConect, and don't let the server connect to the database. It throws an error saying: dbConect; could not connect. So far I know two companies that don't let me connect to the database, they're Delux Host and Waltsu Hosting. Do you know why? Is there some other way I could connect to the database? Maybe by making use of MTA's PHP SDK? Thanks.
  16. It doesn't save repeated nicknames.
  17. Hi, If you still need this, just use Vortex. They're running a promotion. So if you use the 30% life-time discount, you'd have $0.105 per slot. And if you use the 50% ONE MONTH discount you'd have $0.075 per slot.
  18. Well really, just take this working code.... Read what I've commented inside of it tho. local namesTable = { } addEventHandler("onPlayerChangeNick", root, function(oldNick, newNick) local pSerial = getPlayerSerial(source) if not namesTable[pSerial] then namesTable[pSerial] = { } end -- Add new entry if doesn't exist. for _, aNick in ipairs(namesTable[pSerial]) do if aNick == newNick then return end -- Nickname already found in the entry; Quit the function and don't save it. end table.insert(namesTable[pSerial], newNick) end) -- Now to show you how to collect all the data from the namesTable: addCommandHandler("checkdata", function(thePlayer) for aSerial, nicksTable in pairs(namesTable) do -- Loop the "mother table" must be in pairs as it is not an indexed table. outputChatBox("Nicknames on Serial: "..aSerial) for _, aNick in ipairs(nicksTable) do -- Loop the table inside each entry of the "mother table"; Since it's an indexed table, you can use in ipairs. outputChatBox(_..". "..aNick) end end end)
  19. Inside the changeNick function: If the player hasn't been registered in the 'Names' table, then create a new position (Names[source]) and place a table inside that registry (Names[source] = {}). Then insert the nick. If the player already has been registered in the 'Names' table then loop the table of his nicks (for _, nick in ipairs(Names[source]) and check the value of variable 'nick' against the variable of the new nick that player changed to. (In this case you use 'n' as the variable of it). If the nick is found then use the 'return' statement inside the for loop to quit it (and the function too) so that it doesn't save the nick. By the way: I remember that this function has some special treatment; Example: If you have an antispam nickname script that doesn't let you change your nick more than 3 times in 5 secs for example, at the third time you're gonna change it, even if the antispam nick script 'blocks' you from doing it, the event onPlayerChangeNick is triggered, so you'd have to double check if the nick did change or not (to prevent your names-script storing unreal values)
  20. ./mta.sh ? Also, will it attempt to install zip, unzip, etc.. each time someone wants to create a new server?
  21. Use: onPlayerVehicleEnter Or onVehicleEnter, I dont remember the name. Look at wiki
  22. screen -dmS NameOfScreen ./mta-server When u want to get back to server console type: screen -r NameOfScreen Other commands that are very used for screen are: screen -ls (shows the list of screens) screen -wipe (when you stop a server, you can refresh the screens list)
  23. Well, this is my summary. 1. Make 'bin' directory at 'home' directory. Move via cd to that directory. NOTE: This isn't really nessesary. Just place the script into the folder you wish to install your server(s). i.e root 2. Before giving the script a name, we must check that it doesn't exist by doing: which [command] 3. Open nano editor, and begin writting the script: nano #!/bin/bash # My first script echo "Hello World!" 4. Give it permissions to use the command (ONLY WITH CURRENT USER) chmod u+x my_script If you wish to remove permission, use: chmod u-x my_script Source: http://www.seas.upenn.edu/cets/answers/chmod.html 5. To execute the script type: ./my_script It's actually way easier than you can ever imagine
  24. 'LinKin

    1.4 problem

    Yes, I don't understand what happens here... I think the problem's root is some script line somewhere inside the race resource. Because it seems like if the car was warped after some time to the position where the player died and its visibility is set to false. It's very wierd. Blinker, try using destroyElement instead of setElementPosition, I've not tried it because I believe it will cause troubles, just as when you destroy a vehicle using Admin Panel, the race resource messes up and gets restarted. However this can be solved by adding it to the Admin ACL.
×
×
  • Create New...