Jump to content

xXMADEXx

Members
  • Posts

    2,718
  • Joined

  • Last visited

Everything posted by xXMADEXx

  1. Try this: ((Not Tested)) savestore = {} function ssavequit() savestore[getPlayerSerial(source)] = getAllElementData(source) end function ssavejoin() local serial = getPlayerSerial ( source ) if ( savestore[serial] ) then for index, variable in ipairs ( savestore[serial] ) do setElementData ( source, index, variable ) end end end addEventHandler("onPlayerQuit",getRootElement(),ssavequit) addEventHandler("onPlayerJoin",getRootElement(),ssavejoin)
  2. Try this: addEventHandler ( "onClientGUIChanged", edit, function ( ) guiSetText ( source, guiGetText(source):gsub ( "%p", "" ) ) guiSetText ( source, guiGetText(source):gsub ( "%s", "" ) ) guiSetText ( source, guiGetText(source):gsub ( "%a", "" ) ) end )
  3. We are not here to do it for you. We're here to help. You need to at least try to fix it.
  4. Very good. Happy someone finally made a new compiler thanks.
  5. Those are functions, not resources. https://wiki.multitheftauto.com/wiki/Se ... metagColor
  6. What program are you using to host the MySQL database?
  7. Try this: dbConnect ( "mysql", "host=127.0.0.1;dbname=databasename" , "username", "password") Sometimes it matters what you put first, the host or database name. If this doesn't work, then its most likely your host.
  8. xXMADEXx

    Question

    Just a little advice: Its a really, really bad idea to trigger a server event on every render for every player. You should use getTickCount or setTimer.
  9. This tutorial is brought to you by Revolution of Scripts. Also avalible here. Hello guys. So, in this tutorial I am going to teach you guys how to get data from your MySQL database. First of all, you will need to have the following: XAMPP or USBWebhost MySQL Database (Most Apache's support them) So, now that you have your MySQL database up and running you will need to make a new file in the htdocs file directory. For this tutorial we are going to use two files: Database.php - Where database executions will be created Index.php - Where we will list he given data database.php So, to start off, go ahead and make the database.php file. Inside the database.php file you'll need the PHP tags: <?php ?> The PHP functions that we will be using are: mysqli_connect & mysqli_query. Inside the PHP tags in database.php, make a new function and name it "executeDatabase." <?php function executeDatabase ( ) { } ?> The executeDatabase will be the only thing we will be working with inside database.php. Inside the function, create some new variables to define your host, username, password and database name. <?php function executeDatabase ( ) { $user = "xXMADEXx"; $pass = "databasePassword"; $host = "127.0.0.1"; $dbname = "ForumExample"; } ?> Your doing great! Just keep calm and code on! Now that we have our connection info entered in, we will make a variable of "$dbc" to define the MySQL connection using mysqli_connect. mysqli_connect arguments: bool mysqli_connect ( string $host, string $username, string $password, string $database); //$host: The MySQL Host //$username: The username to the MySQL database //$password: The password to the username of the database. //$database: The name of the database that you'll be using So, now lets make the connection in database.php!! <?php function executeDatabase ( ) { $user = "xXMADEXx"; $pass = "databasePassword"; $host = "127.0.0.1"; $dbname = "ForumExample"; $dbc = mysqli_connect ( $host, $user, $pass, $dbname ) or die ( "Failed to connect to database." ); } ?> Don't worry, we are almost done with database.php!! Now, we need to define a variable name "$executeString" in the function, that way we can use mysqli_query to execute what ever the code says. <?php function executeDatabase ( $executeString ) { $user = "xXMADEXx"; $pass = "databasePassword"; $host = "127.0.0.1"; $dbname = "ForumExample"; $dbc = mysqli_connect ( $host, $user, $pass, $dbname ) or die ( "Failed to connect to database." ); } ?> Finally, we are one function away from being done. Now, we need to return what ever mysqli_query returns. That way, if the user is requesting something like "SELECT * FROM tableName" it will return it. <?php function executeDatabase ( $executeString ) { $user = "xXMADEXx"; $pass = "databasePassword"; $host = "127.0.0.1"; $dbname = "ForumExample"; $dbc = mysqli_connect ( $host, $user, $pass, $dbname ) or die ( "Failed to connect to database." ); return mysqli_query ( $dbc, $executeString ); } ?> Nice job! Now database.php is finally long at last, complete. index.php So, start off by creating a new PHP file called index.php <?php ?> So, first of all we will need to include database.php that way it gives us our executeDatabase function. <?php include "database.php"; ?> Now, all you'll need to do is execute what you want. The rest is up to you. Example: <?php include "database.php"; $query = executeDatabase ( "SELECT * FROM TableName" ); while ( $row = mysqli_fetch_array ( $query ) ) { echo $row['ColumnName']; } ?> I hope that you have learned something! (If you need further help, just message me on the Revolution of Scripting forum. )
  10. does not work Read /debugscript 3.
  11. Use a table in guiGridListSetItemData. Examp: guiGridListSetItemData ( gridlist, 2, 1, { "data1", 200, getPlayerName ( localPlayer ) } ) for i, v in ipairs ( guiGridListGetItemData ( gridlist, 2, 1 ) ) do outputChatBox ( tostring ( v ) ) end
  12. Looks nice.
  13. xXMADEXx

    Help

    addEventHandler("onClientRender",root, function() local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second local text = hours..":"..minutes..":"..seconds dxDrawText(text,0,0,10,10,tocolor(0,128,255),1.5,"default-bold") dxDrawText(text,1,1,10,10,tocolor(0,0,255),1.5,"default-bold") end )
  14. DayZ is a zombie gamemode. Just search DayZ in the MTA Server Browser
  15. He can do it without a dout.. but his website says this: "NOTE: I DON'T ACCEPT COMPLETE SERVER/GAME MODE REQUESTS." so he will not do it.
  16. Not even sure if its possible to find a scripter who will make you a full GM....
  17. It should work if its this: location = getZoneName ( x, y, z, true )
  18. No, there isn't
  19. The server is the host...
  20. Fantastic!! I love the Lua code encrypt!! Fabulous!
  21. xXMADEXx

    help script

    addCommandHandler setElementPosition
  22. xXMADEXx

    Run (machinima)

    This is the best short film for MTA I've ever seen Good job, keep up the good work.
  23. You need to trigger a client event that haves a table containing all the accounts: getAccounts
  24. xXMADEXx

    timer help

    Not sure, but I think this is what you want: function chadi ( commandName ) if ( isTimer ( TheTimer ) ) then return end setElementFrozen ( getLocalPlayer(), true ) setElementPosition ( getLocalPlayer(), 1544.0194091797, -1352.6119384766, 329.47549438477 ) TheTimer = setTimer ( function ( ) setElementFrozen ( getLocalPlayer(), false ) takePlayerMoney ( 5000 ) end, 5000, 1 ) end addCommandHandler ( "para", chadi )
  25. engineImportTXD engineLoadTXD --Only if the object haves a custom model (.dff) -- engineReplaceModel engineLoadDFF
×
×
  • Create New...