no nézd meg így... tedd vissza majd a textdrawokat, /addexp paranccsal kapsz 500 exp-t
#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];
new pfile[100];
//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
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, \"\")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#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 string2[126], string3[126], string4[126];
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pName(playerid));
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 Plevel;
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pName(playerid));
Plevel = dini_Int(pfile, \"ExpLevel\");
return Plevel;
}
//The function to get a player\'s experience. Usage: GetPlayerExp(playerid)
stock GetPlayerExp(playerid)
{
new PExp;
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pName(playerid));
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 PTotalExp;
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pName(playerid));
PTotalExp = dini_Int(pfile, \"TotalExp\");
return PTotalExp;
}
public OnPlayerConnect(playerid)
{
new string2[126], string3[126];
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pName(playerid));
if(dini_Exists(pfile)) // ha létezik..
{
format(string2, sizeof(string2), \"Exp: %05d/%05d\",GetPlayerExp(playerid), GetPlayerTotalExp(playerid));
TextDrawSetString(ExpText[playerid], string2);
format(string3, sizeof(string3), \"Level: %02d\",GetPlayerExpLevel(playerid));
TextDrawSetString(LevelText[playerid], string3);
SetPlayerMoney(playerid, dini_Int(pfile, \"Cash\"));
SetPlayerScore(playerid, dini_Int(pfile, \"Score\"));
}
else // ha nem..
{
dini_Create(pfile); // akkor csinálja meg
dini_IntSet(pfile, \"ExpLevel\", 1);
dini_IntSet(pfile, \"Exp\", 0);
dini_IntSet(pfile, \"TotalExp\", ExpForLevel);
}
format(string2, sizeof(string2), \"Exp: %05d/%05d\",GetPlayerExp(playerid), GetPlayerTotalExp(playerid));
TextDrawSetString(ExpText[playerid], string2);
format(string3, sizeof(string3), \"Level: %02d\",GetPlayerExpLevel(playerid));
TextDrawSetString(LevelText[playerid], string3);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForAll(Textdraw0);
TextDrawDestroy(Textdraw0);
TextDrawDestroy(ExpText[playerid]);
TextDrawDestroy(ExpText[playerid]);
format(pfile, sizeof(pfile), \"Szerver/%s.ini\",pName(playerid));
dini_IntSet(pfile, \"Cash\", GetPlayerMoney(playerid));
dini_IntSet(pfile, \"Score\", GetPlayerScore(playerid));
dini_IntSet(pfile, \"ExpLevel\", GetPlayerExp(playerid)); // level elmentése
dini_IntSet(pfile, \"Exp\", GetPlayerExpLevel(playerid)); // exp elmentése
dini_IntSet(pfile, \"TotalExp\", GetPlayerTotalExp(playerid)); // totalexp elmentése
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, ExpText[playerid]);
TextDrawShowForPlayer(playerid, LevelText[playerid]);
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;
}
dcmd_addexp(playerid,params[])
{
#pragma unused params
GivePlayerExp(playerid, 500, \"addexp parancs hasznalata\");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(addexp,6,cmdtext);
return 0;
}
new pname[24];
pName(playerid)
{
GetPlayerName(playerid, pname, sizeof(pname));
return pname;
}
1-2 dolgot beleraktam ha nem kell majd szedd ki, a pname-t leegyszerûsítettem, nálam mûködik, a parancs dcmd-s