Skripta: Moja!
Problem: Napravio sam neki jednostavni Register/Login sistem po nekom TUT-u, i napravio sam da mi se sejavju igracevi score i money, ali kada se registriram sa nekom lozinkom, izadem i opet se moram registrirat, jel trebam napravit da se sejva i password? ali neznam kako?
Dio skripte: evo kako sam ja za novac i score:
public OnPlayerConnect(playerid)
{
//Score Saver
new string[128], PlayerName[MAX_PLAYER_NAME]; //This will help defining the GetPlayerName
GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); // It will help getting the player name as above
format(string, sizeof(string), "Player/%s.ini", PlayerName); // It will help saving the scores in a file in scriptfiles -> Scores -> player's name.ini
if(fexist(string)) // If that folder exists I think, it command the system to save the player's score(Set it)
{
SetPlayerScore(playerid, dini_Int(string, "Score")); // This will save the player's score in the Scores folder and set it.
GivePlayerMoney(playerid, dini_Int(string, "Money"));//PARE
}
else // Helps for, like if it didn't save + It's like, if that not, or otherwise or something like that
{
dini_Create(string); // Creates a string " "
dini_IntSet(string, "Score", 0); // I don't know exactly but as it says above, it doesn't save.
dini_IntSet(string, "Money", 0);//PARE
}
}
public OnPlayerDisconnect(playerid, reason)
{
new string[128], PlayerName[MAX_PLAYER_NAME]; //This will help defining the GetPlayerName
GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); // It will help getting the player name as above
format(string, sizeof(string), "Player/%s.ini", PlayerName); // And it helps saving the players' scores inside folder " Scores " into " Player's name.ini ".
if(fexist(string)) // If that folder exists I think, it command the system to save the player's score(Set it)
{
dini_IntSet(string, "Score", GetPlayerScore(playerid)); //This will help saving the Score by getting it and saving it inside Score into Player's name.ini %s.ini
dini_IntSet(string, "Money", GetPlayerMoney(playerid));//PARE
}
else // It's like, if that not, or otherwise or something like that
{
dini_Create(string); // Creates a string " "
dini_IntSet(string, "Score", GetPlayerScore(playerid)); // It saves the Score of the player in the file
dini_IntSet(string, "Money", GetPlayerMoney(playerid));//PARE
}
}