SA-MP Forums Archive
How to create commands for save the stats? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to create commands for save the stats? (/showthread.php?tid=144739)



How to create commands for save the stats? - Noredine - 28.04.2010

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!



Re: How to create commands for save the stats? - Lorenc_ - 28.04.2010

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



Re: How to create commands for save the stats? - Noredine - 28.04.2010

I don't want stats commands...

I want save stats commands.

thank you as well.



Re: How to create commands for save the stats? - aircombat - 29.04.2010

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


Re: How to create commands for save the stats? - Noredine - 29.04.2010

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


Re: How to create commands for save the stats? - Anthony_Brassi - 29.04.2010

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;
      }






Re: How to create commands for save the stats? - Miguel - 29.04.2010

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...


Re: How to create commands for save the stats? - aircombat - 29.04.2010

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


Re: How to create commands for save the stats? - Torran - 29.04.2010

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


Re: How to create commands for save the stats? - Anthony_Brassi - 29.04.2010

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