switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","Great, now please relog to save your stats!","Ok","");
new stringl[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(stringl, sizeof(stringl), "Porsh: {FFFFFF}You've successfully registered the name ({F2D82C}%s{FFFFFF}) with the password ({F2D82C}%s{FFFFFF})", name, inputtext);
SendClientMessage(playerid, COLOR_GREEN, stringl);
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
}
new pLogged[MAX_PLAYERS]
pLogged[playerid] = 1;
if(pLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREEN, "You need to be registered/logged in to spawn!");
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
new stringl[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(stringl, sizeof(stringl), "Porsh: {FFFFFF}You've successfully registered the name ({F2D82C}%s{FFFFFF}) with the password ({F2D82C}%s{FFFFFF})", name, inputtext);
SendClientMessage(playerid, COLOR_GREEN, stringl);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","Great, now please relog to save your stats!","Ok","");
}
}
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetTimerEx("KickTimer", 500, false, "i", playerid); //Add this after showing a player a message.
forward KickTimer(playerid);
public KickTimer(playerid)
{
Kick(playerid);
return 1;
}
|
Ok i added:
Код:
new pLogged[MAX_PLAYERS] Код:
pLogged[playerid] = 1; Код:
if(pLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREEN, "You need to be registered/logged in to spawn!"); If i add kick(playerid); It will kick the player before the message shows, what to do? |
public OnPlayerRequestClass(playerid, classid)
{
if(pLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREEN, "You need to be registered/logged in to spawn!");
return 0;
}
return 1;
}
new pLogged[MAX_PLAYERS];
if(pLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREEN, "Please, enter your password!");
return 0;
}
pLogged[playerid] = 0;
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
pLogged[playerid] = 1;
new stringl[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(stringl, sizeof(stringl), "Porsh: {FFFFFF}You've successfully registered the name ({F2D82C}%s{FFFFFF}) with the password ({F2D82C}%s{FFFFFF})", name, inputtext);
SendClientMessage(playerid, COLOR_GREEN, stringl);
}
}