Jump to content

steadyfi

Members
  • Posts

    144
  • Joined

  • Last visited

Everything posted by steadyfi

  1. Doesn't work It works, thanks !
  2. Hello Is there a way to check if a string is equal to a format, like HEX for exemple. I wan't to check if the player enters a VALID HEX CODE and if yes then go forward, else return. Is there a way to check if color == format("#%x%x%x%x%x%x") and check if HEX code is valid ? Thanks.
  3. Thank you guys, your posts helped me !
  4. Ok, i ran into another problem. I tried some debugging, no problems in handlers or source element. I opened the SQL file, there were all the tables. The problem is in the SQL Function. addEvent("openteams.gui.playerOpensGUI", true) addEventHandler("openteams.gui.playerOpensGUI", getRootElement(), function() local team = getPlayerTeam(source) if team then --Player Rank local playerRank = executeSQLQuery("SELECT rank FROM otplayers WHERE player=? AND team=?", getAccountName(getPlayerAccount(source)), getTeamName(getPlayerTeam(source))) local rank = playerRank[1].rank local rank = tonumber(returnRank) outputChatBox("Rank "..tostring(rank)) --IGNORE, DEBUGGING --Leader Name local leaderName = executeSQLQuery("SELECT leader FROM otteams WHERE team=?", getTeamName(team)) local name = leaderName[1].name local name = tostring(returnName) outputChatBox("Leader "..tostring(name)) --IGNORE, DEBUGGING --Event triggerClientEvent(source, "openteams.gui.playerOpensGUI.return", source, returnRank, returnName) end end) The event get's triggered by a function Client Side, triggerServerEvent("openteams.gui.playerOpensGUI", localPlayer) And then it bounces back client side to open the GUI with the required information. Anyone ?
  5. executeSQLQuery("SELECT rank FROM otplayers LIMIT 1 WHERE player=? AND team=?", getAccountName(getPlayerAccount(player)), getTeamName(getPlayerTeam(player))) Is it correct ?
  6. Like this ? local result = executeSQLQuery("SELECT rank FROM otplayers WHERE player=? AND team=?", getAccountName(getPlayerAccount(player)), getTeamName(getPlayerTeam(player))) local rank = result[1].rank rank = tonumber(rank) triggerClientEvent(target, "event", target, rank) Im still using executeSQLQuery, too bored right now to change it
  7. Uhmm, sorry for bumping this topic up, but how do I get that ["rank"] and send it as a integer through a triggerClientEvent(target, "event", target, rank) where rank is the rank ?
  8. 127.0.0.1 is basicaly localhost and my MySQL server is hosted on my PC along with the server so yeah Summary: MySQL: Hosted on my PC MTA Server: Hosted on my PC
  9. Also, when I start the server it says: ERROR: roleplay-accounts\s_accounts.lua:174: dbConnect failed; Access denied for user 'mta'@'localhost' (using password: YES) local databaseConfig = { ["type"] = "mysql", ["hostname"] = "127.0.0.1", ["database"] = "mtarp", ["username"] = "mta", ["password"] = "no-need-to-see-the-password" } I have created the user with privileges to all databases and the password is correct. What do I do ?
  10. Hello I've got a little annoying error in MySQL. I am trying to import the database of Fairplay by Socialz (Git: https://github.com/Socialz/lua-mta-fairplay-roleplay) but when I try to create the contacts table it returns a error. I'm using phpMyAdmin MySQL Code: CREATE TABLE `contacts` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(100) NOT NULL, `number` VARCHAR(10) UNSIGNED NOT NULL, `ownerNumber` VARCHAR(10) UNSIGNED NOT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; Error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unsigned NOT NULL, `ownerNumber` varchar(10) unsigned NOT NULL, PRIMARY KE' at line 4 Thanks
  11. I wasn't saying the DB is slow, the events are lame and there is a slight delay in the GUIs + sometimes they need to be reopened. Anyway, thanks man.
  12. Thank you JR10 ! I'm using executeSQLQuery because I realised I don't need a private database and because my script is already completely Non-Functional from the change I made from Account Data to SQL + the table oriented Gridlist that shows all the players in the team including offline ones, now I need to fix all the functions and repair all the SQL + make the code more compact and better. Also speed is a problem. Conclusion: Everything is broken so there is no need to change db + registry.db is good enough Wish me luck
  13. Hello Can someone tell me how can I convert a table into a integer value ? I'm using SQL Select function and it returns me a table even if I check in a table where is only a SINGLE registry. When I say a single registry, i mean the Account Name doesn't get repeated, and that's what I'm checking for and then I get the rank. How can I transform this table into a number ? Long story short, how do I convert a table with a single element into a integer value ? I know I need to use: tonumber executeSQLQuery for if My Code: executeSQLQuery("SELECT rank FROM otplayers WHERE player=? AND team=?", getAccountName(getPlayerAccount(player)), getTeamName(getPlayerTeam(player))) Thanks
  14. local http_url = "http://no-need-to-see-my-ip/send.php" --URL Path to SEND.PHP local email_sender = "[email protected]" --Use a business/junk email address to avoid spammers/scammers local email_title = "SERVER_NAME - Password Recovery" --Change "SERVER_NAME" local email_text = "You recently requested a password change on our server. Use this confirmation code to change you password using the 'Recover' tab in the GUI from /recover. vCode: " local accEmail = getAccountData(account, "ers.email") local vCode = math.random(1000,999999)
  15. Hello Anyone knows how I can use the MTA SDK and the sendMailTo function ? The wiki doesn't say anything but some websites say you need SMTP, some say you don't. Anyone know how can I use it ? And do I need to fill the http_username and http_password variables in teh MTA_SDK.php file ? These are my scripts: send.php: <?php include("mta_sdk.php"); $input = mta::getInput(); mail($input[0], $input[2], $input[3], "From: ".$input[1]."\n" . "Content-Type: text/html; charset=iso-8859-1\n"); ?> Server-Side LUA: callRemote(http_url, EMailAccepted, accEmail, email_sender, email_title, tostring(email_text..vCode)) Note: email_text variable is defined and is a string Note: http_url is my websites IP Thanks
  16. So to make a long story short, use this instead: dbQuery Thanks man ! #SOLVED
  17. Hello. How can I connect to my .db file ? Im already using dbConnect but it doesn't seem to work with executeSQLQuery. Do I need to add any additional argument to executeSQLQuery ? Thanks
  18. I don't need a table. I need to check if it the text already exists. I use it for a team script. I save all the team names in a SQL Table. I need to check if the team already exists to not have multiple teams with the same name, and I do that by checking if the TEAMNAME var is equal to any of the team names saved in the SQL Table. I hope you understand
  19. Hello How can I check in a SQL Table if a column text is equal to what to a var ? Can someone tell me if this is correct ? Code: test = executeSQLQuery("SELECT team FROM openteams.teams") if test == var then --code end Thanks
  20. That is not what I want but ok. I was asking if I can refresh that IF statement even if I DON'T RE-TRIGGER the function. Like i said, it's a GUI and I don't want to reopen it
  21. Hello I was wondering if I can refresh a IF statement in a function that is triggered ONE TIME. For example a GUI. I draw the first tab, but the second requires a getElementData == true, and I can change that from the first tab. How can I make it recheck the elementData without re-triggering the function ? Example: function example() outputChatBox("This is triggered without any conditions") --more code that can change the element data if getElementData(localPlayer, "canITriggerIt") == true then outputChatBox("Horay, i was triggered") end end It's a GUI with 2 tabs, I don't want to re-trigger the function to recheck the getElementData Thank you
×
×
  • Create New...