PDA

View Full Version : How to load?


BleverCastard
26/04/2012, 05:02 PM
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.

ViniBorn
26/04/2012, 05:04 PM
Write
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
Read
INI_Int(File,"Cash");


Or you want to know mysql?

BleverCastard
26/04/2012, 05:06 PM
Im using MySQL >...<

MP_Spec
26/04/2012, 05:10 PM
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

ViniBorn
26/04/2012, 05:10 PM
This tutorial explains step by step

http://forum.sa-mp.com/showthread.php?t=159785

Elysian`
26/04/2012, 05:25 PM
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);