SA-MP Forums Archive
password - 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: password (/showthread.php?tid=549677)



password - BoU3A - 08.12.2014

why the password dose not change on the database

PHP код:
CMD:password(playerid,params[])
{
  new 
q[126], str[100], newpass[100];
  if(
sscanf(params"s[100]",newpass)) return SendClientMessage(playerid,Red,"Chnage password: /password <newpass>");
  
pdata[playerid][Password] = newpass;
  
mysql_format(Mysql,q,sizeof(q),"UPDTAE `players` SET `Password` = %s WHERE `ID` =%d",pdata[playerid][Password],pdata[playerid][ID]);
  
format(str,sizeof(str),"Password has been change to <%s>",newpass);
  
SendClientMessage(playerid,Red,str);
  return 
1;




Re: password - M4D - 08.12.2014

because you just format mysql query and you don't send it to database !
you have to mysql_query() function.
i edited your command
pawn Код:
CMD:password(playerid,params[])
{
  new q[126], str[100], newpass[100];
  if(sscanf(params, "s[100]",newpass)) return SendClientMessage(playerid,Red,"Chnage password: /password <newpass>");
  pdata[playerid][Password] = newpass;
  mysql_format(Mysql,q,sizeof(q),"UPDTAE `players` SET `Password` = %s WHERE `ID` =%d",pdata[playerid][Password],pdata[playerid][ID]);
  mysql_query(Mysql,q); // <--------- Here
  format(str,sizeof(str),"Password has been change to <%s>",newpass);
  SendClientMessage(playerid,Red,str);
  return 1;
}
an important note: please make a permision for using this command !
for example if player logged in successfully then he can use this command
if you don't do this:
i'll join your server with an admin nick
i'll press F6 before login and /changepass
so before loging in i'll change admin password and now i can enter server as admin !!
Heed buddy


Re: password - JeaSon - 08.12.2014

if you re using r39-2 then it would like this

pawn Код:
CMD:password(playerid,params[])
{
  new q[126], str[100], newpass[100];
  if(sscanf(params, "s[100]",newpass)) return SendClientMessage(playerid,Red,"Chnage password: /password <newpass>");
  pdata[playerid][Password] = newpass;
  mysql_format(Mysql,q,sizeof(q),"UPDTAE `players` SET `Password` = %s WHERE `ID` =%d",pdata[playerid][Password],pdata[playerid][ID]);
  mysql_tquery(Mysql, q, "", "");
  format(str,sizeof(str),"Password has been change to <%s>",newpass);
  SendClientMessage(playerid,Red,str);
  return 1;
}



Re: password - BoU3A - 08.12.2014

Thank you both


Re: password - Vince - 08.12.2014

Oh god, unhashed passwords. Don't, don't, don't! No one has business with a player's password, not even you!


Re: password - Doller - 08.12.2014

You login pass?.