dcmd_register(playerid,params[])
{
new plrip[128];
GetPlayerIp(playerid,plrip,sizeof(plrip));
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged into your account");
if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"This name is registered, please use /login password to log in.");
if (RegisterLoginDisabled == 1337) return SystemMsg(playerid,"New Account Registrations are Disabled. This is due to maintenance");
if (strlen(params)==0) return SystemMsg(playerid,"Use: /register password to create a new account");
if (udb_Create(PlayerName(playerid),params)) {
dUserSetINT(PlayerName(playerid)).("money",7500);
dUserSetINT(PlayerName(playerid)).("bankcash",5000);
dUserSetINT(PlayerName(playerid)).("regplayer",0);
dUserSetINT(PlayerName(playerid)).("score",0);
dUserSetINT(PlayerName(playerid)).("adminlevel",0);
dUserSetINT(PlayerName(playerid)).("deaths",0);
dUserSetINT(PlayerName(playerid)).("totaljailtime",0);
dUserSetINT(PlayerName(playerid)).("nameban",0);
dUserSetINT(PlayerName(playerid)).("connectedminute",0);
dUserSetINT(PlayerName(playerid)).("connectedhour",0);
dUserSetINT(PlayerName(playerid)).("timesfuckedoff",0);
dUserSetINT(PlayerName(playerid)).("RegularPlayer",0);
dUserSet(PlayerName(playerid)).("ipaddress",plrip);
return SystemMsg(playerid,"Your Account has been created. Login with /login password now to log in (Before Spawn)");
}
return true;
}
|
Originally Posted by YeahYeahYeahs
Just create the new file of the new name and set the stats to the ones from the old name and delete the old name.
|
|
Originally Posted by Freddo
The way I do it (in my current filebased script) I delete the old file, change their name, save the players data with the new name (if the file doesn't exist before saving, it's created).
|
if( ! fexist( var_with_file_name ) )
{
dini_Create( var_with_file_name );
}
|
Originally Posted by Freddo
It's simple. Just use fremove( var_with_file_name ); and then where you save player data add:
pawn Код:
|
udb_RenameUser(nickname[], newnick[])