SA-MP Forums Archive
Group System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Group System (/showthread.php?tid=548323)



Group System - JaKe Elite - 29.11.2014

So far i've studied on using SQLite, But there is one thing i am trying to study, How do you use SQLite for saving Groups? Such as looping them to save them and stuffs? I've already done creating the tables, rows for the Group.

Any idea guys?

And an additional question from my topic which is getting nothing.

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
ObjectID of this?



Name of the object? / ID of it?



Re: Group System - iiNzTicTx - 29.11.2014

Object ID: 2405.

Not sure about SQLite, as I haven't done CPP in a while (about 4-5 years).


Re: Group System - JaKe Elite - 29.11.2014

Thanks, still waiting for the SQLite issue.


Re: Group System - JaKe Elite - 29.11.2014

Bump
4char


Re: Group System - Raweresh - 29.11.2014

I don't know what do you mean about saving groups, show code, if you try do something alone.


Re: Group System - bogushas - 29.11.2014

PHP код:
stock saveBusiness(id)
{
    
format(g_szBuffersizeof g_szBuffer
    
"UPDATE "MySQL_BUSINESS_TABLE" SET \
\
        Savininkas = %i,     \
        bizniov = %i,         \
        PirkimoBusena = %i,    \
        Kaina = %f,            \
        Pelnas = %f,        \
        PardavimoKaina = %f,\
        mokestis = %i\
\
    WHERE ID = %i"
,
    
verslas[id][vSavininkas],
    
verslas[id][bName], 
    
verslasid ][ bNupirktas ], 
    
verslasid ][ vKaina ],
    
verslasid ][ vPelnas ],
    
verslasid ][ PardavimoKaina ],
    
verslasid ][ mokamVersla ],
    
verslasid ][ fromSQL ]);
    
sql_query(sqlg_szBufferQUERY_THREADED); // threaded naudoti kai neimi duomenų iљ mysql

and then:
PHP код:
for( new xMAX_VERSLAIx++ )
    {
        
saveBusiness);
    } 



Re: Group System - dominik523 - 29.11.2014

I would try with this:
pawn Код:
enum gInfo
{
    gName[24],
    members
// ...
};
new GroupInfo[MAX_GROUPS][gInfo];
// saving function
for(new i = 0; i<MAX_GROUPS; i++)
{
    format(string, sizeof(string), "UPDATE `groups` SET `Name`='%s' WHERE `GroupID`='%d'", i, DB_Escape(GroupInfo[i][gName]));
            db_free_result(db_query(GroupDatabase, string));

}



Re: Group System - JaKe Elite - 29.11.2014

Alright, How about reading the saved groups? How would i do that? Do i have to loop every GROUP while loading the data?