How to create commands for save the stats?
#1

How to create commands for save the stats?

/savestats

I know how to make commands but i don't know how to make commands for save the stats when guy use this commands.

Thank's In Advance!
Reply
#2

This is my stats command.. but its in DCMD...

Код:
dcmd_stats(playerid,params[])
{
	new pname[MAX_PLAYER_NAME],pid,string[MAX_STRING];

	sscanf(params,"s",pname,sizeof(pname));

	if(params[0] == '\0') {
		pid = playerid;
	} else {
    pid = FindPlayer(pname);
	}

	if(pid == INVALID_PLAYER_ID) {
		return SendClientMessage(playerid,COLOR_RED,"Player not found!");
	}

	if(pid == playerid) {
		SendClientMessage(playerid,COLOR_GREEN,"Your stats:");

		format(string,sizeof(string),"Your kills -> %i ... Your deaths -> %i",Kills[pid],Deaths[pid]);
 		SendClientMessage(playerid,COLOR_YELLOW,string);

		new money = GetPlayerMoney(playerid);
 		format(string,sizeof(string),"Money -> %i",money);
		SendClientMessage(playerid,COLOR_YELLOW,string);
	} else {
 		format(string,sizeof(string),"%s's stats:",ReturnPlayerName(pid));
  		SendClientMessage(playerid,COLOR_GREEN,string);

		format(string,sizeof(string),"Kills -> %i ... Deaths -> %i",Kills[pid],Deaths[pid]);
 		SendClientMessage(playerid,COLOR_YELLOW,string);

    	new money = GetPlayerMoney(pid);
    format(string,sizeof(string),"Money -> %i",money);
		SendClientMessage(playerid,COLOR_YELLOW,string);

	}
	return 1;
}
BTW it uses scanf
Reply
#3

I don't want stats commands...

I want save stats commands.

thank you as well.
Reply
#4

that means a register system , there are alot in the forum
Reply
#5

I have already register system...but i want save stats commands for save stats when you want...before disconnect
Reply
#6

this is mine

pawn Код:
if(strcmp(cmd, "/savechars", true) == 0)
    {
        if (PlayerInfo[playerid][pAdmin] >= 4)
        {
            SaveAccounts();
            SendClientMessage(playerid, COLOR_YELLOW, "All player accounts updated successfully.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command !");
        }
 return 1;
      }



Reply
#7

Quote:
Originally Posted by [CODMw2
Noredine ]
I have already register system...but i want save stats commands for save stats when you want...before disconnect
If you want us to help you, you'll have to tell us how your Reg system works...
Reply
#8

if u have a good register system u won't need /savestats cause its automatically saved when the player disconnect
Reply
#9

Quote:
Originally Posted by Anthony_Brassi
this is mine

pawn Код:
if(strcmp(cmd, "/savechars", true) == 0)
    {
        if (PlayerInfo[playerid][pAdmin] >= 4)
        {
            SaveAccounts();
            SendClientMessage(playerid, COLOR_YELLOW, "All player accounts updated successfully.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command !");
        }
 return 1;
     }



Gonna be useless to him as you didnt post SaveAccounts() callback :P
But as Etch said you dont need a command, Just make them save on player disconnect
Reply
#10

Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by Anthony_Brassi
this is mine

pawn Код:
if(strcmp(cmd, "/savechars", true) == 0)
    {
        if (PlayerInfo[playerid][pAdmin] >= 4)
        {
            SaveAccounts();
            SendClientMessage(playerid, COLOR_YELLOW, "All player accounts updated successfully.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command !");
        }
 return 1;
     }



Gonna be useless to him as you didnt post SaveAccounts() callback :P
But as Etch said you dont need a command, Just make them save on player disconnect
Eh, you're right.....lol im a dummy xD
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)