sscanf(savingstring,"p<|> iiis iii",
Playerdata[playerid][Skin],
Playerdata[playerid][Adminlevel],
Playerdata[playerid][Vip],
Playerdata[playerid][Vipexp],
money,
Playerdata[playerid][Level],
Playerdata[playerid][Kill],
Playerdata[playerid][Death]);
new unused[5];
sscanf(savingstring,"p<|>iiiiiisiiiii",
unused[0],
unused[1],
unused[3],
Playerdata[playerid][Skin],
Playerdata[playerid][Adminlevel],
Playerdata[playerid][Vip],
Playerdata[playerid][Vipexp],
unused[4],
money,
Playerdata[playerid][Level],
Playerdata[playerid][Kill],
Playerdata[playerid][Death]);
sscanf(savingstring,"p<|>e<{iii}iiis[STRLEN]{i}iiii>", Playerdata[playerid]);
MySQL_Login(playerid)
{
new query[250], pname[24], savingstring[250], money;
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT * FROM users WHERE name='%s' LIMIT 1", pname);
mysql_query(query);
mysql_store_result();
if(mysql_fetch_row_format(savingstring))
{
sscanf(savingstring,"p<|>e<{iii}iiis[19]{i}iiii>",
Playerdata[playerid][Skin],
Playerdata[playerid][Adminlevel],
Playerdata[playerid][Vip],
Playerdata[playerid][Vipexp],
money,
Playerdata[playerid][Level],
Playerdata[playerid][Kill],
Playerdata[playerid][Death]);
}
mysql_free_result();
format(string, sizeof(string), "Welcome back %s!", pname);
SendClientMessage(playerid, COLOR_YELLOW2, string);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, money);
SetPlayerScore(playerid, Playerdata[playerid][Level]);
if(Playerdata[playerid][Adminlevel] > 0)
{
format(string, sizeof(string), "You are a staff member, rank: %i", Playerdata[playerid][Adminlevel]);
SendClientMessage(playerid, COLOR_YELLOW2, string);
}
SetSpawnInfo(playerid, Playerdata[playerid][Skin], 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
return 1;
}
CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(225) NOT NULL, `password` text NOT NULL, `skin` int(250) NOT NULL DEFAULT '101', `adminlevel` int(4) NOT NULL DEFAULT '0', `vip` int(3) NOT NULL DEFAULT '0', `vipexp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `ip` varchar(20) NOT NULL, `money` int(225) NOT NULL DEFAULT '0', `level` int(10) NOT NULL DEFAULT '1', `kill` int(10) NOT NULL DEFAULT '1', `death` int(10) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ; |
enum DATA
{
...
...
Vipexp[STRLEN]
...
...
};
new PlayerData[MAX_PLAYERS][DATA];
Do it like this:
PHP код:
|