24.06.2019, 20:06
After the player login is successful, place this:
Inside the public OnPlayerDisconnect:
Then, your command should look like this:
I have not tested it, but hope it works for you, if you get errors, just show me the line.
PHP Code:
new name[MAX_PLAYER_NAME], yourfile[256];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(yourfile, 256, "insert here the file you want to save the level", name);
PlayerInfo[playerid][pLevel] = DOF2_GetInt(yourfile,"Level");
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
PHP Code:
new name[MAX_PLAYER_NAME], yourfile[256];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(yourfile, 256, "insert here the file you want to save the level", name);
if(!DOF2_FileExists(yourfile))
{
DOF2_CreateFile(yourfile);
}
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
DOF2_SetInt(yourfile, "Level", PlayerInfo[playerid][pLevel]);
DOF2_SaveFile();
PHP Code:
CMD:bonus(playerid)
{
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
if(PlayerInfo[playerid][pLevel] == 1)
{
SendClientMessage(playerid,-1,"Deoarece ai folosit comanda /bonus ai primit:");
SendClientMessage(playerid,-1,"-LEVEL: 3");
SendClientMessage(playerid,-1,"-MONEY: $5.000.000");
GivePlayerMoney(playerid,5000000);
SetPlayerScore(playerid, 3);
PlayerInfo[playerid][pLevel] = 3;
}
else
{
SendClientMessage(playerid,-1,"Trebuie sa ai minim level 1 pentru a folosi aceasta comanda.");
}
return 1;
}