Stats and change pass command
#1

How do i create a stats command ?
i ready have a player info
please give me a code of command stats and changepass.
Reply
#2

anyone ??
Reply
#3

can you show your variable ?
Reply
#4

Ok I search ****** and have a command /stats I need a command /changepassword.
Sorry I don't have a code because I'm online on forum by ipad and I ready have a login and register system with enum pInfo like this:
Код:
enum pInfo
{
      pPass,
      pCash,
      pScore,
      pAdmin,
}
Reply
#5

Bump
Reply
#6

The /stats command.
pawn Код:
CMD:stats(playerid,params[])
{
new name[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s's stats",name);
SendClientMessage(playerid,0xFF8000AA,string);
format(string,sizeof(string),"Cash: $%d",pInfo[playerid][pCash]);
SendClientMessage(playerid,0xFF4000AA,string);
format(string,sizeof(string),"Score: %d",pInfo[playeid][pScore]);
SendClientMessage(playerid,0xFF1000FF,string);
format(string,sizeof(string),"Password: %s",pInfo[playerid][pPass]);
SendClientMessage(playerid,0xAAAAAAFF,string);
return 1;
}
The /changepass command.
pawn Код:
CMD:changepass(playerid,params[])
{
new pass;
if(sscanf(params,"s",pass)) return SendClientMessage(playerid,0xCCCCCCAA,"/changepass [new password]");
if(pass > 24 || pass < 0) return SendClientMessage(playerid,0xCCCCCCAA,"Invalid character length.");
pInfo[playerid][pPass] = pass;
format(string,sizeof(string),"You've changed your password to %s",pass);
SendClientMessage(playerid,0xFF4000AA,string);
return 1;
}
For the /changepass, if you want admins to know when ever a user changed his password and what password did he changed to here is the code.

pawn Код:
CMD:changepass(playerid,params[])
{
new pass,name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(sscanf(params,"s",pass)) return SendClientMessage(playerid,0xCCCCCCAA,"/changepass [new password]");
if(pass > 24 || pass < 0) return SendClientMessage(playerid,0xCCCCCCAA,"Invalid character length.");
pInfo[playerid][pPass] = pass;
format(string,sizeof(string),"You've changed your password to %s",pass);
SendClientMessage(playerid,0xFF4000AA,string);
for(new i = 0; i < MAX_PLAYERS; i++)
{

if(pInfo[i][pAdmin] > 1)
{

format(string,sizeof(string),"%s changed his password to %s",name,pass);
SendClientMessage(i,0xFFFFFFAA,string);

}

}
return 1;
}
Reply
#7

Код:
C:\Documents and Settings\hung\Desktop\NewServerss\gamemodes\DM.pwn(2467) : error 017: undefined symbol "string"
C:\Documents and Settings\hung\Desktop\NewServerss\gamemodes\DM.pwn(2467) : error 017: undefined symbol "string"
C:\Documents and Settings\hung\Desktop\NewServerss\gamemodes\DM.pwn(2467) : error 029: invalid expression, assumed zero
C:\Documents and Settings\hung\Desktop\NewServerss\gamemodes\DM.pwn(2467) : fatal error 107: too many error messages on one line
here the error of command /changepass
Reply
#8

Add:
pawn Код:
new string[128];
Reply
#9

thanks
Reply
#10

This will be good now.

pawn Код:
CMD:changepass(playerid,params[])
{
new pass,string[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(sscanf(params,"s",pass)) return SendClientMessage(playerid,0xCCCCCCAA,"/changepass [new password]");
if(pass > 24 || pass < 0) return SendClientMessage(playerid,0xCCCCCCAA,"Invalid character length.");
pInfo[playerid][pPass] = pass;
format(string,sizeof(string),"You've changed your password to %s",pass);
SendClientMessage(playerid,0xFF4000AA,string);
for(new i = 0; i < MAX_PLAYERS; i++)
{

if(pInfo[i][pAdmin] > 1)
{

format(string,sizeof(string),"%s changed his password to %s",name,pass);
SendClientMessage(i,0xFFFFFFAA,string);

}

}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)