gunxpmod.inc
Original include source with line numbers.
| 1 | // Gun Xp Mod Include File // |
| 2 | #if defined _gunxpmod_included |
| 3 | #endinput |
| 4 | #endif |
| 5 | #define _gunxpmod_included |
| 6 | |
| 7 | #if !defined charsmax |
| 8 | #define charsmax(%1) sizeof(%1)-1 |
| 9 | #endif |
| 10 | |
| 11 | // Returns player Experience. |
| 12 | native get_user_xp(id) |
| 13 | |
| 14 | // Sets player Experience. |
| 15 | native set_user_xp(id, amount) |
| 16 | |
| 17 | // Returns player Level. |
| 18 | native get_user_level(id) |
| 19 | |
| 20 | // Sets player Level. |
| 21 | native set_user_level(id, amount) |
| 22 | |
| 23 | // Returns player Level by Xp. |
| 24 | native get_user_max_level(id) |
| 25 | |
| 26 | // Register Item. |
| 27 | stock find_itemplugin() |
| 28 | { |
| 29 | for(new i = 0; i < get_pluginsnum(); ++i) |
| 30 | { |
| 31 | new temp[2], name[64] |
| 32 | get_plugin(i, name, 63, temp, 1, temp, 1, temp, 1, temp, 1) |
| 33 | if(equali(name, "gunxpmod_shop.amxx")) { |
| 34 | return i; |
| 35 | } |
| 36 | } |
| 37 | return -1; |
| 38 | } |
| 39 | |
| 40 | stock find_itemindex() |
| 41 | { |
| 42 | new temp[2], name[64], pluginname[64] |
| 43 | get_plugin(-1, pluginname, 63, temp, 1, temp, 1, temp, 1, temp, 1) |
| 44 | for (new i = 0; i < get_pluginsnum(); ++i) |
| 45 | { |
| 46 | get_plugin(i, name, 63, temp, 1, temp, 1, temp, 1, temp, 1) |
| 47 | if(equal(name, pluginname)) |
| 48 | { |
| 49 | return i |
| 50 | } |
| 51 | } |
| 52 | return -1 |
| 53 | } |
| 54 | |
| 55 | stock register_gxm_item(item_name[], item_desc[], item_cost) |
| 56 | { |
| 57 | new item_index = find_itemindex() |
| 58 | new itemplugin = find_itemplugin() |
| 59 | new itemregfunc = get_func_id("register_item_gxm", itemplugin) |
| 60 | |
| 61 | new temp = callfunc_begin_i(itemregfunc, itemplugin) |
| 62 | if(temp == -1 || temp == -2) |
| 63 | { |
| 64 | if(temp == -2) |
| 65 | { |
| 66 | log_amx("You have to many items, and need to increase the MAX_UNLOCKS define!") |
| 67 | } |
| 68 | else |
| 69 | { |
| 70 | log_amx("A unkown error has happend, make sure the Upgrades plugin is loaded!") |
| 71 | } |
| 72 | return PLUGIN_HANDLED; |
| 73 | } |
| 74 | |
| 75 | callfunc_push_int(item_index) |
| 76 | callfunc_push_str(item_name) |
| 77 | callfunc_push_str(item_desc) |
| 78 | callfunc_push_int(item_cost) |
| 79 | |
| 80 | temp = callfunc_end() |
| 81 | if(temp == -1 || temp == -2) |
| 82 | { |
| 83 | return PLUGIN_HANDLED; |
| 84 | } |
| 85 | return temp; |
| 86 | } |
| 87 | stock client_printcolor(const id, const input[], any:...) |
| 88 | { |
| 89 | new count = 1, players[32]; |
| 90 | static msg[191]; |
| 91 | vformat(msg,190,input,3); |
| 92 | replace_all(msg,190,"/g","^4");// green txt |
| 93 | replace_all(msg,190,"/y","^1");// orange txt |
| 94 | replace_all(msg,190,"/ctr","^3");// team txt |
| 95 | replace_all(msg,190,"/w","^0");// team txt |
| 96 | if (id) players[0] = id; else get_players(players,count,"ch"); |
| 97 | for (new i=0;i<count;i++) |
| 98 | if (is_user_connected(players[i])) |
| 99 | { |
| 100 | message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); |
| 101 | write_byte(players[i]); |
| 102 | write_string(msg); |
| 103 | message_end(); |
| 104 | } |
| 105 | } |