enum UserEnum
{
//saved data
u_admin,
u_vip,
u_kills,
u_deaths,
u_score,
u_money,
u_hours,
u_minutes,
u_seconds,
//not saved data
u_attempts,
u_sessionkills,
u_sessiondeaths,
u_spree,
//conditions data
u_jailtime,
u_mutetime,
u_cmutetime,
u_specdata[2],
Float:u_specpos[4],
u_vehicle,
u_warnings,
public OnFilterScriptInit()
{
print("------------------------------------------------");
print("Running GAdmin System | Developed by Gammix | Loaded...");
print("------------------------------------------------");
BUD::Setting(opt.Database, LOCATION_DATABASE);
BUD::Setting(opt.KeepAliveTime, 3000);
BUD::Initialize();
BUD::VerifyColumn("ip", BUD::TYPE_STRING);
BUD::VerifyColumn("joindate", BUD::TYPE_STRING);
BUD::VerifyColumn("laston", BUD::TYPE_STRING);
BUD::VerifyColumn("admin", BUD::TYPE_NUMBER);
BUD::VerifyColumn("vip", BUD::TYPE_NUMBER);
BUD::VerifyColumn("kills", BUD::TYPE_NUMBER);
BUD::VerifyColumn("deaths", BUD::TYPE_NUMBER);
BUD::VerifyColumn("score", BUD::TYPE_NUMBER);
BUD::VerifyColumn("money", BUD::TYPE_NUMBER);
BUD::VerifyColumn("hours", BUD::TYPE_NUMBER);
BUD::VerifyColumn("minutes", BUD::TYPE_NUMBER);
BUD::VerifyColumn("seconds", BUD::TYPE_NUMBER);
BUD::VerifyColumn("logged", BUD::TYPE_NUMBER);
BUD::VerifyColumn("autologin", BUD::TYPE_NUMBER);
SetTimer("PunishmentHandle", 1000, true);
CMD:stats(playerid, params[])
{
new target;
if(sscanf(params, "u", target))
{
target = playerid;
SendClientMessage(playerid, COLOR_KHAKI, "TIP: You can also view other players stats by /stats [player]");
}
if(! IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_RED, "ERROR: The specified player is not conected.");
GetPlayerConnectedTime(target, gUser[target][u_hours], gUser[target][u_minutes], gUser[target][u_seconds]);
//Stats stuff !:D!
new DIALOG[676];
new string[156];
format(string, sizeof(string), ""WHITE"You are now viewing "LIME"%s's [id: %i]"WHITE", statics:\n\n", ReturnPlayerName(target), target);
strcat(DIALOG, string);
format(string, sizeof(string), ""SAMP_BLUE"Kills: "CORAL"%i\n", gUser[target][u_kills]);
strcat(DIALOG, string);
format(string, sizeof(string), ""SAMP_BLUE"Deaths: "CORAL"%i\n", gUser[target][u_deaths]);
strcat(DIALOG, string);
format(string, sizeof(string), ""SAMP_BLUE"Session Kills: "CORAL"%i\n", gUser[target][u_sessionkills]);
strcat(DIALOG, string);
format(string, sizeof(string), ""SAMP_BLUE"Session Deaths: "CORAL"%i\n", gUser[target][u_sessiondeaths]);
strcat(DIALOG, string);
format(string, sizeof(string), ""SAMP_BLUE"Killing Spree: "CORAL"%i\n", gUser[target][u_spree]);
strcat(DIALOG, string);
//calculate Kill/Deaths ratio
new Float:ratio;
if(gUser[target][u_deaths] <= 0) ratio = 0.0;
else ratio = (gUser[target][u_kills] / gUser[target][u_deaths]);
format(string, sizeof(string), ""SAMP_BLUE"K/D Ratio: "CORAL"%0.2f\n", ratio);
strcat(DIALOG, string);
format(string, sizeof(string), ""SAMP_BLUE"Score: "CORAL"%i\n", GetPlayerScore(target));
strcat(DIALOG, string);
format(string, sizeof(string), ""SAMP_BLUE"Money: "CORAL"$%i\n", GetPlayerMoney(target));
strcat(DIALOG, string);
//player game play time
format(string, sizeof(string), ""SAMP_BLUE"Played time: "CORAL"%02i hours %02i minutes %02i seconds\n", gUser[target][u_hours], gUser[target][u_minutes], gUser[target][u_seconds]);
strcat(DIALOG, string);
//print if registered or not
new yes[4] = "YES", no[3] = "NO";
format(string, sizeof(string), ""SAMP_BLUE"Registered: "CORAL"%s\n", ((GetPVarType(playerid, "GAdmin_Loggedin") != PLAYER_VARTYPE_NONE) ? yes : no));
strcat(DIALOG, string);
//get user id
new userid = BUD::GetNameUID(ReturnPlayerName(target));
new DATE[18];
//joined date
BUD::GetStringEntry(userid, "joindate", DATE);
format(string, sizeof(string), ""SAMP_BLUE"Join date: "CORAL"%s\n", DATE);
strcat(DIALOG, string);
//last visit to server date
BUD::GetStringEntry(userid, "laston", DATE);
format(string, sizeof(string), ""SAMP_BLUE"Last visit: "CORAL"%s\n", DATE);
strcat(DIALOG, string);
//current team id
format(string, sizeof(string), ""SAMP_BLUE"Team: "CORAL"%i\n\n", GetPlayerTeam(target));
strcat(DIALOG, string);
//shit!
strcat(DIALOG, ""WHITE"If you think your stats are wrong or not saved according to last log out, Please place an appeal in forums.\n");
strcat(DIALOG, "Make sure you have a screen of your last stats and this.");
//show stats in dialog
ShowPlayerDialog(playerid, DIALOG_COMMON, DIALOG_STYLE_MSGBOX, "Player statics", DIALOG, "Close", "");
return 1;
}
Try showing your /savestats command.
Since the command you showed only displays the stats but doesn't save them. |
public OnPlayerDisconnect( playerid, reason )
{
if( PlayerInfo[ playerid ][ LoggedIn ] == 1 )
SavePlayer( playerid );
//After the save reset the variables like:
PlayerInfo[ playerid ][ Score ] = 0;
PlayerInfo[ playerid ][ Coins ] = 0;
PlayerInfo[ playerid ][ Admin ] = 0;
return 1;
}
BUD - Notice: The database "GAdmin/server.d" doesn't exist; it will be created.
BUD v1.0.5 BETA loaded.
BUD - Notice: The column "ip" doesn't exist; attempting to create it.
BUD - Notice: The column "joindate" doesn't exist; attempting to create it.
BUD - Notice: The column "laston" doesn't exist; attempting to create it.
BUD - Notice: The column "admin" doesn't exist; attempting to create it.
BUD - Notice: The column "vip" doesn't exist; attempting to create it.
BUD - Notice: The column "kills" doesn't exist; attempting to create it.
BUD - Notice: The column "deaths" doesn't exist; attempting to create it.
BUD - Notice: The column "score" doesn't exist; attempting to create it.
BUD - Notice: The column "money" doesn't exist; attempting to create it.
BUD - Notice: The column "hours" doesn't exist; attempting to create it.
BUD - Notice: The column "minutes" doesn't exist; attempting to create it.
BUD - Notice: The column "seconds" doesn't exist; attempting to create it.
BUD - Notice: The column "logged" doesn't exist; attempting to create it.
BUD - Notice: The column "autologin" doesn't exist; attempting to create it.
SQLite format 3 @ -в
ƒh‡/tableusersusersCREATE TABLE users (uid INTEGER PRIMARY KEY, name TEXT, passhash BLOB, `ip` TEXT DEFAULT(''), `joindate` TEXT DEFAULT(''), `laston` TEXT DEFAULT(''), `admin` INTEGER DEFAULT(0), `vip` INTEGER DEFAULT(0), `kills` INTEGER DEFAULT(0), `deaths` INTEGER DEFAULT(0), `score` INTEGER DEFAULT(0), `money` INTEGER DEFAULT(0), `hours` INTEGER DEFAULT(0), `minutes` INTEGER DEFAULT(0), `seconds` INTEGER DEFAULT(0), `logged` INTEGER DEFAULT(0), `autologin` INTEGER DEFAULT(0))