SA-MP Forums Archive
Stats and change pass command - 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)
+--- Thread: Stats and change pass command (/showthread.php?tid=447687)



Stats and change pass command - xganyx - 01.07.2013

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


Re: Stats and change pass command - xganyx - 01.07.2013

anyone ??


Re: Stats and change pass command - Guest123 - 01.07.2013

can you show your variable ?


Re: Stats and change pass command - xganyx - 01.07.2013

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



Re: Stats and change pass command - xganyx - 02.07.2013

Bump


Re: Stats and change pass command - Goldilox - 02.07.2013

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



Re: Stats and change pass command - xganyx - 02.07.2013

Код:
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


Re: Stats and change pass command - GeniusPobs - 02.07.2013

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



Re: Stats and change pass command - xganyx - 02.07.2013

thanks


Re: Stats and change pass command - Goldilox - 02.07.2013

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