Jump to content

Zango

Discord Moderators
  • Posts

    681
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zango

  1. Zango

    text

    You can toggle a player's chatbox using showChat, if I understood your question.
  2. Zango

    MYSQL Error

    There should be a warning in server.log, perhaps it's useful. The permissions for mta_mysql.so in your picture is rw-r--r--, which means no one has executable permissions. I'm not sure whether that's the issue, but it could be. chmod 744 /home/mods/deathmatch/modules/mta_mysql.so It's not advisable to run this stuff as root. Oh, I'd also like to quote
  3. As the scripting introduction explains, using spawnPlayer and fadeCamera. The clientside is only available when all resources are downloaded and they're started. As such the bottom resource in mtaserver.conf to start automatically, "onClientResourceStart" in this resource is one way to assess your first point. If you wish to spawn the player before this, as mentioned above, serverside functions spawnPlayer and fadeCamera can be used.
  4. Examples of bad server names: Instead of labeling your server in a 'foreign' language, you should include a tag eg. [ Arabic only / كون ارابيسك ] While the MTA browser would benefit from a "server language" tag for filtering these out, MTA is used widely by Russian, Spanish, Arabic, Turkish, German and English people. Until L10n is implemented, English is the only language for the interface and ties the community together. Consider the majority of the players don't even understand the alphabet used. The servers list is incredibly crammed as it is. Comprehensibility and message What do you want to tell the world about your server on one line? The people who frequented your server before it went offline can most likely deduce that "it's back", if it's online. Extensive use of symbols is not good practice neither. There is very little margin between server listings in the browser. Symbols and other FX only reduces the readability. A better way to display above server SMT #2 DD Only | www.mtasa.cz | [EN CZ SK PL] Unlike other multiplayer games it's pretty much only the "Name", "Players" and "Ping" columns which are effectively used. The "Gamemode" column would correspond to something like the "Map" column in Counter Strike. However there is no useful information to draw from this tag. Examples are "MTA:SA" "play" "GangsWar v3.7" "RPG v1.2 Beta" "Roleplay" "DayZ" "Everything" "DD" "U.S Car Mods" "GTA4" It's not used consistently and is as such useless. "Race" "Roleplay" "Freeroam" "Deathmatch" would be good tags for this, but majority of servers employ a kind of fused gameplay with elements from all traditional gamemodes. MTA is incredibly versatile and many servers float together. Perhaps a "theme" would be better for the job. "Realism", "Vehicles", "Zombies", etc. The search feature of the browser only searches in the "Name" rows as well. With all this great knowledge we just gained, we know a good server name contains What (short) theme, gamemode or style describes your server Unique name and/or domain Air Similarly a server name should not contain "24/7" Version of MTA Any characters outside below characterset ABSOLUTELY PROHIBITED THE characterset for MTA server names abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 . , ' `´ * ^ ~ / [ ] \ ( ) # | - _ % & { } : ; Examples of good server names that meet the above requirements tl;dr Concise, no unnecessary symbols, "Gamemode" tag is useless. Your interface is very important. Please consider the following. Only you understand how your server works A new player on your server is only barely accustomed to basic server binds F9 (help menu) F11 (map) and commands like /login and /register If you don't introduce people to your server, they will most likely leave. This spawn screen on "FFS Gaming" is self-explanatory Intuitive, clean and easy. If you don't use a similar solution, you must instruct the user by screen dialogues or a help page. An example of a bad "help" page: Crammed and annoying. Revolutionary design techniques for a good interface Sorting data for display (eg. alphabetically) Color combinations Air between text and border The following are examples of good GUI "FFS gaming" help window and bottom HUD Consistent use of colors SAUR GTO (Grand Theft Online) HUD [Woovie said it sucked] A rule of thumb is to keep your server's total necessary download below 15MB. With this size and the "world average" Internet speed it will take, averagely, just under a minute. Additional data you can transfer to the client using fetchRemote, triggerServerEvent and the future downloadFile. Long downloads will keep impatient players away. Showcase: MTA is open source A considerable amount of the players cannot understand English Copying the entire concept and gameplay off another server won't work Please reply if you have any suggestions for the recipe.
  5. You are using a clientside event in a serverside script. onClientPedDamage can only be used clientside. edit, with an example: serverside: function setPedInvincible (ped, bInvincible) if (ped) and (getElementType(ped) == 'ped') then setElementData (ped, 'invincible', bInvincible) return true end return false end clientside: function cancelPedDamage () if (not getElementData(source, 'invincible')) then return false end return cancelEvent () end addEventHandler ('onClientResourceStart', resourceRoot, function () addEventHandler ('onClientPedDamage', root, cancelPedDamage) end )
  6. Any errors in the debugging console? Please post the contents of your script and meta.xml.
  7. In case you haven't, you might want to read about "call" on the wiki. Your syntax is correct, but you need to make sure that "outputTopChat" is exported in the resource meta.xml The error basically means that it can't find the exported function.
  8. You don't need to do anything more now. If the command says that everything is open, it probably is. The best answer is to get someone to connect to your server.
  9. You can get the original files here or on Google Code. You might want to read some of the bits from the Server Manual on the wiki. local.conf and editor.conf is only used for the map editor and host game options from the main menu. To keep it simple, use mtaserver.conf and host a game using mtaserver.exe from the server folder. The tag should not be used. Leave it blank.
  10. Whichever address you connect to - your LAN or public - doesn't matter. Remote players (your friends & the world) can only connect to your public address. Short answer: Yes!
  11. You don't need to. The tag should be left empty. Your server is always listening at your public IP.
  12. The IP address you supplied is your LAN (Local area network) address. It's the network that exists between you and your home router, and this address is used, in your home network, to identify you to your router. It's only unique and usable in this scenario. Outwards, is the WAN (Wide area network). This is the network that we're all connected to. Similar to LAN, an IP address is once again used to identify you. However this address identifies your "house", and isn't by default inbound to your PC, unless you've configured it so. As to why you open ports, to direct traffic on a protocol on a port, to a specific computer. You can retrieve your "public" IP address using a site like whatismyipaddress.com. Give this address to the people who wish to connect.
  13. As far as I know, MTA broadcasts to the Internet by default, it can only turn off LAN service. If is set to 1 in your mtaserver.conf file, the port test tool reports that all of your ports are open and yet no one is able to connect to your server, please: Post your IP address and port for MTA (or PM). Attach information (router brand/model and OS). I'm also a little bit confused about your question. Can players connect to your server manually? Or is it not showing in the server browser?
  14. Does this tool report that your ports are open?
  15. Remember, this script runs when the resource starts (which is when your server starts). The wiki contains documentation for every function and event. You would most likely want to store a set of default spawn coordinates to use, when the player is logging in for the first time. In your function quitHandler, you must evaluate your parameters. You've connected it to onPlayerQuit - see the wiki for this event. Events usually - onElementAction Where the Element (eg. onPlayerLogin) is stored under the hidden "source" variable and the variables returned relating to Action are passed into the function. an example: local default_spawn_X, default_spawn_Y, default_spawn_Z = 0, 0, 3 --Join Handler, how player joins when spawns function joinHandler(_, playeraccount) --Spawning Player if (playeraccount) then --and not isGuestAccount(playeraccount) then local loginX = getAccountData(playeraccount, "cowpi.loginlocation.x") local loginY = getAccountData(playeraccount, "cowpi.loginlocation.y") local loginZ = getAccountData(playeraccount, "cowpi.loginlocation.z") spawnPlayer(source, loginX, loginY, loginZ) --spawnPlayer(source, spawnX, spawnY, spawnZ) else spawnPlayer(source, default_spawn_X, default_spawn_Y, default_spawn_Z) end fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to CowPi MTA", source) end addEventHandler("onPlayerLogin", getRootElement(), joinHandler) --Quit handler, handles the position of player on last login function quitHandler() local playeraccount = getPlayerAccount (source) if (playeraccount) and not isGuestAccount(playeraccount) then local logoutX, logoutY, logoutZ = getElementPosition(source) setAccountData(playeraccount, "cowpi.loginlocation.x", logoutX) setAccountData(playeraccount, "cowpi.loginlocation.y", logoutY) setAccountData(playeraccount, "cowpi.loginlocation.z", logoutZ) end end addEventHandler("onPlayerQuit", getRootElement(), quitHandler) Good luck and happy scripting!
  16. Great question. This debate is sometimes ruined by biased opinions, unfortunately. SQLite themselves "conservatively estimates" their database software to be able to serve a website with 100,000 visits per day. MySQL is essentially designed for the enterprise and "large scale applications". If you wish to easily access your data from outside MTA it could be beneficial to move to a server<->client database engine as well. SQLite stores all databases in a single file. Do you store excessive amounts of data you could reach OS file size limitations. In a case such as an MTA server, it's not a question about which database engine is the "fastest". No MTA server serves a million users daily. A big server has around 100,000 to 300,000 registered player accounts. Theoretically a SQLite table can contain 1e+13 rows. If we consider a quarter of this, it's still around 2,500,000,000,000 rows. (Impractical example) Do you structure your data properly and use SQL effectively, SQLite can cater to any server despite size, really. The real bottlenecks exists in how you write, access and process data. Whether MTA's internal account functions are "slow" - I don't know - but it's essentially a SQLite database. They provide the benefit of not having to deal with SQL syntax at all.
  17. Zango

    gui not closing

    Small typo on line 19. (bcancelMining) It's useful to use the debug console, as this would yield a warning. You have a typo on line 13 as well. bMiningCancel. Line 18 bStartmining Happy scripting
  18. Well then you might have forgot to include the resource that creates this event OR added it in the wrong order. You'll have to open each of them and find what resource is supposed to create this event.
  19. Looks like client requested LODsClient Please post your server and clientside code. You most likely forgot to add a serverside event for "requestLODsClient"
  20. Zango

    GUI problem

    It's a good question and it's indeed quite strange. You could implement a check, in your function writeToChat, that ensures that the clicked GUI element is the button. Example: function gui() gui = guiCreateWindow(739, 292, 244, 360, "GUI", false) guiWindowSetSizable(gui, false) guiSetVisible(gui, true) showCursor(true) guiEdit = guiCreateEdit(9, 41, 153, 30, "Enter your message", false, gui) Button = guiCreateButton(172, 41, 58, 31, "Send", false, gui) function writeToChat () if (source ~= Button) then -- If the GUI element clicked differs from the "Button" element return false -- Exit end local msg = guiGetText ( guiEdit ) outputChatBox (msg ) end addEventHandler ( "onClientGUIClick", Button, writeToChat ) end addCommandHandler('gtest', gui)
  21. Good question! Using MTA's dbQuery I would insert the values into your first table, and retrieve the value of MySQL LAST_INSERT_ID. Example: local bExec = dbExec (connection, 'INSERT INTO TABLE1 ...') if (bExec) then local queryData = dbQuery (connection, 'SELECT LAST_INSERT_ID()') local result = dbPoll (queryData, -1) local autocrement_id = result[1]['LAST_INSERT_ID()'] end You can then reference last_insert_id in your next insert queries. Happy scripting
  22. Good question. Yes it does. You can't select items in a disabled gridlist, and it doesn't receive any events, as the wiki page says. However visually, it doesn't grey out the text, like you would see on a disabled button, for instance. Happy scripting
  23. Boy you sure done messed up that formatting Code snippets of such size might, for more convenience, be posted to pastebin.com instead. From what I understand, your function desLoadingMap does not destroy the map elements? It appears when you create the objects, you forget to reference them in the objects table. This is the same for the rest of your elements. For example, in your function LoadingMap. Line 16, you must reference your object. You must do this for the rest of the elements as well. function LoadingMap(meta2,obj,mark,pickup) bindKey("enter","down",killDMFunc) addEventHandler("onClientRender", root, renderFileDownload, true, "low-1") if fileExists("map.xml") then fileDelete("map.xml") end local newFile = fileCreate("map.xml") if newFile then fileWrite(newFile, meta2) fileClose(newFile) end for i, v in ipairs(obj) do local object = createObject(v.modelId, v.posX, v.posY, v.posZ, v.rotX, v.rotY, v.rotZ) if object then table.insert (objects, object) setElementInterior(object,v.interiorID) setElementDimension(object,v.dimension) if v.doublesided == "false" then setElementDoubleSided(object,false) end end end
  24. Zango

    Group Check

    I can't figure out the logic in xScatta's code. I think he forgot to check that the name of "team" was "CRIMINAL" function CAP () COP = createTeam ("COPS",0,0,255) CR = createTeam("CRIMINALS",255,0,0) end CAP() function JC (thePlayer) setPlayerTeam(thePlayer,CR) outputChatBox("Welcome to the criminals team",thePlayer) end addCommandHandler("Criminal",JC) function JP (thePlayer) setPlayerTeam(thePlayer,COP) outputChatBox("Welcome to the cops team",thePlayer) end addCommandHandler("Cop",JP) function checkCriminal (thePlayer) local playerTeam = getPlayerTeam (thePlayer) if (not playerTeam) then return false end if (getTeamName(playerTeam) == "CRIMINALS") then return true else return false end end Alternatively you could compare "playerTeam" with your variable "CR" instead.
  25. The wiki page for executeCommandHandler is a good place to start. "register" isn't a MTA command and can be executed by this command, I would say, however. It's provided by the admin OR freeroam resource, I can't remember. I think it's the former. "login" is hardcoded. You can't attach command handlers (addCommandHandler) to such command. The function executeCommandHandler does, as the name implies, execute a handler by script.
×
×
  • Create New...