Quote:
Originally Posted by RxErT
Stats saving command.. or anything related with stats saving.
|
PHP код:
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,
PHP код:
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);
PHP код:
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;
}