[HELP] Create /stats with <dini>
#1

My register system runns with <dini> and I guess I need a /stats command in <dini> format to.

This is how my register system looks like:

Код:
if(strcmp(cmd, "/register", true) == 0)
	{
	  new name[MAX_PLAYER_NAME];
	  tmp = strtok(cmdtext, idx);
	  GetPlayerName(playerid, name, sizeof(name));
	  if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, "	USAGE: /register [password]");
	  format(file,sizeof(file),"%s.ini",name);
	  if(!fexist(file))
		{
 			dini_Create(file);
	  	dini_IntSet(file, "Password", udb_hash(tmp));
		  dini_IntSet(file,"AdminLevel", 0);
		  dini_IntSet(file,"Cash", 0);
		  dini_IntSet(file,"Bank", 0);
		  dini_IntSet(file,"Wallet", 0);
		  SendClientMessage(playerid, COLOR_WHITE, "You have successfully registered a account, you may now login by typing /login [password]");
      GivePlayerMoney(playerid, 50000);
			PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		  GetPlayerName(playerid, name, sizeof(name));
		  printf("%s has registered a account!", name);
		}
		else
		{
 			SendClientMessage(playerid, COLOR_GREY, "	This account is already in the database.");
		}
		return 1;
	}
Код:
if(strcmp(cmd, "/login", true) == 0)
	{
	  new PlayerName[24];
	  tmp = strtok(cmdtext, idx);
	  if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, "	USAGE: /login [password]");
		new name[MAX_PLAYER_NAME];
		if(IsLogged[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "	You already are logged in.");
			return 1;
		}
		else
		{
			GetPlayerName(playerid, name, sizeof(name));
			format(file,sizeof(file),"%s.ini",name);
			if(fexist(file))
			{
		  	tmp2 = dini_Get(file, "Password");
			 	if(udb_hash(tmp) != strval(tmp2))
				{
				  SendClientMessage(playerid, COLOR_GREY, "	The password does not match any names in the database.");
	 			  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	 			  printf("%s has failed to login", name);
				}
				else
				{
				 	IsLogged[playerid] = 1;
				 	PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
				 	SetPlayerMoney(playerid, dini_Int(file, "Cash"));
				 	PlayerInfo[playerid][Bank] = dini_Int(file, "Bank");
				 	PlayerInfo[playerid][Wallet] = dini_Int(file, "Wallet");
				 	SendClientMessage(playerid, COLOR_WHITE, "You have successfully logged in to your account.");
				 	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
				}
			}
		}
		return 1;
	}
Thanks for your support
Reply
#2

we must replace it or what?....
Reply
#3

Just an example:

pawn Код:
if(strcmp(cmd,"/stats",true) == 0)
{
  format(string,sizeof(string),"Wallet: %s",PlayerInfo[playerid][Wallet]);
  SendClientMessage(playerid,0xFFFFFFFF,string),
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)