27.03.2018, 18:54
Hello there.
I will respond to all your questions from this topic in the following sentences and examples.
I see that you use YINI so, here is it.
1. When a player register:
- The player that joins the server must type his password, right ?
- So, you must reset all the player variables from your "pInfo" i think, that's the name of your enum.
- To reset them you must have something like this into your "DIALOG_REGISTER" (your register dialog) after he enter his pass:
2. When a player login:
- So, you must know that when a player login is not the same thing with when a player register, i think u get that already.
- And if you know, you must load their dates from their own paths from your scriptfiles folder from folder "Users" or another folder that contain your player paths.
- So after the enteres his password into the "DIALOG_LOGIN" (your login dialog) you must have something like this:
So, that's all that you must to know when you want to make another variables that stores another things into the player path.
You said that you want to add "Score", yea that's ok. At your enum "pInfo" you added: "pScore", after that you will name this into the player path "Score". You asked if this is a problem, this is not a problem, at all. All you must to do is to add at your register dialog this: "INI_WriteInt( File, "Score", 0 )", and at your login dialog (Load Player Dates Function or another function that loads dates) this: "INI_Int( "Score", PlayerInfo[ playerid ][ pScore ] ), SetPlayerScore( playerid, PlayerInfo[ playerid ][ pScore ] );"
ALSO, VERY IMPORTANT:
1. At "OnPlayerDisconnect" you must save the player variables (dates) before you reset them or another things. Example here:
I hope you get all the informations that i gave you here.
I will respond to all your questions from this topic in the following sentences and examples.
I see that you use YINI so, here is it.
1. When a player register:
- The player that joins the server must type his password, right ?
- So, you must reset all the player variables from your "pInfo" i think, that's the name of your enum.
- To reset them you must have something like this into your "DIALOG_REGISTER" (your register dialog) after he enter his pass:
PHP код:
new INI:File = INI_Open( UserPath( playerid ) );
INI_SetTag( File, "data" );
INI_WriteInt( File, "Password", inputtext );
INI_WriteInt( File, "Cash", 0 );
INI_WriteInt( File, "Admin", 0 );
INI_WriteInt( File, "Kills", 0 );
INI_WriteInt( File, "Deaths", 0 )
INI_Close( File )
- So, you must know that when a player login is not the same thing with when a player register, i think u get that already.
- And if you know, you must load their dates from their own paths from your scriptfiles folder from folder "Users" or another folder that contain your player paths.
- So after the enteres his password into the "DIALOG_LOGIN" (your login dialog) you must have something like this:
PHP код:
INI_Int( "Password", PlayerInfo[ playerid ][ pPass ] );
INI_Int( "Cash", PlayerInfo[ playerid ][ pCash] );
INI_Int( "Admin", PlayerInfo[ playerid ][ pAdmin] );
INI_Int( "Kills", PlayerInfo[ playerid ][ pKills] );
INI_Int( "Deaths", PlayerInfo[ playerid ][ pDeaths ] );
You said that you want to add "Score", yea that's ok. At your enum "pInfo" you added: "pScore", after that you will name this into the player path "Score". You asked if this is a problem, this is not a problem, at all. All you must to do is to add at your register dialog this: "INI_WriteInt( File, "Score", 0 )", and at your login dialog (Load Player Dates Function or another function that loads dates) this: "INI_Int( "Score", PlayerInfo[ playerid ][ pScore ] ), SetPlayerScore( playerid, PlayerInfo[ playerid ][ pScore ] );"
ALSO, VERY IMPORTANT:
1. At "OnPlayerDisconnect" you must save the player variables (dates) before you reset them or another things. Example here:
PHP код:
public OnPlayerDisconnect( playerid, reason )
{
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 );
return 1;
}