Changing from Y_INI to MySQL
#1

I was wondering if anyone could show me how to change from Y_INI to Mysql. I DO NOT want you to do it for me. I want you to show me how to do one or two and explain so I can do the rest. I've never used mySQL before so please explain in details.
Quote:

Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.

Y_INI Code

Enum:
pawn Код:
enum pInfo
{
    pName[MAX_PLAYER_NAME],
    pPass,
    pCash,
    pSkin,
    pAdmin,
    pKills,
    pDeaths,
    aJailed,
    bool:MaterialJob,
    pMaterial,
    pAdress[16]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Loading data
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Name", PlayerInfo[playerid][pName]);
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    INI_Int("aJailed",PlayerInfo[playerid][aJailed]);
    INI_Bool("Material_Job",PlayerInfo[playerid][MaterialJob]);
    INI_Int("Materials",PlayerInfo[playerid][pMaterial]);
    INI_Int("IP_Adress",PlayerInfo[playerid][pAdress]);
    return 1;
}
Saving on Disconnect:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteString(File, "Name", GetName(playerid) );
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid) );
    INI_WriteInt(File,"aJailed",PlayerInfo[playerid][aJailed]);
    INI_WriteBool(File,"Material_Job",PlayerInfo[playerid][MaterialJob]);
    INI_WriteInt(File,"Materials",PlayerInfo[playerid][pMaterial]);
    INI_WriteString(File,"IP_Adress",PlayerInfo[playerid][pAdress]);
    INI_Close(File);
MySQL Database



I was wondering if someone could show me and explain in great detail how to save a few of these with MySQL
Note: If you need any extra information just ask. I cut out my IP for security reasons.
Reply
#2

Sorry to bump but I want to add that I have MySQL connect set up but that's it i'm looking for help transfering from Y_INI to Mysql
Reply
#3

Quote:
Originally Posted by lramos15
Посмотреть сообщение
I've never used mySQL before so please explain in details.
Then what the hell are you doing? You don't just randomly start using MySQL w/o knowing the SQL language! The MySQL plugins that are available are NOT for people to learn SQL with- they're for people who already know SQL to use. SQL has a lot more vulnerabilities than people think and if you don't know how to use the language, then you shouldn't be trying to put people's information on a database with it! That's almost as bad as not hashing and salting your user passwords.
Reply
#4

As RealCop said. Maybe look at some MySQL tutorials on how to use it then try it. However, once you're confident on HOW too, send me a PM and I'll be more than glad to help you. I'll not do it for you, but help you along the way and tell you what you need to do. Otherwise, you'll never learn.
Reply
#5

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Then what the hell are you doing? You don't just randomly start using MySQL w/o knowing the SQL language! The MySQL plugins that are available are NOT for people to learn SQL with- they're for people who already know SQL to use. SQL has a lot more vulnerabilities than people think and if you don't know how to use the language, then you shouldn't be trying to put people's information on a database with it! That's almost as bad as not hashing and salting your user passwords.
Because I want to Learn that's the point of this topic I want someone to show me how to do one so I can lean off of it
Reply
#6

Quote:
Originally Posted by lramos15
Посмотреть сообщение
Because I want to Learn that's the point of this topic I want someone to show me how to do one so I can lean off of it
The thing is that nobody really has time to sit down for a couple hours and teach you everything to do with MySQL. Your best bet is to go and read through tutorials, make a few scripts and critique yourself.
Reply
#7

I just want someone to show me how to change one of my Y_INI things to mysql
Reply
#8

Read my post above. ¬_¬
Reply
#9

Quote:
Originally Posted by MoshuLabs
Посмотреть сообщение
Read my post above. ¬_¬
Can you link me to a tutorial please
Reply
#10

1st, This is not a support forum for SQL, since it's not releated to SA-MP. Your script is, but learning you it ain't.
Second) Go to a SQL forum, and see how mysql is working, or even watch videos.
3rd) [ame]http://www.youtube.com/watch?v=6pbxQQG25Jw[/ame]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)