file include to Y_INI or DINI or SQL
#1

i got my gm using for read and create files #include <file> i mean i am not using any other includes just sa-mp default, is there a way to convert it to y_ini or dini or directly to SQL(slice's bud or a_sampdb)?
Reply
#2

There is no "automatic" way if that's what you're asking, you'll have to convert it yourself. I'll recommend SQL if you're actually planning to convert it, but if you don't have the timeto learn MySQL or SQLite, then I suggest you to completely stay away from DINI and use Y_INI.
Reply
#3

yes, i am asking for a way to convert it by myself, i already got some basics of SQLite with bud include, just want to know how to convert i mean a little example atleast...
Reply
#4

This is probably the best tutorial I could provide you for SQLite - https://sampforum.blast.hk/showthread.php?tid=449536

If you want an actual example, post a part of your code and I'll show you how to convert it.
Reply
#5

thank you, if you can show me an example would be great, here is the config and the onplayerlogin from my gamemode, i mean i need to this only on this 2 files pen01.cfg and username.cer

EDIT: i mean only for users not for other things, i want to make it in sqlite for get a easier scripting with tops and stuff

PHP код:
public OnPlayerLogin(playerid,const string[])
{
    if (
gdebug >= 1){printf("DEBUG OnPlayerLogin(%d) (%s)"playerid,string);}
    new 
string2[64];
    new 
playername2[MAX_PLAYER_NAME];
    
//new password[64];
    
new tmp2[256];
    
/*
    if (gPlayerSpawned[playerid] == 1)
    {
        SetPlayerHealth(playerid,0.0);
    }
    */
    
GetPlayerName(playeridplayername2sizeof(playername2));
    
format(string2sizeof(string2), "%s.cer"playername2);
    new 
Filefile fopen(string2io_read);
    if (
file)
    {
        new 
valtmp[128];
        
fread(filevaltmp);strmid(PlayerInfo[playerid][pPassword], valtmp0strlen(valtmp)-1255);
        if (
gdebug){printf("DEBUG password from file= (%s) pass enterd =  (%s)",PlayerInfo[playerid][pPassword] ,string );}
        
//fread(file, valtmp);strmid(password, valtmp, 0, strlen(string), 255);
        
if ((strcmp(PlayerInfo[playerid][pPassword], stringtruestrlen(valtmp)-1) == 0))// && (strlen(string) == strlen(password)))
        
{
            
fread(filevaltmp);PlayerInfo[playerid][pCash] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAccount] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAdmin] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pLevel] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pExp] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][gPupgrade] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pKills] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pCB] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pHW] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pSR] = strval(valtmp);DelPrint(valtmp);
            if(
PlayerInfo[playerid][pKills] < 0){PlayerInfo[playerid][pKills] = 0;}//patch
            
if(PlayerInfo[playerid][pCB] < 0){PlayerInfo[playerid][pCB] = 0;}//patch
            
if(PlayerInfo[playerid][pHW] < 0){PlayerInfo[playerid][pHW] = 0;}//patch
            
if(PlayerInfo[playerid][pSR] < 0){PlayerInfo[playerid][pSR] = 0;}//patch
            
fread(filevaltmp);PlayerInfo[playerid][pWA] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pPEN] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pGun1] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pGun2] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pGun3] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pGun4] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pGun5] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pGun6] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAmmo1] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAmmo2] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAmmo3] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAmmo4] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAmmo5] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pAmmo6] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pSHealth] = floatstr(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pHealth] = floatstr(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pPos_x] = floatstr(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pPos_y] = floatstr(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pPos_z] = floatstr(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pInt] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pLocal] = strval(valtmp);DelPrint(valtmp);
            if(
PlayerInfo[playerid][pModel] == 264){fread(filevaltmp);PlayerInfo[playerid][pTeam] = strval(valtmp);DelPrint(valtmp);}else{fread(filevaltmp);}
            if(
PlayerInfo[playerid][pModel] == 264){fread(filevaltmp);PlayerInfo[playerid][pModel] = strval(valtmp);DelPrint(valtmp);}else{fread(filevaltmp);}
            
