-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
What did you compare? what I posted with yours? if so, then that's not what I told you to do, I told you to check the details of YOUR MySQL SERVER.
-
Look, I don't even know if you're even reading what I say, because you keep posting the same thing even when I gave you the solution already.
-
local server = get( "server" ) or "localhost" local user = get( "user" ) or "root" local password = get( "password" ) or "" local db = get( "database" ) or "mta" local port = get( "port" ) or 3306 local socket = get( "socket" ) or nil These are your MySQL details the server is trying to connect to, compare them with yours.
-
Check your MySQL server details, they are wrong.
-
You've got missing "--[[" at line @ 1. --[[ Copyright (c) 2010 MTA: Paradise This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ]] local connection = nil local connection = nil local null = nil local results = { } local max_results = 128 -- connection functions local function connect( ) -- retrieve the settings local server = get( "server" ) or "localhost" local user = get( "user" ) or "root" local password = get( "password" ) or "" local db = get( "database" ) or "mta" local port = get( "port" ) or 3306 local socket = get( "socket" ) or nil -- connect connection = mysql_connect ( server, user, password, db, port, socket ) if connection then if user == "root" then setTimer( outputDebugString, 100, 1, "Connecting to your MySQL as 'root' is strongly discouraged.", 2 ) end return true else outputDebugString ( "Connection to MySQL Failed.", 1 ) return false end end local function disconnect( ) if connection and mysql_ping( connection ) then mysql_close( connection ) end end local function checkConnection( ) if not connection or not mysql_ping( connection ) then return connect( ) end return true end addEventHandler( "onResourceStart", resourceRoot, function( ) if not mysql_connect then if hasObjectPermissionTo( resource, "function.shutdown" ) then shutdown( "MySQL module missing." ) end cancelEvent( true, "MySQL module missing." ) elseif not hasObjectPermissionTo( resource, "function.mysql_connect" ) then if hasObjectPermissionTo( resource, "function.shutdown" ) then shutdown( "Insufficient ACL rights for mysql resource." ) end cancelEvent( true, "Insufficient ACL rights for mysql resource." ) elseif not connect( ) then if connection then outputDebugString( mysql_error( connection ), 1 ) end if hasObjectPermissionTo( resource, "function.shutdown" ) then shutdown( "MySQL failed to connect." ) end cancelEvent( true, "MySQL failed to connect." ) else null = mysql_null( ) end end ) addEventHandler( "onResourceStop", resourceRoot, function( ) for key, value in pairs( results ) do mysql_free_result( value.r ) outputDebugString( "Query not free()'d: " .. value.q, 2 ) end disconnect( ) end ) -- function escape_string( str ) if type( str ) == "string" then return mysql_escape_string( connection, str ) elseif type( str ) == "number" then return tostring( str ) end end local function query( str, ... ) checkConnection( ) if ( ... ) then local t = { ... } for k, v in ipairs( t ) do t[ k ] = escape_string( tostring( v ) ) or "" end str = str:format( unpack( t ) ) end local result = mysql_query( connection, str ) if result then for num = 1, max_results do if not results[ num ] then results[ num ] = { r = result, q = str } return num end end mysql_free_result( result ) return false, "Unable to allocate result in pool" end return false, mysql_error( connection ) end function query_free( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end checkConnection( ) if ( ... ) then local t = { ... } for k, v in ipairs( t ) do t[ k ] = escape_string( tostring( v ) ) or "" end str = str:format( unpack( t ) ) end local result = mysql_query( connection, str ) if result then mysql_free_result( result ) return true end return false, mysql_error( connection ) end function free_result( result ) if results[ result ] then mysql_free_result( results[ result ].r ) results[ result ] = nil end end function query_assoc( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local t = { } local result, error = query( str, ... ) if result then for result, row in mysql_rows_assoc( results[ result ].r ) do local num = #t + 1 t[ num ] = { } for key, value in pairs( row ) do if value ~= null then t[ num ][ key ] = tonumber( value ) or value end end end free_result( result ) return t end return false, error end function query_assoc_single( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local t = { } local result, error = query( str, ... ) if result then local row = mysql_fetch_assoc( results[ result ].r ) if row then for key, value in pairs( row ) do if value ~= null then t[ key ] = tonumber( value ) or value end end free_result( result ) return t end free_result( result ) return false end return false, error end function query_insertid( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local result, error = query( str, ... ) if result then local id = mysql_insert_id( connection ) free_result( result ) return id end return false, error end function query_affected_rows( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local result, error = query( str, ... ) if result then local rows = mysql_affected_rows( connection ) free_result( result ) return rows end return false, error end
-
Post your "mysql.lua" content, you have a script error.
-
Fijate bien, tenes un problema en guiSetText, despues del valor.
-
1: Taking the money client side won't really take it, because it won't sync it with the server. 2: You must use triggerServerEvent to trigger a server side event. 3: You must use getPlayerMoney to check if the player has the money, before taking it.
-
"mods\deathmatch\resources\sql\mysql.lua"
-
@Noddy: That doesn't make any sense, why should he ask here before add them to his/her server? @cbsracing: You may put the vehicle mods on your server, but please don't uploaded them to the MTA Community.
-
guiGridListGetSelectedItem -- Get selected grid list item. guiGridListGetItemText -- Get the item text.
-
function obtenerName ( account ) local accountName accountName = getAccountName ( account ) local nombre = getPlayerName ( source ) -- You're calling the variable the same as the function name. outputChatBox ( " #00FF00 ".. nombre .." , Tu nombre se te cambiara por tu nombre de cuenta cuando te desconectes te regresaremos tu nombre ", source, 255, 0, 0, true ) outputChatBox(" #00FF00".. nombre .." , Ahora tu Nombre se cambio al Nombre de tu cuenta (".. accountName ..") ", source, 255, 0, 0, true ) setPlayerName ( source, accountName ) end addEventHandler ( "onPlayerJoin", root, obtenerName )
-
If your game mode is the MTA Paradise one, then that file exists on "sql/mysql.lua".
-
Decis cuando el jugador se va del area? o cuando pone "/salirdm"? local posiciones = { { 2170.3459, 1611.5499, 999.9727 }, { 2193.1315, 1625.0666, 999.9719 }, { 2199.9279, 1608.9176, 999.9716 }, { 2225.5649, 1620.4234, 999.9655 }, { 2229.4406, 1597.1533, 999.968 }, { 2229.7163, 1574.3369, 999.9692 }, { 2219.9885, 1552.2485, 1004.7188 }, { 2205.5302, 1580.3706, 999.9785 }, { 2187.1303, 1591.5382, 999.9782 }, { 2175.5495, 1577.6177, 999.9683 }, { 2177.8242, 1601.6416, 999.9774 } } local jugadoresEnDM = { } addEventHandler ( "onPlayerWasted", getRootElement( ), function ( ) if ( jugadoresEnDM [ source ] ) then local azar = math.random ( #posiciones ) local interior = getElementInterior ( source ) local skin = getElementModel ( source ) local x, y, z = unpack ( posiciones [ azar ] ) setTimer( spawnPlayer, 2000, 1, source, x, y, z, 0, skin, interior ) end end ) function consoleSetPlayerPosition ( thePlayer ) local azar = math.random ( #posiciones ) local interior = getElementInterior ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) setElementInterior ( thePlayer, 1 ) setElementPosition ( thePlayer, unpack ( posiciones [ azar ] ) ) jugadoresEnDM [ thePlayer ] = { interior, x, y, z } -- Agregamos al jugador que uso el comando a nuestra tabla con sus datos. end addCommandHandler ( "setpos", consoleSetPlayerPosition ) addCommandHandler ( "salirdm", function ( thePlayer ) if ( jugadoresEnDM [ thePlayer ] ) then -- Si el jugador que uso el comando esta en nuestra tabla.. setElementInterior ( thePlayer, unpack ( jugadoresEnDM [ thePlayer ] ) ) -- Obtenemos los datos del jugador y cambiamos su interior y posicion. jugadoresEnDM [ thePlayer ] = nil end end ) Con este codigo, si el jugador pone "/salirdm", no va a poder respawnear dentro de la zona.
-
Su error no tienia nada quever con MySQL .
-
Copiaste el client side mal, ese error no deberia aparecer con mi script.
-
De nada.
-
@ElMota: No es necesario hacer una tabla, simplemente rotas la camara en onClientPreRender.
-
Error, con getPlayerAccount obtenes la cuenta del jugador, no el nombre, para eso usas getAccountName.
-
No entiendo a que te referis, te aparece un error en el debug? si es asi, entonces copialo EXACTAMENTE como aparece.
-
Te olvidaste de enviar la posicion. -- client side: addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor_Button[2] ) then guiSetText ( GUIEditor_Edit[1], " " ) guiSetText ( GUIEditor_Edit[2], " " ) guiSetText ( GUIEditor_Edit[3], " " ) guiSetVisible ( GUIEditor_Button[2], false ) elseif ( source == GUIEditor_Button[1] ) then local x, y, z = getElementPosition ( localPlayer ) guiSetText ( GUIEditor_Edit[1], x ) guiSetText ( GUIEditor_Edit[2], y ) guiSetText ( GUIEditor_Edit[3], z ) guiSetVisible ( GUIEditor_Button[2], true ) triggerServerEvent ( "onSavePos", localPlayer, x, y, z ) end end ) -- server side: addEvent ( "onSavePos", true ) addEventHandler ( "onSavePos", root, function ( x, y, z ) local newFile = fileCreate ( "poss.txt" ) if ( newFile ) then fileWrite ( newFile, "Tus Posicion es: ".. x ..", ".. y ..", ".. z ) fileClose ( newFile ) end end )
-
There's a mod which makes MTA:SA on GTA:VC Map, but I forgot where to get it.