Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Level System By RiseAboveHate V1.0
- */
- #include <a_samp>
- #include <DOF2>
- new PLevel[64];
- new String[128];
- enum Player {Kills, Deaths, Level};
- new PInfo[MAX_PLAYERS][Player];
- #define FILTERSCRIPT
- public OnFilterScriptInit() print("\nLevel Sys By RiseAboveHate Loaded !");
- public OnFilterScriptExit() print("\nLevel Sys By RiseAboveHate UnLoaded !"), DOF2_Exit();
- public OnPlayerConnect(playerid)
- {
- format(PLevel, sizeof(PLevel), "RLevel/%s.ini", GetName(playerid));
- if(!DOF2_FileExists(PLevel)) DOF2_CreateFile(PLevel);
- PInfo[playerid][Kills] = DOF2_GetInt(PLevel, "Kills");
- PInfo[playerid][Deaths] = DOF2_GetInt(PLevel, "Deaths");
- PInfo[playerid][Level] = DOF2_GetInt(PLevel, "Level");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- format(PLevel, sizeof(PLevel), "RLevel/%s.ini", GetName(playerid));
- DOF2_SetInt(PLevel, "Kills", PInfo[playerid][Kills]);
- DOF2_SetInt(PLevel, "Deaths", PInfo[playerid][Deaths]);
- DOF2_SetInt(PLevel, "Level", PInfo[playerid][Level]);
- DOF2_SaveFile();
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(PInfo[playerid][Kills] % 10 == 0)
- {
- PInfo[playerid][Level]++;
- if(PInfo[playerid][Level] > 20) return PInfo[playerid][Level] = 20;
- if(PInfo[playerid][Level] > 0 || PInfo[playerid][Level] < 21)
- {
- format(String, sizeof(String), "{FF0000}|~~~~ %d òìä ìøîä \"%s\" äùç÷ï ~~~~|", PInfo[playerid][Level], GetName(playerid));
- SendClientMessageToAll(-0, String);
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/MyLevel", cmdtext, true, 10) == 0) return format(String, sizeof(String), "{00FF95}|~~~~ %d äøîä ùìê äéà ~~~~|", PInfo[playerid][Level]); SendClientMessage(playerid, -1, String);
- return 0;
- }
- stock GetName(playerid)
- {
- new Name[MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, Name, sizeof(Name));
- return Name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement