Raised This Month: $ Target: $400
 0% 

Need help witch cost


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 06-08-2009 , 13:09   Re: Need help witch cost
Reply With Quote #12

Code:
#include <amxmodx> #include <amxmisc> #include <nvault> new points[33]; new cv_give_points; new cv_take_points; new g_vault;   public plugin_init() {     register_plugin("PointSystem", "1.0", "xraycat");     register_event("DeathMsg", "hook_death", "a", "1>0");         cv_give_points = register_cvar("amx_kill_points", "5");     cv_take_points = register_cvar("amx_death_points", "2");         g_vault = nvault_open("pointsys");         register_concmd("amx_give_points", "cmd_give_points", ADMIN_KICK, "<target> <amount> <reason>")     register_concmd("amx_take_points", "cmd_take_points", ADMIN_KICK, "<target> <amount> <reason>")         register_clcmd("say /points", "clcmdPoints",  -1, ""); } public clcmdPoints(id)     color_print(id, "{y}[PointSys]{g} Currently you have %d points.", points[id]); public client_connect(id) {     LoadData(id);     set_task(5.0, "DataLoaded", id); } public DataLoaded(id) {     color_print(id, "{y}[PointSys]{g} Data loaded. (%d points)", points[id]); } public cmd_give_points(id, level,cid) {     if(!cmd_access(id,level,cid,3))         return PLUGIN_HANDLED;         new target[32], amount[21], reason[21];         read_argv(1, target, 31);     read_argv(2, amount, 20);     read_argv(3, reason, 20);         new player = cmd_target(id,target,8);         if(!player)         return PLUGIN_HANDLED ;         new admin_name [32], player_name[32];     get_user_name(id, admin_name, 31);     get_user_name(player, player_name, 31);         new pointsnum = str_to_num(amount);         points[id] += pointsnum;         color_print(0, "{y}[PointSys]{g} ADMIN: %s gave %d points for %s. (Reason: %s)", admin_name, pointsnum, player_name, reason);     color_print(id, "{y}[PointSys]{g} You received %d points. (Total: %d)", pointsnum, points[id]);         return PLUGIN_CONTINUE; } public hook_death(id) {     new Killer = read_data(1);     new Victim = read_data(2);         new give;     give = get_pcvar_num(cv_give_points);         new take;     take = get_pcvar_num(cv_take_points);         points[Killer] += give;     points[Victim] -= take;         new victim_name[32]     get_user_name(Victim, victim_name, 31);         color_print(Killer, "{y}[PointSys]{g} You received %d poits for killing %s. (Total %i)", give, victim_name, points[Killer]);     color_print(Victim, "{y}[PointSys]{g} Decreased %d points for dying.    (Total %i)", take, points[Victim]);         SaveData(Killer);     SaveData(Victim); } public SaveData(id) {     new AuthID[35];     get_user_authid(id, AuthID, 34);         new vaultkey[64],vaultdata[256];         format(vaultkey, 63,"%s-Pointsys", AuthID);     format(vaultdata, 255,"%d#", points[id]);         nvault_set(g_vault, vaultkey, vaultdata);         return PLUGIN_CONTINUE; }   public LoadData(id) {     new AuthID[35];     get_user_authid(id, AuthID, 34);         new vaultkey[64],vaultdata[256];         format(vaultkey, 63,"%s-Pointsys", AuthID);     format(vaultdata, 255, "%i#", points[id]);         nvault_get(g_vault, vaultkey, vaultdata, 255);     replace_all(vaultdata, 255, "#", " ") ;         new playerpoints[32];     parse(vaultdata, playerpoints, 31);     points[id] = str_to_num(playerpoints);         return PLUGIN_CONTINUE; } stock color_print(const id,const input[], any:...) {     new msg[191], players[32], count = 1;     vformat(msg, 190, input, 3);     replace_all(msg, 190, "{g}", "^4");// green clr     replace_all(msg, 190, "{y}", "^1");// orange clr     replace_all(msg, 190, "{t}", "^3");// team clr     if (id) players[0] = id; else get_players(players,count,"ch");     for (new i=0;i<count;i++)         if (is_user_connected(players[i]))     {         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);         write_byte(players[i]);         write_string(msg);         message_end();     } }

Pointsmod i started long long time ago.. It has some bugs in it but you can fix them yourself.

If you got any questions or if you need help with my code, give me a pm.
__________________

Last edited by [X]-RayCat; 06-08-2009 at 14:00.
[X]-RayCat is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode