GiveXp(playerid, XP);// az XP az értékSetXp(playerid, XP); //az XP szintén az értékGetPlayerXP(playerid);GetPlayerXpLevel(playerid);
/*Az OnGameModeInit alá:*/betoltendo();/*OnPlayerConnect(playerid) alá:*/Connect_xp(playerid);/*OnPlayerDisconnect(playerid) alá: */Disconnect_xp(playerid);
#include <a_samp>#include <sscanf>#include <dini>//===================================================================================//======================================scriptbe=====================================//===================================================================================/*OnGameModeInit: betoltendo();OnPlayerConnect: Connect_xp(playerid);OnPlayerDisconnect: Disconnect_xp(playerid); */#define MAX_XP_LEVEL 99#define Szin_RED 0xFF0000AA#define Szin_YELLOW 0xFFFF00AA #define zoold 0x00ff00AAnew PlayerText:XPTD[MAX_PLAYERS]; stock betoltendo(){SetTimer(\"XPUpdate\", 200, 1);SetTimer(\"XP_Level\", 200, 1);return 1;}//===================================================================================//=========================================Szintek===================================//===================================================================================forward XP_Level(playerid);public XP_Level(playerid){if(GetPVarInt(playerid, \"XP\") < 100) SetPVarInt(playerid, \"xplvl\", 1); elseif(GetPVarInt(playerid, \"XP\") < 250 && GetPVarInt(playerid, \"XP\") > 99) SetPVarInt(playerid, \"xplvl\", 2); elseif(GetPVarInt(playerid, \"XP\") < 500 && GetPVarInt(playerid, \"XP\") > 244) SetPVarInt(playerid, \"xplvl\", 3); elseif(GetPVarInt(playerid, \"XP\") < 800 && GetPVarInt(playerid, \"XP\") > 499) SetPVarInt(playerid, \"xplvl\", 4); elseif(GetPVarInt(playerid, \"XP\") < 1200 && GetPVarInt(playerid, \"XP\") > 799) SetPVarInt(playerid, \"xplvl\", 5); elseif(GetPVarInt(playerid, \"XP\") < 1800 && GetPVarInt(playerid, \"XP\") > 1199) SetPVarInt(playerid, \"xplvl\", 6); elseif(GetPVarInt(playerid, \"XP\") < 2500 && GetPVarInt(playerid, \"XP\") > 1799) SetPVarInt(playerid, \"xplvl\", 7); elseif(GetPVarInt(playerid, \"XP\") < 3200 && GetPVarInt(playerid, \"XP\") > 2499) SetPVarInt(playerid, \"xplvl\", ; elseif(GetPVarInt(playerid, \"XP\") < 4000 && GetPVarInt(playerid, \"XP\") > 3199) SetPVarInt(playerid, \"xplvl\", 9); elseif(GetPVarInt(playerid, \"XP\") < 4800 && GetPVarInt(playerid, \"XP\") > 3999) SetPVarInt(playerid, \"xplvl\", 10); elseif(GetPVarInt(playerid, \"XP\") < 5900 && GetPVarInt(playerid, \"XP\") > 4799) SetPVarInt(playerid, \"xplvl\", 11); elseif(GetPVarInt(playerid, \"XP\") < 7000 && GetPVarInt(playerid, \"XP\") > 5899) SetPVarInt(playerid, \"xplvl\", 12); elseif(GetPVarInt(playerid, \"XP\") < 9000 && GetPVarInt(playerid, \"XP\") > 6999) SetPVarInt(playerid, \"xplvl\", 13); elseif(GetPVarInt(playerid, \"XP\") < 11000 && GetPVarInt(playerid, \"XP\") > 8999) SetPVarInt(playerid, \"xplvl\", 14); elseif(GetPVarInt(playerid, \"XP\") < 13500 && GetPVarInt(playerid, \"XP\") > 10999) SetPVarInt(playerid, \"xplvl\", 15); elseif(GetPVarInt(playerid, \"XP\") < 16000 && GetPVarInt(playerid, \"XP\") > 13499) SetPVarInt(playerid, \"xplvl\", 16); elseif(GetPVarInt(playerid, \"XP\") < 17000 && GetPVarInt(playerid, \"XP\") > 15999) SetPVarInt(playerid, \"xplvl\", 17); elseif(GetPVarInt(playerid, \"XP\") < 20000 && GetPVarInt(playerid, \"XP\") > 16999) SetPVarInt(playerid, \"xplvl\", 18); elseif(GetPVarInt(playerid, \"XP\") < 23000 && GetPVarInt(playerid, \"XP\") > 19999) SetPVarInt(playerid, \"xplvl\", 19); elseif(GetPVarInt(playerid, \"XP\") < 28000 && GetPVarInt(playerid, \"XP\") > 22999) SetPVarInt(playerid, \"xplvl\", 20); elseif(GetPVarInt(playerid, \"XP\") < 35000 && GetPVarInt(playerid, \"XP\") > 27999) SetPVarInt(playerid, \"xplvl\", 21); elseif(GetPVarInt(playerid, \"XP\") < 40000 && GetPVarInt(playerid, \"XP\") > 34999) SetPVarInt(playerid, \"xplvl\", 22); elseif(GetPVarInt(playerid, \"XP\") < 45000 && GetPVarInt(playerid, \"XP\") > 39999) SetPVarInt(playerid, \"xplvl\", 23); elseif(GetPVarInt(playerid, \"XP\") < 50000 && GetPVarInt(playerid, \"XP\") > 44999) SetPVarInt(playerid, \"xplvl\", 24); elseif(GetPVarInt(playerid, \"XP\") < 52000 && GetPVarInt(playerid, \"XP\") > 49999) SetPVarInt(playerid, \"xplvl\", 25); elseif(GetPVarInt(playerid, \"XP\") < 58000 && GetPVarInt(playerid, \"XP\") > 51999) SetPVarInt(playerid, \"xplvl\", 26); elseif(GetPVarInt(playerid, \"XP\") < 62000 && GetPVarInt(playerid, \"XP\") > 57999) SetPVarInt(playerid, \"xplvl\", 27); elseif(GetPVarInt(playerid, \"XP\") < 70000 && GetPVarInt(playerid, \"XP\") > 61999) SetPVarInt(playerid, \"xplvl\", 28); elseif(GetPVarInt(playerid, \"XP\") < 80000 && GetPVarInt(playerid, \"XP\") > 69999) SetPVarInt(playerid, \"xplvl\",29); elseif(GetPVarInt(playerid, \"XP\") < 100000 && GetPVarInt(playerid, \"XP\") > 79999) SetPVarInt(playerid, \"xplvl\", 30);return 1;}forward XPUpdate();public XPUpdate(){for(new i=0;i<MAX_PLAYERS;i++){new string[256];format(string, sizeof(string), \"%d/XP~n~%d/LvL\", GetPVarInt(i, \"XP\"), GetPVarInt(i, \"xplvl\"));PlayerTextDrawSetString(i,XPTD, string);}return true;}stock Connect_xp(playerid){XPTD[playerid] = CreatePlayerTextDraw(playerid,10.000, 320.000, \"x/XP~n~x/LvL\");PlayerTextDrawLetterSize(playerid,XPTD[playerid], 0.5, 1.0);PlayerTextDrawColor(playerid,XPTD[playerid], zoold);SetPVarInt(playerid, \"XP\", 0); //XP[playerid]=0;SetPVarInt(playerid, \"xplvl\", 0); //lvl[playerid]=0;new file[128], vardas[128];GetPlayerName(playerid, vardas, 128);format(file,128,\"Users/%s.ini\",vardas);SetPVarInt(playerid, \"XP\", dini_Int(file, \"XP\"));SetPVarInt(playerid, \"xplvl\", dini_Int(file, \"LVL\"));return true;}stock Disconnect_xp(playerid){new file[128], vardas[128];GetPlayerName(playerid, vardas, 128);format(file,128,\"Users/%s.ini\",vardas);if(!dini_Exists(file)){dini_Create(file);}dini_IntSet(file,\"XP\",GetPVarInt(playerid, \"XP\"));dini_IntSet(file,\"LVL\",GetPVarInt(playerid, \"xplvl\"));return true;}stock GiveXp(playerid, xp){SetPVarInt(playerid, \"XP\", GetPVarInt(playerid, \"XP\") + xp);return true;}stock SetXp(playerid, xp){SetPVarString(playerid, \"XP\", xp);return 1;}stock GetPlayerXP(playerid) return GetPVarInt(playerid, \"XP\");stock GetPlayerXpLevel(playerid) return GetPVarInt(playerid, \"xplvl\");
forward XP_Level(playerid);public XP_Level(playerid){switch(GetPVarInt(playerid, \"XP\")){case 0..100: SetPVarInt(playerid, \"xplvl\", 1);case 100..250: SetPVarInt(playerid, \"xplvl\", 2);case 250..500: SetPVarInt(playerid, \"xplvl\", 3);case 500..800: SetPVarInt(playerid, \"xplvl\", 4);case 800..1200: SetPVarInt(playerid, \"xplvl\", 5);case 1200..1800: SetPVarInt(playerid, \"xplvl\", 6);case 1800..2500: SetPVarInt(playerid, \"xplvl\", 7);case 2500..3200: SetPVarInt(playerid, \"xplvl\", ;case 3200..4000: SetPVarInt(playerid, \"xplvl\", 9);case 4000..4800: SetPVarInt(playerid, \"xplvl\", 10);case 4800..5900: SetPVarInt(playerid, \"xplvl\", 11);case 5900..7000: SetPVarInt(playerid, \"xplvl\", 12);case 7000..9000: SetPVarInt(playerid, \"xplvl\", 13);case 9000..11000: SetPVarInt(playerid, \"xplvl\", 14);case 11000..13500: SetPVarInt(playerid, \"xplvl\", 15);case 13500..16000: SetPVarInt(playerid, \"xplvl\", 16);case 16000..17000: SetPVarInt(playerid, \"xplvl\", 17);case 17000..20000: SetPVarInt(playerid, \"xplvl\", 18);case 20000..23000: SetPVarInt(playerid, \"xplvl\", 19);case 23000..28000: SetPVarInt(playerid, \"xplvl\", 20);case 28000..35000: SetPVarInt(playerid, \"xplvl\", 21);case 35000..40000: SetPVarInt(playerid, \"xplvl\", 22);case 40000..45000: SetPVarInt(playerid, \"xplvl\", 23);case 45000..50000: SetPVarInt(playerid, \"xplvl\", 24);case 50000..52000: SetPVarInt(playerid, \"xplvl\", 25);case 52000..58000: SetPVarInt(playerid, \"xplvl\", 26);case 58000..62000: SetPVarInt(playerid, \"xplvl\", 27);case 62000..70000: SetPVarInt(playerid, \"xplvl\", 28);case 70000..80000: SetPVarInt(playerid, \"xplvl\", 29);case 80000..100000: SetPVarInt(playerid, \"xplvl\", 30);default:/*Ha semelyik nem igaz rá (<0 vagy >100000)*/SetPVarInt(playerid, \"xplvl\", 9999);}}
forward XP_Level(playerid);public XP_Level(playerid){new szinthatar[] ={0, 100, 250, 500, 800, 1200, 1800, 2500, 3200, 4000, 4800, 5900,7000, 9000, 11000, 13500, 16000, 17000, 20000, 23000, 28000, 35000,40000, 45000, 50000, 52000, 58000, 62000, 70000, 80000, 100000};for(new a = 0; a < sizeof(szinthatar), a++){if(szinthatar[a] <= GetPVarInt(playerid, \"XP\") < szinthatar[a+1]) SetPVarInt(playerid, \"xplvl\", a);}}
forward XP_Level(playerid);public XP_Level(playerid){new xplvl = GetPVarInt(playerid, \"xplvl\"), XP = GetPVarInt(playerid, \"XP\"), kelloxp = (floatround(floatsqroot(XP)*xplvl/(XP/12)*XP);if(XP >= kelloxp) SetPVarInt(playerid, \"xplvl\", xplvl+1);}
[ c o d e = p a w n ] [ / c o d e ]