31.08.2009, 09:33
Hi,
That's my registering command.... when anyone with special characters registers, the server crashes, anyone (Maybe XTreme) who can solve this?
I know you can use 'IsValidLoginName'... but I'd realy like to have users with special characters registered as well.
Grts Riz
pawn Код:
dcmd_register(playerid,params[])
{
if(!strlen(params)) { new string[256]; format(string,256,"Syntax Error: \"/REGISTER <PASSWORD>\" [Password must be %d+].",Config[MinimumPasswordLength]); return SendClientMessage(playerid,red,string); }
new index = 0,Password[256],string[256],PlayerFile[256]; Password = strtok(params,index); PlayerFile = GetPlayerFile(playerid);
if(!(Variables[playerid][Registered] || Variables[playerid][LoggedIn]))
{
if(strlen(Password) >= Config[MinimumPasswordLength] )
{
format(string,sizeof(string),"You have registered your account with the password \"%s\" and automatically been logged in.",Password);
SetUserInt(playerid,"Password",udb_hash(Password));
SetUserInt(playerid,"Registered",1);
SetUserInt(playerid,"LoggedIn",1);
Variables[playerid][LoggedIn] = true, Variables[playerid][Registered] = true;
SendClientMessage(playerid,blue,string);
SendClientMessage(playerid,blue,"Here is a little bonus for registering ;)");
GivePlayerMoney(playerid,10000);
new tmp3[100]; GetPlayerIp(playerid,tmp3,100); SetUserString(playerid,"IP",tmp3); OnPlayerRegister(playerid);
}
else SendClientMessage(playerid,red,"Syntax Error: \"/REGISTER <PASSWORD>\" [Password must be 6(+)]");
}
else SendClientMessage(playerid,red,"Error: Make sure this account is not already registered and you're not logged in.");
return 1;
}
I know you can use 'IsValidLoginName'... but I'd realy like to have users with special characters registered as well.
Grts Riz