17.09.2011, 15:33
Hi , i want to creat /changepass [OldPass] [NewPass] , but i don't have Any Idea , Betwen , i'm using Zcmd+sscanf2+dini , example for a /register command:
If you want any other command that it can help u to make /changepass , post here
PHP код:
COMMAND:register(playerid,params[])
{
new file[256],PlayerName[MAX_PLAYER_NAME],buf[129];
WP_Hash(buf, sizeof(buf), params);
GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
format(file,sizeof(file),"users/%s.txt",PlayerName);
if(dini_Exists(file)) return SendClientMessage(playerid,Red,"You are already registered.");
if(Account[playerid][Registered] == 1) return SendClientMessage(playerid,Red,"You are already registered.");
if (sscanf(params, "s[32]", params)) return SendClientMessage(playerid, Yellow, "Usage: /register password");
if(Account[playerid][Logged] == 1) return SendClientMessage(playerid,Red,"You are already registered, and logged in.");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"Password",buf);
dini_IntSet(file,"Registered",1);
dini_IntSet(file,"Logged",1);
dini_IntSet(file,"Kills",0);
dini_IntSet(file,"Deaths",0);
dini_IntSet(file,"Level",0);
dini_IntSet(file,"Score",Account[playerid][Score] = 0);
dini_IntSet(file,"Cash",Account[playerid][Cash] = 0);
Account[playerid][Registered] = 1;
Account[playerid][Logged] = 1;
Account[playerid][Muted] = 0;
SendClientMessage(playerid,Green,"You are now registered and automatically logged in!");
return 1;
}
}
return 1;
}