Registered Nickname Protection -
am0k - 29.12.2008
Hello
I want to modify the ladmin4v2 script, so that if a user has registered a nickname and doesnt login within 15 seconds, he gets a random name assigned. So nobody can fake a registered nickname
My Problem is that it only changes the name on the first player...
Maybe somebody can help me. People here been good help with the random name part =)
Thanks in advance
---------------------------------------
random name
Code:
new Name[200][MAX_PLAYER_NAME]={
{"funnynames"},
...200 of them...
};
-----------------------------------------------
name change timers
Code:
forward Namechange(playerid);
public Namechange(playerid)
{
new randnbr = random(200);
SetPlayerName(playerid, Name[randnbr]);
}
forward NameC(playerid);
public NameC(playerid)
{
GameTextForPlayer(playerid,"~r~Not logged in, name changed",4000,3);
SetTimer("Namechange",0,true);
}
-----------------------------------------
this is from ladmin. i modified: if user(playername2) exists and autologin is not enabled to start namechange after 15seconds.(last 3 lines)
Code:
if(!udb_Exists(PlayerName2(playerid))) SendClientMessage(playerid,orange, "ACCOUNT: Type /register [password] to create an account and save your stats");
else
{
PlayerInfo[playerid][Registered] = 1;
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName));
new tmp2[256]; tmp2 = dini_Get(file,"ip");
if( (!strcmp(tmp3,tmp2,true)) && (ServerInfo[AutoLogin] == 1) )
{
LoginPlayer(playerid);
if(PlayerInfo[playerid][Level] > 0)
{
format(string,sizeof(string),"ACCOUNT: You have been automatically logged in. (Level %d)", PlayerInfo[playerid][Level] );
SendClientMessage(playerid,green,string);
}
else SendClientMessage(playerid,green,"ACCOUNT: You have been automatically logged in.");
}
else SendClientMessage(playerid, green, "ACCOUNT: Nickname is registed, login by typing /login [password].If you don't login in 15 Seconds,you Name will be changed");
SetTimer("NameC",15000,false);
}
-----------------------------------
i asked lethal himself but he doesnt script anymore and cant help me :/
what am i doing wrong?just first player name does get changed. something with playerid?
Re: Registered Nickname Protection -
am0k - 30.12.2008
of found the error myself, i had to do
SetTimerEx("Namechange",10000,false,"i",playerid);
to pass the player id.
only problem now is that if you do appropriate login in time, name still gets changed :/
Re: Registered Nickname Protection -
DutchDominator - 30.12.2008
In your Namechange function, first let it check if the player hasn't already logged in. If he has, don't assign him another name.
Re: Registered Nickname Protection -
am0k - 30.12.2008
wow cool
so after passing the player id, let it check if player has not logged in. then i have done killtimer event on succesfull login so logged in persons dont get renamed lol
it looks like it is workin now =))) thanks DutchDominator
for the ones interested .....
Code:
new Namechanger;
//========================
new Name[200][MAX_PLAYER_NAME]={
{"funny name"},
..200 of em...
};
//===========================
forward Namechange(playerid);
public Namechange(playerid)
{
if(ServerInfo[MustLogin] == 1 && PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)
{
new randnbr = random(100);
SetPlayerName(playerid, Name[randnbr]);
}
}
//==========================this is in ladmin4v2 script
if(!udb_Exists(PlayerName2(playerid))) SendClientMessage(playerid,orange, "ACCOUNT: Type /register [password] to create an account and save your stats");
else
{
PlayerInfo[playerid][Registered] = 1;
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName));
new tmp2[256]; tmp2 = dini_Get(file,"ip");
if( (!strcmp(tmp3,tmp2,true)) && (ServerInfo[AutoLogin] == 1) )
{
LoginPlayer(playerid);
if(PlayerInfo[playerid][Level] > 0)
{
format(string,sizeof(string),"ACCOUNT: You have been automatically logged in. (Level %d)", PlayerInfo[playerid][Level] );
SendClientMessage(playerid,green,string);
}
else SendClientMessage(playerid,green,"ACCOUNT: You have been automatically logged in.");
}
else SendClientMessage(playerid, green, "ACCOUNT: Nickname is registed, login by typing /login [password].If you don't login in 15 Seconds,you Name will be changed");
Namechanger = SetTimerEx("Namechange",15000,false,"i",playerid); // pass the id^^
}
return 1;
}
//=======================this is in ladmin4v2 script
in function dcmd_login(playerid,params[])
after LoginPlayer...
KillTimer(Namechanger);