Üdv!
Letöltöttem egy szintrendszert volt benne regisztrációs rendszer... Azt próbáltam kivenni és olyat beletenni, hogy névre mentsen tehát ha valaki fellép a szerverre készítsen neki Scriptfilesbe egy XY.ini (névtõl függ) amibe lementi a szintjét. De nekem nem ment le semmit.. :/ Ennek mi az oka?
#include <a_samp>
#include <dudb>
#include <progress>
new Text:ExpText[MAX_PLAYERS];
new Text:LevelText[MAX_PLAYERS];
new Text:Textdraw0;
new Bar:bar[MAX_PLAYERS];
new Text3D:LevelLabel[MAX_PLAYERS];
//You can change these values.
#define ExpForLevel 1000 //How much exp you need to pass a level. The Exp gets multiplied by the level. If you\'ve got 1000 total exp then for lvl 2 it will be 2000
#define MaxLevel 99 //The maximum level a player can achieve.
#define UseProgBar // Define wheater to use íthe progress bar or not. Comment the line if you don\'t want a progress bar and leave like that if you do want a progress bar.
#define ProgBarColor 0x0000FFFF //The experience bar\'s color.
#define TextLabelColor 0x00FFFFFF // The textlabel\'s color.
#define CashForLevelUp 300 //This is the cash you get for levelling up. It gets multiplied by the level you achieved and one more time by a number you define.
#define CashMultiplier 1 //This multiplies the Cash * Level achieved by the number you want.
#define GameTextStyle 4 //This defines the GameText\'s style used for the GivePlayerExp function.
#define GameTextTime 3000 //This defines the time for which the GameText for the GivePlayerExp function will be visible
#pragma unused strtok
#pragma unused ret_memcpy
//Declaring New
new nev[MAX_PLAYER_NAME];
//The function which gives exp. Usage: GivePlayerExp(playerid, ammount, reason);
stock GivePlayerExp(playerid, exp, reason[])
{
new pfile[100], pname[MAX_PLAYER_NAME], string2[126], string3[126], string4[126];
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pname);
dini_IntSet(pfile, \"Exp\", dini_Int(pfile, \"Exp\") +exp);
if (dini_Int(pfile, \"Exp\") >= dini_Int(pfile, \"TotalExp\"))
{
if (dini_Int(pfile, \"ExpLevel\") < MaxLevel)
{
while (dini_Int(pfile, \"Exp\") >= dini_Int(pfile, \"TotalExp\"))
{
dini_IntSet(pfile, \"Exp\", dini_Int(pfile, \"Exp\") - dini_Int(pfile, \"TotalExp\"));
dini_IntSet(pfile, \"ExpLevel\", dini_Int(pfile, \"ExpLevel\") + 1);
dini_IntSet(pfile, \"TotalExp\", dini_Int(pfile, \"ExpLevel\") * ExpForLevel);
format(string3, sizeof(string3), \"Level: %02d\",dini_Int(pfile, \"ExpLevel\"));
TextDrawSetString(LevelText[playerid], string3);
GivePlayerMoney(playerid, CashForLevelUp * dini_Int(pfile, \"ExpLevel\") * CashMultiplier);
format(string4, sizeof(string4), \"~p~You got %d Exp for ~n~%s !~n~~g~Level up!\", exp, reason);
}
}
else
{
GameTextForPlayer(playerid, \"~g~Max Level Reached!\", GameTextTime, GameTextStyle);
dini_IntSet(pfile, \"Exp\", dini_Int(pfile, \"TotalExp\"));
}
}
else
{
format(string4, sizeof(string4), \"~p~You got %d Exp for ~n~%s !\", exp, reason);
}
format(string2, sizeof(string2), \"Exp: %05d/%05d\",dini_Int(pfile, \"Exp\"), dini_Int(pfile, \"TotalExp\"));
TextDrawSetString(ExpText[playerid], string2);
#if defined UseProgBar
SetProgressBarValue(bar[playerid], dini_Int(pfile, \"Exp\"));
SetProgressBarMaxValue(bar[playerid], dini_Int(pfile, \"TotalExp\"));
UpdateProgressBar(bar[playerid], playerid);
#endif
GameTextForPlayer(playerid, string4, GameTextTime, GameTextStyle);
format(string3, sizeof(string3), \"Level: %02d\",dini_Int(pfile, \"ExpLevel\"));
Update3DTextLabelText(LevelLabel[playerid], TextLabelColor, string3);
}
//The function to get a player\'s level. Usage: GetPlayerLevel(playerid)
stock GetPlayerExpLevel(playerid)
{
new pfile[100], pname[MAX_PLAYER_NAME], Plevel;
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pname);
Plevel = dini_Int(pfile, \"ExpLevel\");
return Plevel;
}
//The function to get a player\'s experience. Usage: GetPlayerExp(playerid)
stock GetPlayerExp(playerid)
{
new pfile[100], pname[MAX_PLAYER_NAME], PExp;
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pname);
PExp = dini_Int(pfile, \"Exp\");
return PExp;
}
//The function to get a player\'s experience needed to lvl up. Usage: GetPlayerTotalExp(playerid)
stock GetPlayerTotalExp(playerid)
{
new pfile[100], pname[MAX_PLAYER_NAME], PTotalExp;
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pname);
PTotalExp = dini_Int(pfile, \"TotalExp\");
return PTotalExp;
}
public OnPlayerConnect(playerid)
{
new string2[126], string3[126];
new pfile[100];
GetPlayerName(playerid, nev, sizeof(nev));
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",nev);
if(!dini_Exists(pfile)) {
}
dini_Create(pfile);
dini_IntSet(pfile, \"ExpLevel\", 1);
dini_IntSet(pfile, \"Exp\", 0);
dini_IntSet(pfile, \"TotalExp\", ExpForLevel);
format(string2, sizeof(string2), \"Exp: %05d/%05d\",dini_Int(pfile, \"Exp\"), dini_Int(pfile, \"TotalExp\"));
TextDrawSetString(ExpText[playerid], string2);
format(string3, sizeof(string3), \"Level: %02d\",dini_Int(pfile, \"ExpLevel\"));
TextDrawSetString(LevelText[playerid], string3);
TextDrawShowForPlayer(playerid, ExpText[playerid]);
TextDrawShowForPlayer(playerid, LevelText[playerid]);
format(string2, sizeof(string2), \"Exp: %05d/%05d\",dini_Int(pfile, \"Exp\"), dini_Int(pfile, \"TotalExp\"));
format(string3, sizeof(string3), \"Level: %02d\",dini_Int(pfile, \"ExpLevel\"));
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForAll(Textdraw0);
TextDrawDestroy(Textdraw0);
TextDrawDestroy(ExpText[playerid]);
TextDrawDestroy(ExpText[playerid]);
new pfile[100], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, nev, sizeof(pname));
format(pfile, sizeof(pfile), \"/Szerver/%s.ini\",pname);
dini_IntSet(pfile, \"Cash\", GetPlayerMoney(playerid));
dini_IntSet(pfile, \"Score\", GetPlayerScore(playerid));
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw0);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if (killerid != playerid) {
if (GetPlayerExpLevel(playerid) < GetPlayerExpLevel(killerid))
{
GivePlayerExp(killerid, 100, \"killing a lower level player\");
}
else if (GetPlayerExpLevel(playerid) > GetPlayerExpLevel(killerid))
{
GivePlayerExp(killerid, 300, \"killing a higher level player\");
}
else
{
GivePlayerExp(killerid, 200, \"killing a player at your own level\");
}
} // An example of using my exp system.
return 1;
}
UI: Textdraw most nem tettem bele