25.03.2013, 16:39
(
Последний раз редактировалось SilverKiller; 25.03.2013 в 18:34.
Причина: Running into problems...
)
Ok, i found that the problem is in OnPlayerDisconnect!
But, i still need help!, now i have this :
And :
And :
The problem is,
it still creates my user file even with that REGKICK..
Please help!
But, i still need help!, now i have this :
pawn Код:
new REGKICK[MAX_PLAYERS];
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if(!response)
{
Kick(playerid);
REGKICK[playerid] = 1;
return 1;
}
else
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_LIGHTBLUE"Type 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);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Thank you for registering!","Ok","");
}
}
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]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_LIGHTBLUE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(REGKICK[playerid] == 1) return 1;
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
GetPlayerPos(playerid, pX[playerid], pY[playerid], pZ[playerid]);
GetPlayerFacingAngle(playerid, A[playerid]);
INI_SetTag(File, "Saved Position Data");
INI_WriteFloat(File, "X", pX[playerid]);
INI_WriteFloat(File, "Y", pY[playerid]);
INI_WriteFloat(File, "Z", pZ[playerid]);
INI_WriteFloat(File, "Angle", A[playerid]);
INI_WriteInt(File, "Interior", GetPlayerInterior(playerid));
INI_WriteInt(File, "VirtualWorld", GetPlayerVirtualWorld(playerid));
INI_Close(File);
}
return 1;
}
it still creates my user file even with that REGKICK..
Please help!