SHOW:
|
|
- or go back to the newest paste.
1 | #include <a_samp> | |
2 | ||
3 | #undef MAX_PLAYERS | |
4 | #define MAX_PLAYERS 32 | |
5 | ||
6 | new pRank[MAX_PLAYERS]; | |
7 | new pScore[MAX_PLAYERS]; | |
8 | ||
9 | new gRankScore[] = { | |
10 | 100, // Rank 2 | |
11 | 250, // Rank 3 | |
12 | 500, // Rank 4 | |
13 | 1000 // Rank 5 | |
14 | }; | |
15 | ||
16 | new gRankTitles[][] = { | |
17 | "Recruit", // Rank 1 | |
18 | "Newbie", // Rank 2 | |
19 | "Some other title", // Rank 3 | |
20 | "Some other title" // Rank 4 | |
21 | }; | |
22 | ||
23 | #define GetMaxLevel sizeof(gRankScore) | |
24 | ||
25 | main() {} | |
26 | ||
27 | stock GivePlayerScore(playerid, score=1) | |
28 | { | |
29 | //SetPlayerScore(playerid, GetPlayerScore(playerid)+score); | |
30 | pScore[playerid] += score; | |
31 | if(pRank[playerid] == GetMaxLevel) | |
32 | { | |
33 | print("MAX LEVEL REACHED"); | |
34 | - | format(szString, sizeof(szString), "%s (%i) levelled up! Level: %i", pName, playerid, pRank[playerid]+1); |
34 | + | |
35 | } | |
36 | while(pScore[playerid] >= gRankScore[pRank[playerid]]) | |
37 | { | |
38 | print("RANK UP"); | |
39 | pRank[playerid]++; | |
40 | new szString[128], pName[MAX_PLAYER_NAME] = "Mike"; | |
41 | - | format(szString, sizeof(szString), "You reached the max level (%i)!", GetMaxLevel); |
41 | + | format(szString, sizeof(szString), "%s (%i) levelled up! Level: %i (%s)", pName, playerid, pRank[playerid]+1, gRankTitles[pRank[playerid]]); |
42 | SendClientMessageToAllBut(playerid, -1, szString); | |
43 | print(szString); | |
44 | printf("LEVEL: %i/%i", pRank[playerid], GetMaxLevel); | |
45 | - | if(pRank[playerid] != GetMaxLevel) printf("Score needed for level %i: %i", pRank[playerid]+2, gRankScore[pRank[playerid]]-pScore[playerid]); |
45 | + | |
46 | { | |
47 | print("MAX LEVEL"); | |
48 | format(szString, sizeof(szString), "You reached the max level (%s - %i)!", gRankTitles[GetMaxLevel-1], GetMaxLevel); | |
49 | return SendClientMessage(playerid, -1, szString); | |
50 | } | |
51 | } | |
52 | if(pRank[playerid] != GetMaxLevel) printf("Score needed for level %i (%s): %i", pRank[playerid]+2, gRankTitles[pRank[playerid]+1], gRankScore[pRank[playerid]]-pScore[playerid]); | |
53 | return 1; | |
54 | } | |
55 | ||
56 | stock SendClientMessageToAllBut(playerid, color, msg[]) | |
57 | { | |
58 | for(new i=0; i<MAX_PLAYERS; i++) | |
59 | { | |
60 | if(i != playerid) SendClientMessage(i, color, msg); | |
61 | } | |
62 | return 1; | |
63 | } | |
64 | ||
65 | public OnRconCommand(cmd[]) | |
66 | { | |
67 | GivePlayerScore(0, strval(cmd)); | |
68 | return 1; | |
69 | } |