Jump to content

Which one saving fine


Hero192

Recommended Posts

Posted

Yes bonus I know how to Script with SQL language and use it in MTA but, I want to know how to control MySQL to my server? to see player's data

if ( tostring ( get ( "CONNECTION_TYPE" ) ):lower() == "mysql" ) then  
    outputConsole ( "Attempting to connect as MySQL... Please wait") 
    db = dbConnect( "sqlite","data.db" ); 
elseif ( tostring ( get ( "CONNECTION_TYPE" ) ):lower() == "sqlite" ) then  
    db = dbConnect ( "sqlite", tostring(get("DATABASE_NAME")) .. ".sql" ); 
else  
    error ( tostring(get("CONNECTION_TYPE")) .. " is an invalid SQL connection -- valid: mysql, sqlite" ); 
end  
  
if not db then 
    print ( "The database has failed to connect") 
    return  
else 
    print ( "Database has been connected") 
end 
  
function db_query ( ... )  
    local data = { ... } 
    return dbPoll ( dbQuery ( db, ... ), - 1 ) 
end 
  
function db_exec ( ... ) 
    return dbExec ( db, ... ); 
end 

thats not all of it, but i gave you little bit of mine continue if you know how. if not try to find one in the community.

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted
Thanks for the reply, but I won't codes, I want to know how to control MySQL to see player's data ! like when you use XAMPP

Oh check the Data,

open it with NotePad and you will find everything.

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

Oh check the Data,

open it with NotePad and you will find everything.

Dude, do you have a server right? ok, how you see player's saved data, like weapons, money, cordinations(x,y,z).. in a panel like XAMPP.

Posted
  
local weapStats_ = {  
    ['9mm'] = 0, ['silenced'] = 0, ['deagle'] = 0, ['shotgun'] = 0, ['combat_shotgun'] = 0,  
    ['micro_smg'] = 0, ['mp5'] = 0, ['ak47'] = 0, ['m4'] = 0, ['tec-9'] = 0, ['sniper_rifle'] = 0 } 
  
function createAccount ( account ) 
    if ( account and type ( account ) == 'string' ) then 
        local plr = getPlayerFromAccount ( account ) 
        local autoIP = "unknown" 
        local autoSerial = "unknown" 
        local weapStats = toJSON ( weapStats_ ) 
        if plr and isElement ( plr ) then 
            autoSerial = getPlayerSerial ( plr ) 
            autoIP = getPlayerIP ( plr ) 
            outputDebugString ( "NGSQL: Creating account "..account.." for player "..getPlayerName ( plr ).." (Serial: "..autoSerial.." || IP: "..autoIP..")" ) 
        else 
            outputDebugString ( "NGSQL: Creating account "..account.." for player N/A (Serial: None || IP: None)" ); 
        end 
        local today = exports['SAEGPlayerFunctions']:getToday ( ) 
        return db_exec (  
[[INSERT INTO `accountdata` (`Username`, `Money`, `Armour`, `Health`, `x`, `y`, `z`,  
`Skin`, `Interior`, `Dimension`, `Team`, `Job`, `Playtime_mins`, `JailTime`, `WL`, `Weapons`, `JobRank`,  
`GroupName`, `GroupRank`, `LastOnline`, `LastSerial`, `LastIP`, `Kills`, `Deaths`, `weapstats`, `items`,  
`unemployedskin`, `vip`, `vipexp`, `plrtosrvrsettings` )  
VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );]],  
            account, '0', '0', '100', '0', '0', '0', '0', '0', '0', 'UnEmployed', 'UnEmployed', '0', '0', '0',  
            '[ [ ] ]', 'None', 'None', 'None', today, autoSerial, autoIP, '0', '0', weapStats, toJSON ( { } ), '28', 'None', nil, toJSON ( { } ) ) 
    end 

When you finish this you go to DATA and open it with Note pad you will find every thing

350x20_FFFFFF_FFFFFF_000000_000000.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...