Basic Property System (with pickup model changing)

Started by Sebastian, Apr 12, 2017, 10:03 PM

Previous topic - Next topic

Sebastian

CREDITS:


Basic Property System
(with pickup model changing)


This is simple, basic, and ready for you to develop !
What is the advantage ? Once you bought a property, pickup model will change:

from to

Don't know if you are aware of what this means, but requires more things to take care of.
(because you cannot just change a pickup's model via pickup.Model)
You have to remove the old pickup, then recreate it and "push" the "old" data to the new pickup, and blablabla....
(all of this happening when random pickups can still be created in server, so IDs might get lost)

But with my system, you are free to create any pickup you want, but only after loading all the properties from database, if there is any.



Available commands:
  • /addprop <price> <name>
  • /delprop
  • /myprops
  • /buyprop
  • /sellprop
  • /shareprop <player>
  • /unshareprop

Sebastian

#1
1.Create a new file called: BasicPropertySystem.nut
2.Insert this code inside it ^
/*
    Basic Property System by sseebbyy
        (with pickup model changing)
*/

const NO_OWNER_MSG = "no owner";
const NO_SHARING_MSG = "not shared";
const NO_DESCRIPTION_MSG = "No description yet.";
const NO_PROP_OWNED = "no property owned.";
const NO_PROP_SHARED = "no property shared.";

const PROPS_LOCATION = "Properties.db";
const PROPS_LIMIT = 40;
const PROP_MODEL_FORSALE = 407;
const PROP_MODEL_BOUGHT = 406;

const PROP_CREATE = 1;
const PROP_RELOAD = 2;
const PROP_UPDATE = 3;

const RGB_BLUE = "[#37a2ef]";
const RGB_GREY = "[#e0e0e0]";

//-------------------------------------------------------------

class Property
{
    ID = null;
    Name = null;
    Price = null;
    Owner = null;
    Sharing = null;
    Description = null;
    x = null;
    y = null;
    z = null;
    World = null;
}

//-------------------------------------------------------------

    prop <- array( PROPS_LIMIT, null );
    lastPickupPickedUp <- array( GetMaxPlayers(), null )
    _srv_Properties <- 0;
   
    dbProperties <- ConnectSQL( PROPS_LOCATION );
    QuerySQL ( dbProperties, "CREATE TABLE IF NOT EXISTS Properties ( ID INT, Name TEXT, Price INT, Owner TEXT, Sharing TEXT, Description TEXT, x FLOAT, y FLOAT, z FLOAT, World INT )" );

    print( "Basic Property System was loaded." );
   
//-------------------------------------------------------------
   
function pMSG( text, player )
{
    return MessagePlayer( RGB_BLUE + text.tostring(), player );
}

function UpdateProperty( id, name, price, owner, sharing, description, x, y, z, world )
{
    local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
    if( !see_dbProperties ) return print( "[dbProps] There are no properties." );
    else FreeSQLQuery( see_dbProperties );

        QuerySQL( dbProperties,
            format(@"UPDATE [Properties] SET
                [ID]=%i,
                [Price]=%i,
                [Owner]='%s',
                [Sharing]='%s',
                [Description]='%s',
                [x]=%f,
                [y]=%f,
                [z]=%f,
                [World]=%i
                WHERE [Name]='%s';",
                prop[ id ].ID.tointeger(), price.tointeger(), owner.tostring(), sharing.tostring(), description.tostring(), x.tofloat(), y.tofloat(), z.tofloat(), world.tointeger(),
                name.tostring()
            )
        );
               
                prop[ id ].ID = prop[ id ].ID;
                prop[ id ].Name = name;
                prop[ id ].Price = price;
                prop[ id ].Owner = owner;
                prop[ id ].Sharing = sharing;
                prop[ id ].Description = description;
                prop[ id ].x = x;
                prop[ id ].y = y;
                prop[ id ].z = z;
                prop[ id ].World = world;
}

function CreateProperty( name, price, x, y, z, world )
{
    local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
    if( !see_dbProperties ) return print( "[dbProps] There are no properties." );
    else FreeSQLQuery( see_dbProperties );
   
        local p = CreatePickup( PROP_MODEL_FORSALE, world, 0, x, y, z, 255, true );
        if( p )
        {
            prop[ p.ID ] = null;
            prop[ p.ID ] = Property(); // important
            prop[ p.ID ].ID = _srv_Properties;
            prop[ p.ID ].Name = name;
            prop[ p.ID ].Price = price;
            prop[ p.ID ].Owner = NO_OWNER_MSG;
            prop[ p.ID ].Sharing = NO_SHARING_MSG;
            prop[ p.ID ].Description = NO_DESCRIPTION_MSG;
            prop[ p.ID ].x = x;
            prop[ p.ID ].y = y;
            prop[ p.ID ].z = z;
            prop[ p.ID ].World = world;
           
            local   query = format( "INSERT INTO Properties ( ID, Name, Price, Owner, Sharing, Description, x, y, z, World ) VALUES ( %i, '%s', %i, '%s', '%s', '%s', %f, %f, %f, %i )",
                        _srv_Properties, name, price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, x, y, z, world );
                       
            QuerySQL( dbProperties, query );
           
            _srv_Properties += 1;
        }
}

function ReloadProperty( property, model )
{
    if( typeof( property ) == "instance" )
    {
        local   pid = property.ID,
                dbpid = prop[ pid ].ID,
                name = prop[ pid ].Name,
                see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
               
        if( !see_dbProperties ) return print( "[dbProps] There are no properties." );
        else FreeSQLQuery( see_dbProperties );

        local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Name='" + escapeSQLString( name ) + "'" );
        if( listQuery )
        {
                FindPickup( pid ).Remove();
                prop[ pid ] = null;
           
            local p = CreatePickup( model, GetSQLColumnData( listQuery, 9), 0, GetSQLColumnData( listQuery, 6 ), GetSQLColumnData( listQuery, 7 ), GetSQLColumnData( listQuery, 8 ), 255, true );
            if( p )
            {
                local id = p.ID;
                prop[ id ] = null;
                prop[ id ] = Property(); // important
                prop[ id ].ID = dbpid;
                prop[ id ].Name = GetSQLColumnData( listQuery, 1 );
                prop[ id ].Price = GetSQLColumnData( listQuery, 2 );
                prop[ id ].Owner = GetSQLColumnData( listQuery, 3 );
                prop[ id ].Sharing = GetSQLColumnData( listQuery, 4 );
                prop[ id ].Description = GetSQLColumnData( listQuery, 5 );
                prop[ id ].x = GetSQLColumnData( listQuery, 6 );
                prop[ id ].y = GetSQLColumnData( listQuery, 7 );
                prop[ id ].z = GetSQLColumnData( listQuery, 8 );
                prop[ id ].World = GetSQLColumnData( listQuery, 9 );
            }
           
            FreeSQLQuery( listQuery );
        }
    }
}

function RemoveProperty( property )
{
    if( typeof( property ) == "instance" )
    {
        local   id = property.ID,
                dbid = prop[ id ].ID,
                name = prop[ id ].Name,
                see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
       
        if( !see_dbProperties ) return print( "[dbProps] There are no properties to load." );
        else FreeSQLQuery( see_dbProperties );
       
        local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Name='" + escapeSQLString( name ) + "'" );
        if( listQuery )
        {
            FindPickup( id ).Remove();
            prop[ id ] = null;
           
            QuerySQL( dbProperties, "DELETE FROM 'Properties' WHERE Name='" + name + "'" );
            FreeSQLQuery( listQuery );
        }
    }
}

function OwnedProperties( player )
{
    if( FindPlayer( player.ID ) )
    {
        local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
        if( !see_dbProperties ) return print( "[dbProps] There are no properties to load." );
        else FreeSQLQuery( see_dbProperties );
       
        local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Owner='" + escapeSQLString( player.Name ) + "'" );
        if( listQuery )
        {
            local res = "";
            while( GetSQLColumnData( listQuery, 1 ) )
            {   
                res += GetSQLColumnData( listQuery, 1 ) + ", ";
                GetSQLNextRow( listQuery );
            }
            FreeSQLQuery( listQuery );
            res = res.slice( 0, res.len() - 2 );
            return res;
        }
        else return NO_PROP_OWNED;
    }
}

function SharedProperties( player )
{
    if( FindPlayer( player.ID ) )
    {
        local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
        if( !see_dbProperties ) return print( "[dbProps] There are no properties to load." );
        else FreeSQLQuery( see_dbProperties );
       
        local listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties' WHERE Sharing='" + escapeSQLString( player.Name ) + "'" );
        if( listQuery )
        {
            local res = "";
            while( GetSQLColumnData( listQuery, 1 ) )
            {   
                res += GetSQLColumnData( listQuery, 1 ) + ", ";
                GetSQLNextRow( listQuery );
            }
            FreeSQLQuery( listQuery );
            res = res.slice( 0, res.len() - 2 );
            return res;
        }
        else return NO_PROP_SHARED;
    }
}

function LoadProperties( )
{
    print( "[dbProps] Loading properties..." );
    local modelid, listQuery = QuerySQL ( dbProperties, "SELECT * FROM 'Properties'" );
    if( listQuery )
    {
        while( GetSQLColumnData( listQuery, 1 ) )
        {
            modelid = PROP_MODEL_FORSALE;
            if( GetSQLColumnData( listQuery, 3 ) != NO_OWNER_MSG ) modelid = PROP_MODEL_BOUGHT;
            local p = CreatePickup( modelid, GetSQLColumnData( listQuery, 9), 0, GetSQLColumnData( listQuery, 6 ), GetSQLColumnData( listQuery, 7 ), GetSQLColumnData( listQuery, 8 ), 255, true );
            if( p )
            {
                local count = _srv_Properties;
               
                prop[ count ] = Property(); // important
                prop[ count ].ID = p.ID;
                prop[ count ].Name = GetSQLColumnData( listQuery, 1 ).tostring();
                prop[ count ].Price = GetSQLColumnData( listQuery, 2 ).tointeger();
                prop[ count ].Owner = GetSQLColumnData( listQuery, 3 ).tostring();
                prop[ count ].Sharing = GetSQLColumnData( listQuery, 4 ).tostring(),
                prop[ count ].Description = GetSQLColumnData( listQuery, 5 ).tostring();
                prop[ count ].x = GetSQLColumnData( listQuery, 6 ).tofloat();
                prop[ count ].y = GetSQLColumnData( listQuery, 7 ).tofloat();
                prop[ count ].z = GetSQLColumnData( listQuery, 8 ).tofloat();
                prop[ count ].World = GetSQLColumnData( listQuery, 9 ).tointeger();
                _srv_Properties += 1;
            }
            else print( "[dbProps] Couldn't load property with name: " + GetSQLColumnData( listQuery, 1 ) );
            GetSQLNextRow( listQuery );
        }
    }
   
    print( "[dbProps] " + _srv_Properties + " properties have been loaded from the database." );
}
3. Now we have to deal with the main script, so put this under onScriptLoad():
dofile( "scripts/BasicPropertySystem.nut" );
LoadProperties();

Sebastian

#2
4. onPlayerCommand( player, command, text )
local cmd = command.tolower();

       else if( cmd == "addprop" )
        {
            if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
            else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
            else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
            else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
            else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
            else
            {
                local   price = GetTok( text, " ", 1 ).tointeger(),
                        name = GetTok( text, " ", 2, NumTok( text, " " ) );
                 
                CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )                 
                pMSG( "[dbProperties]: Property " + name + " was created.", player);
            }
        }
       
        else if( cmd == "delprop" )
        {
            local   lp = lastPickupPickedUp[ player.ID ],
                    pos, plp, lpid;
                   
            if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
            else if( lp == null ) return pMSG( "Error - You must be near property.", player );
            else
            {
                if( !FindPickup( lp ) ) return pMSG( "Error - Pickup no longer exists..", player );
                else
                {
                    plp = FindPickup( lp );
                    lpid = plp.ID;
                    pos = plp.Pos;
                   
                    if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - You must be near property.", player );
                    else
                    {
                        pMSG( "Done! You removed property: " + prop[ lpid ].Name, player );
                        RemoveProperty( plp );
                    }
                }
            }
        }
       
        else if( cmd == "myprops" )
        {
            pMSG( "Your owned properties: " + RGB_GREY + OwnedProperties( player ), player );
            pMSG( "Your shared properties: " + RGB_GREY + SharedProperties( player ), player );
        }
       
        else if( cmd == "buyprop" )
        {
            local   lp = lastPickupPickedUp[ player.ID ],
                    pos, plp, lpid;
                   
            if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
            else if( lp == null ) return pMSG( "Error - There is no property around.", player );
            else
            {
                if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
                else
                {
                    plp = FindPickup( lp );
                    lpid = plp.ID;
                    pos = plp.Pos;
                   
                    if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
                    else if( prop[ lpid ].Owner != NO_OWNER_MSG ) return pMSG( "Error - This property is not forsale.", player );
                    else if( player.Cash < prop[ lpid ].Price ) return pMSG( "Error - Not enough money.", player );
                    else
                    {
                        pMSG( "Congratz! You bought " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
                        player.Cash -= prop[ lpid ].Price;
                       
                        UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, player.Name, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
                        ReloadProperty( plp, PROP_MODEL_BOUGHT );
                    }
                }
            }
        }
       
        else if( cmd == "sellprop" )
        {
            local   lp = lastPickupPickedUp[ player.ID ],
                    pos, plp, lpid;
                   
            if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
            else if( lp == null ) return pMSG( "Error - There is no property around.", player );
            else
            {
                if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
                else
                {
                    plp = FindPickup( lp );
                    lpid = plp.ID;
                    pos = plp.Pos;
                   
                    if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
                    else if( prop[ lpid ].Owner != player.Name ) return pMSG( "Error - You don't own this property.", player );
                    else
                    {
                        pMSG( "Done! " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " was sold for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
                        player.Cash += prop[ lpid ].Price;
                        UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
                        ReloadProperty( plp, PROP_MODEL_FORSALE );
                    }
                }
            }
        }
       
        else if( cmd == "shareprop")
        {
            if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <player>", player );
            else
            {
                local   propid = lastPickupPickedUp[ player.ID ],
                        plr = FindPlayer( text );
                       
                if( !plr ) return pMSG( "Error - Unknown/Offline player.", player );
                else if( !propid ) return pMSG( "Error - There is no property around.", player );
                else if( !FindPickup( propid ) ) return pMSG( "Error - There is no property around.", player );
                else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
                else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
                else if( !PlayerToPoint( plr, 3, player.Pos.x, player.Pos.y, player.Pos.z ) ) return pMSG( "Error - Player must be near you.", player );
                else if( player.ID == plr.ID ) return pMSG( "Error - Come on.. make room for others.", player );
                else if( prop[ propid ].Sharing == plr.Name ) return pMSG( "Error - You are already sharing it with " + plr.Name, player );
                else
                {
                    UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, plr.Name, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );

                    pMSG( "Done! You are now sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " with " + RGB_GREY + prop[ propid ].Sharing + RGB_BLUE + " !", player );
                    pMSG( "Woah! " + RGB_GREY + player.Name + RGB_BLUE + " just shared '" + RGB_GREY + prop[ propid ].Name + RGB_BLUE + "' with you !", plr );
                }
            }
        }
       
        else if( cmd == "unshareprop" )
        {
            local   propid = lastPickupPickedUp[ player.ID ],
                    pos = FindPickup( propid ).Pos;
               
            if( !propid ) return pMSG( "Error - There is no property around.", player );
            else if( !FindPickup( propid ) ) return pMSG( "Error - Property does not exist.", player );
            else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
            else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
            else if( prop[ propid ].Sharing == NO_SHARING_MSG ) return pMSG( "Error - You didn't share this property, yet.", player );
            else
            {
                UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, NO_SHARING_MSG, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );

                pMSG( "Done! You are not anymore sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " !", player );
            }
        }

5. onPickupPickedUp( player, pickup )
    if( pickup.Model == 407 || pickup.Model == 406  )
    {
        if( prop[ pickup.ID ] != null )
        {
            local   id = pickup.ID,
                    propid = prop[ id ].ID,
                    name = prop[ id ].Name,
                    price = prop[ id ].Price,
                    owner = prop[ id ].Owner,
                    sharing = prop[ id ].Sharing,
                    description = prop[ id ].Description;
                   
            lastPickupPickedUp[ player.ID ] = id;   
            return pMSG( "Property ID: " + RGB_GREY + propid + RGB_BLUE + " Name: " + RGB_GREY + name + RGB_BLUE + " Price: " + RGB_GREY + price + RGB_BLUE + " Owner: " + RGB_GREY + owner + RGB_BLUE + " Sharing: " + RGB_GREY + sharing + RGB_BLUE + " Description: " + RGB_GREY + description, player );
        }
    }

[spoiler=PlayerToPoint() function if you don't have it]
function PlayerToPoint( player, radi, x, y, z )
{
    local tempposx, tempposy, tempposz;
    tempposx = player.Pos.x -x;
    tempposy = player.Pos.y -y;
    tempposz = player.Pos.z -z;
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
[/spoiler]

PS: To buy/sell/del/share/unshare a property you need to be near it's pickup.
PS2: You must place CreateProperties before any other CreatePickup() !
PS3: Limits and Database location is specified in top of BasicPropertySystem.nut.
(be sure you know what you doin' when changing those constants

Cool

Nice Work sseebbyy Why all people Releasing things in sqlite You guys should post in both :P (Just suggestion)
No problem I will convert it for my server

Anik

Quote from: happymint2 on Apr 13, 2017, 08:05 AMNice Work sseebbyy Why all people Releasing things in sqlite You guys should post in both :P (Just suggestion)
No problem I will convert it for my server
cuz most of the vcmp scripter use sqlite for their server. Btw it isn't much hard to make it work with mysql.

KAKAN

Quote from: Cool on Apr 13, 2017, 08:05 AMNice Work sseebbyy Why all people Releasing things in sqlite You guys should post in both :P (Just suggestion)
No problem I will convert it for my server
A few reasons, most important one is that its self-sustained. It doesn't need a backend server. How do think VCMP people would be able to setup a MySQL server without any problems even if there's a tutorial for it?
I myself prefer SQLite over MySQL, because, VCMP is not worth it. You won't be having more than a few 100 accounts on your server, so, there's no need of MySQL.
oh no

.

The need for MySQL is necessary if you need to access the database from places other than the server. Like having a web-stats page. Then you'd need MySQL because SQLite would have some struggles with concurrency. Other than that, you simply don't need MySQL. Period.
.

Cool

Quote from: S.L.C on Apr 13, 2017, 11:06 AMThe need for MySQL is necessary if you need to access the database from places other than the server. Like having a web-stats page. Then you'd need MySQL because SQLite would have some struggles with concurrency. Other than that, you simply don't need MySQL. Period.
i also need mysql for that As SLC Said

!

Quote from: Cool on Apr 13, 2017, 11:47 AMi also need mysql for that As SLC Said
SLC didn't mention you in his post + are you requesting mysql database? ???

Discord: zeus#5155

Cool

Quote from: zeus on Apr 13, 2017, 12:01 PM
Quote from: Cool on Apr 13, 2017, 11:47 AMi also need mysql for that As SLC Said
SLC didn't mention you in his post + are you requesting mysql database? ???
what???

kennedyarz

#10
Nice work @sseebbyy

and a suggestion

function pMSG( text, player )
{
    return MessagePlayer( RGB_BLUE + text.tostring() );
}

Change For

function pMSG( text, player )
{
    return MessagePlayer( RGB_BLUE + text.tostring() ,player);
}

And I think this is necessary
lastPickupPickedUp <- array( GetMaxPlayers(), null )thanks

Sebastian

Hm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?

Quote from: kennedyarz on Apr 13, 2017, 12:36 PMNice work @sseebbyy

and a suggestion

Great pointed @kennedyarz ! Thank you very much !
First post will be updated asap, so check it out.

Cool

Quote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Yes we cant access our db if we want upload webstats on freehost or something else there is many reasons thats why i converted my full script to mysql

KAKAN

Quote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Well, you can't create 2 connections to the same SQLite database for querying. But, what you can do is, create 1 connection for the main server, and others for just selecting, that's what SQLite can do.
The real problem is that, your other application should be able to access the database or it can't work.

Quote from: Cool on Apr 13, 2017, 01:13 PM
Quote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Yes we cant access our db if we want upload webstats on freehost or something else there is many reasons thats why i converted my full script to mysql
You can do that, if you have some cool idea of how to.
oh no

Cool

Quote from: KAKAN on Apr 13, 2017, 01:51 PM
Quote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Well, you can't create 2 connections to the same SQLite database for querying. But, what you can do is, create 1 connection for the main server, and others for just selecting, that's what SQLite can do.
The real problem is that, your other application should be able to access the database or it can't work.

Quote from: Cool on Apr 13, 2017, 01:13 PM
Quote from: sseebbyy on Apr 13, 2017, 01:03 PMHm... didn't know MySQL is better for online stats...
There is a problem in using SQLite for online things or what ?
Yes we cant access our db if we want upload webstats on freehost or something else there is many reasons thats why i converted my full script to mysql
You can do that, if you have some cool idea of how to.
for finding ideas and then implementing it why dont use mysql its better and simple choice :D