How to load?
#1

Hello,
I am using Windows32's MySQL Gamemode, but I was wondering how I would load and save stuff..

Like Y_INI you use:
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
Stuff like that. How would I do stuff like this.
Reply
#2

Write
pawn Код:
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
Read
pawn Код:
INI_Int(File,"Cash");

Or you want to know mysql?
Reply
#3

Im using MySQL >...<
Reply
#4

Код:
SELECT `money` FROM `players` WHERE `nick`='%s'
Код:
UPDATE `players` SET `money` = '%d' WHERE `nick` = '%s'
Depends on the database structure.

Dont forget to download data from a query using mysql_fetch_row
Reply
#5

This tutorial explains step by step

https://sampforum.blast.hk/showthread.php?tid=159785
Reply
#6

Head to stock load_player_data(playerid) and create this
Код:
mysql_fetch_field_row(datastr,"Name here so you know what it is"); PlayerInfo[playerid][VariableHere] = strval(datastr);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)