Roleplay connect - 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: Roleplay connect (
/showthread.php?tid=516913)
Roleplay connect -
AhmedMohamed - 02.06.2014
my problem is when player with wrong name connect to the game, give him the registration dialog and the message " This is a RolePlay Server, please reconnect using Firstname_Lastname format. "
this OnPlayerConnect callback:
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nType your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
}
else
{
if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1
|| strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1 || strfind(name, "[", true) != -1 || strfind(name, "]", true) != -1
|| strfind(name, "_", true) == -1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}This is a RolePlay Server, please reconnect using Firstname_Lastname format.");
SetTimer("KickP", 1000, true);
}
else if(strfind(name, "_", true) != -1)
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
}
return 1;
}
pawn Код:
stock Path(playerid)
{
new str[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),UserPath,name);
return str;
}
pawn Код:
forward KickP(playerid);
public KickP(playerid)
{
Kick(playerid);
return 1;
}
Re: Roleplay connect -
biker122 - 02.06.2014
OnPlayerConnect
pawn Код:
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nType your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
}
else
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
}
I just edited deleted some lines within if(fexist....)) - Showing register dialog.
Re: Roleplay connect -
AhmedMohamed - 02.06.2014
your reply doesn't help me, if you have helpful reply so please
Re: Roleplay connect -
AhmedMohamed - 02.06.2014
bumb