fread(filevaltmp);PlayerInfo[playerid][pPnumber] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pPhousekey] = strval(valtmp);DelPrint(valtmp);
            
fread(filevaltmp);PlayerInfo[playerid][pPbiskey] = strval(valtmp);DelPrint(valtmp);
            
fclose(file);
            
ResetPlayerMoney(playerid);
            
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
            
//if (gdebug){printf("DEBUG phonenumber = %d",pnumber);}
            
if(PlayerInfo[playerid][pLevel] == -999//autoban
            
{
                
Ban(playerid);
            }
            
SendClientMessage(playeridCOLOR_GREEN"Welcome to Public Enemy: Los Santos Server, hope you will enjoy playing here.");
            
SendClientMessage(playeridCOLOR_YELLOW"For more informations about this server check /help, /news & /credits");
            
SendClientMessage(playeridCOLOR_WHITE"This server is a non-profit project, admins will be chosen when there will be players.");
            
SendClientMessage(playeridCOLOR_YELLOWmotd);
            
format(string2sizeof(string2), "SERVER: Welcome %s",playername2);
            
SendClientMessage(playeridCOLOR_WHITE,string2);
            
SetPlayerWeapons(playerid);
            
printf("%s has logged in",playername2);
            if (
PlayerInfo[playerid][pAdmin] > 0)
            {
                
format(string2sizeof(string2), "SERVER: You are logged in as a level %d admin",PlayerInfo[playerid][pAdmin]);
                
SendClientMessage(playeridCOLOR_WHITE,string2);
            }
            
SetSpawnInfo(playerid1PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
   if(
gTeam[playerid] == 0)
            {
                
gTeam[playerid] = 3;
            }
            else
            {
                
gTeam[playerid] = PlayerInfo[playerid][pTeam];
            }
            
gPlayerLogged[playerid] = 1;
            if(
accountplay)
            {
                
gPlayerSpawned[playerid] = 0;
            }
            
//SpawnPlayer(playerid);
            
GetPlayerName(playeridplayername2sizeof(playername2));
            
format(tmp2sizeof(tmp2), "~w~Welcome ~n~~y~   %s"playername2);
            
DateProp(playerid);
            
GameTextForPlayer(playeridtmp250001);
            return 
1;
        }
        else
        {
            
ShowPlayerDialog(playerid9DIALOG_STYLE_PASSWORD"{076F13}Login your account""{F0FF00}Welcome back,\n{FFFFFF}put your password here\nfor login in Public Enemy: Los Santos server.\n{FF0000}Wrong Password.""Login""");
            
printf("%s is hacking a password",playername2);
            
fclose(file);
            
//return 1;
        
}
        return 
1;
    }
    else
    {
        
SendClientMessage(playeridCOLOR_WHITE"SERVER: You do not have an account, create one");
        
ShowPlayerDialog(playerid10DIALOG_STYLE_PASSWORD"{076F13}Create an account""{F0FF00}Welcome,\n{FFFFFF}choose your password\nfor register in Public Enemy: Los Santos server.""Create""");
    }
    return 
1;

Reply
#6

Don't expect SQL to be a plug-and-play kind of thing. The 'L' in SQL stands for language. If you spent 2 months learning the basics of PAWN then you should at least spend just as much learning the basics of SQL. Reading a few tutorials and trying yourself would be a good way to start.

[ INSERT ****** QUOTE ABOUT SQL BEING A LANGUAGE ON ITS OWN HERE ] - What I said above is roughly that. There is someone on the forum with that quote in their signature. Can't seem to remember who it was.
Reply
#7

i know basics of sqlite, i just need to know how to insert sqlite in pawno, i know to insert sqlite in php only..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)