Raised This Month: $ Target: $400
 0% 

DOD FF MANAGER: maybe a nice plugin if you can help me :)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Colt
Junior Member
Join Date: Sep 2004
Old 09-12-2004 , 16:36   DOD FF MANAGER: maybe a nice plugin if you can help me :)
Reply With Quote #1

Hello everybody! I've noticed it is boring that some unmatured players shoot their allies without being punished (if their is only a TA and not a TK). So I've decided to create an original system to manage the friendly fire in DOD:

At the start, each player gets 25 credits (by default).
Then each time he shoots an ally, he losses:
-1 for TA >9 Hp with grenade
-2 for TA >9Hp with rocket-launcher or with mortar
-3 for TA >9Hp normal or a kill with mortar
-4 for a TK normal
-5 for a TA melee
-6 for a TK melee
-7 for a spawn TA
-8 for a spawn TK

Victim gets a menu which allow to give back credits and to slap the attacker. The last 2 actions are stored to forgive later by writting:
"forgivetk" or "forgive" or "pardonner" or "pardon"

Attacker is slayed if he attacks allies at respawn.

When credits<5, the player is slayed as an ultime warning.

When credits<0, the player is banned for a defined time.

There is a STEAM_ID memory to prevent players to disconnect and reconnect in the aim they get back all their credits.


Some screenshots:







Some of you have recognized it, that is based on the old pluging DOD TK MANAGER created by Fractal ([email protected]) and improved by SidLuke ([email protected]).
That is why there is some code which is similar (for example the files for credits memory, I am not good enough to make it myself). Of course, I have thanked them in the source, nevertheless I apologize in advance if you think this is insufficient.

So what is the problem? Actually, many

1. One time, menus works fine, an other time, it happens nothing when you press a key, or the menu doesn't display at all! I have tried to replace keys (1<<0) ... by 1023, but it changes nothing.

2. One time, credits are well counted, an other time, they are "mad" (for example less than -8 credits for a TK). -> 02/10 FIXED

3. One time, players are slayed when they shoot at spawn, an other, the text is displayed but they are not slayed! (of course they have no immunity I'm not stupid )

4. I can compile it with 0.20, but I get a bad load error in the server log. So to launch it, I have to compile it with 0.16. I use the Windows Dedicated Server for my tests, before to put it on my team's server (Linux). Notice I have also to use an old version of metamod to prevent a crash of the server
-> 29/09 FIXED

Here is the source, I have made my possible to comment it:

29/09: NEW EDITION
Code:
/*
 Introduction
 ------------
 DOD FF MANAGER is a plugin for AMX Mod X
 Author: Colt ([email protected])
 It is based on the DOD TK Manager created by Fractal ([email protected])
 and improved by SidLuke ([email protected]) and I have added many functions.
 A very big thanks to them, who allowed to create a nice protection when FF is ON.   
 
 Description
 -----------
 DOD FF Manager secures a DOD server when Friendy Fire is ON.

 At the start, each player gets 25 credits.
 Then each time he shoots an ally, he losses:
 -1 for TA >9 Hp with grenade
 -2 for TA >9Hp with rocket-launcher or mortar
 -3 for TA >9Hp normal or a kill with mortar
 -4 for a TK normal
 -5 for a TA melee
 -6 for a TK melee
 -7 for a spawn TA
 -8 for a spawn TK
 
 Victim gets a menu which allow to give back credits and
 to slap the attacker.
 The last 2 actions are stored to forgive later by writting:
 "forgivetk" or "forgive" or "pardonner" or "pardon"
 
 Attacker is slayed if he attacks allies at respawn.
 
 When credits<5, the player is slayed as an ultime warning.
 
 When credits<0, the player is banned for a defined time.
 
 There is a STEAM_ID memory to prevent players to disconnect and reconnect
 in the aim they get back all their credits.
 To enable this, a direcctory named logcredits must be created in your AMX MOD X folder.
 
 
  CVAR settings (to put in amxx.cfg)
  ----------------------------------------
 amx_ffm_bantime <x minutes> :         time the player is banned
                                       lwhen he has no credits anymore

 amx_ffm_credits <x> :                 number of credits of each player
                                       at the start of a map

 amx_ffm_multiTK <1|0>:                if enabled, when a multi-TK with grenade happens,
                                       only the first TK is counted.

 amx_ffm_protectiontime <x secondes>:  minimum time before the player
                                       is slayed if he attacks allies.
 
 By default, if you don't define theses variables, they will be:

 amx_ffm_bantime = 180
 amx_ffm_credits = 25
 amx_ffm_multiTK = 1
 amx_ffm_protectiontime = 6

*/
Code:
#include <amxmodx> #include <amxmisc> #include <dodx> new Float:g_SpawnTime[33] new g_adminimmunity new g_bantime new g_credits_start new g_player_authid[33][40] new g_player_authenticated[33] new g_credits[33] new g_menu_killerid[33] new g_menu_attackerid[33] new Float:g_LastAttackTime[33] new Last1Attacker = 0 new Last1Victim = 0 new Last2Attacker = 0 new Last2Victim = 0 public plugin_init() {     register_plugin("DoD FF Manager","0.1","Colt")     register_event("ResetHUD","eResetHud","b")         register_cvar("amx_ffm_bantime","180")     register_cvar("amx_ffm_credits","25")     register_cvar("amx_ffm_multiTK","1")     register_cvar("amx_ffm_protectiontime","6.0")     register_clcmd("say","HandleSay")     register_clcmd("say_team","HandleSay")     register_statsfwd(XMF_DAMAGE)     register_statsfwd(XMF_DEATH)     register_menucmd(register_menuid("-1"),1023,"Menu1")     register_menucmd(register_menuid("-2"),1023,"Menu2")     register_menucmd(register_menuid("-3"),1023,"Menu3")     register_menucmd(register_menuid("-4"),1023,"Menu4")     register_menucmd(register_menuid("-5"),1023,"Menu5")     register_menucmd(register_menuid("-6"),1023,"Menu6")     register_menucmd(register_menuid("-7"),1023,"Menu7")     register_menucmd(register_menuid("-8"),1023,"Menu8")     set_task(0.6,"load_settings")     return PLUGIN_CONTINUE } public load_settings() {     g_credits_start = get_cvar_num("amx_ffm_credits")     g_bantime = get_cvar_num("amx_ffm_bantime")     return PLUGIN_CONTINUE } public client_connect(id) {       g_player_authenticated[id] = 0     return PLUGIN_CONTINUE } public client_putinserver(id) {       get_user_authid(id,g_player_authid[id],39)     g_player_authenticated[id] = 1     g_credits[id] = g_credits_start     if ( is_user_bot(id) )         return PLUGIN_CONTINUE             new cditsFile[64]     format(cditsFile,63,"addons/amxmodx/logcredits/%s.txt",g_player_authid[id])     replace(cditsFile,63,":","_")     replace(cditsFile,63,":","_")     if (file_exists(cditsFile))     {         new currmap[32]         get_mapname(currmap,31)         new text[32]         new a = 0         if (read_file(cditsFile,1,text,31,a) && equali(currmap,text))         {             if (read_file(cditsFile,2,text,31,a))                 g_credits[id] = str_to_num(text)         }         else             delete_file(cditsFile)     }     return PLUGIN_CONTINUE } public client_disconnect(id) {     if ( is_user_bot(id) )         return PLUGIN_CONTINUE     if (g_player_authenticated[id] && g_credits[id] < g_credits_start)     {         new cditsFile[64]         format(cditsFile,63,"addons/amxmodx/logcredits/%s.txt",g_player_authid[id])         replace(cditsFile,63,":","_")         replace(cditsFile,63,":","_")         new currmap[32]         get_mapname(currmap,31)         write_file(cditsFile,currmap,1)         new text[8]         num_to_str(g_credits[id],text,7)         write_file(cditsFile,text,2)     }     return PLUGIN_CONTINUE } public eResetHud(id){     g_SpawnTime[id] = get_gametime()     return PLUGIN_CONTINUE } // protection vs  TA public client_damage(attacker,victim,damage,wpnindex,hitplace,TA){     if ( !TA || !is_user_alive(victim) || damage<10 ) // damage<10: do not punish small TA, very often unvulontarys         return PLUGIN_CONTINUE     new name[32]     new menuBody[192]     new attackerid     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3) // 4 is "invisible" but used to force menu to quit in 2 situations later     get_user_name(attacker,name,31)     g_menu_attackerid[victim] = attacker     attackerid = get_user_userid(attacker)     Last2Attacker = Last1Attacker     Last2Victim = Last1Victim     Last1Attacker = attacker     Last1Victim = victim         // spawn TA protection     if ( get_gametime() - g_SpawnTime[victim] < get_cvar_float("amx_ffm_protectiontime") || get_gametime() - g_SpawnTime[attacker] < get_cvar_float("amx_ffm_protectiontime")){         g_credits[attacker] = g_credits[attacker]-7         set_task(0.5,"delayedkill",attackerid)         set_hudmessage(255, 0, 255, 0.05, 0.8, 0, 4.0, 11.0, 0.1, 0.5, 8)           show_hudmessage(0,"%s slayed to have wounded an ally at respawn^nand losses 7 credits he has %i remaining!", name, g_credits[attacker])         format(menuBody,120,"-7 credits for %s:^n1. Forgive^n2. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(attacker)         log_message("[FF MANAGER] %s attacked an ally at respawn and gets %i credits!",name, g_credits[attacker])         return PLUGIN_CONTINUE     }   // TA melee protection     if ( xmod_is_melee_wpn(wpnindex) ){         g_credits[attacker] = g_credits[attacker]-4         set_hudmessage(0, 255, 0, 0.05, 0.8, 0, 4.0, 11.0, 0.1, 0.5, 8)         show_hudmessage(0,"%s losses 4 credits to have wounded at melee^nan ally, he has %i remaining!", name, g_credits[attacker])         format(menuBody,120,"-4 credits for %s:^n1. Forgive^n2. Slap 30 Hp and forgive^n3. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(attacker)         return PLUGIN_CONTINUE          }         // TA mortar protection     if ( wpnindex == DODW_MORTAR ){         g_credits[attacker] = g_credits[attacker]-2         set_hudmessage(0, 255, 0, 0.05, 0.8, 0, 4.0, 11.0, 0.1, 0.5, 8)         show_hudmessage(0,"%s losses 2 credits to have wounded an ally with mortar,^nhe has %i remaining!", name, g_credits[attacker])         format(menuBody,120,"-2 credits for %s:^n1. Forgive^n2. Slap 10 Hp and forgive^n3. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(attacker)         return PLUGIN_CONTINUE     }         set_hudmessage(255, 255, 255, 0.05, 0.8, 0, 3.0, 10.0, 0.1, 0.5, 8)     if (wpnindex==13||wpnindex==14||wpnindex==36){         g_credits[attacker] = g_credits[attacker]-1         show_hudmessage(0,"%s losses 1 credit to have wounded of %d Hp^nan ally with grenade and has %i remaining!", name, damage, g_credits[attacker])         format(menuBody,120,"-1 credit for %s:^n1. Forgive^n2. Slap (5 Hp) and forgive.^n3. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(attacker)         return PLUGIN_CONTINUE     }     if (wpnindex==29||wpnindex==30||wpnindex==31) {         g_credits[attacker] = g_credits[attacker]-2         show_hudmessage(0,"%s losses 2 credits to have wounded of %d Hp^nan ally with rocket-launcher and has %i remaining!", name, damage, g_credits[attacker])         format(menuBody,120,"-2 credits for %s:^n1. Forgive^n2.Slap (10 Hp) and forgive.^n3. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(attacker)         return PLUGIN_CONTINUE     }     g_credits[attacker] = g_credits[attacker]-3     show_hudmessage(0,"%s losses 3 credits to have wounded of %d Hp^nan ally and has %i remaining!", name, damage, g_credits[attacker])     format(menuBody,120,"-3 credits for %s:^n1. Forgive^n2.Slap (15 Hp) and forgive.^n3. Do not forgive",name)     show_menu(victim,keys,menuBody,40)     Check_credits(attacker)     return PLUGIN_CONTINUE } public client_death(killer,victim,wpnindex,hitplace,TK) {     if ( !TK )         return PLUGIN_CONTINUE // If amx_ffm_multiTK=1, when a multi-Tk at grenade happens, only the 1st will be punished     if ( get_cvar_num("amx_ffm_multiTK") && g_LastAttackTime[killer] == get_gametime() && (wpnindex==13||wpnindex==14||wpnindex==36) ){         return PLUGIN_CONTINUE }     g_LastAttackTime[killer] = get_gametime()     new name[32]     new killerid     new victimid     new menuBody[192]     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)     get_user_name(killer,name,31)     g_menu_killerid[victim] = killer     killerid = get_user_userid(killer)     victimid = get_user_userid(victim)     Last2Attacker = Last1Attacker     Last2Victim = Last1Victim     Last1Attacker = killer     Last1Victim = victim       // spawn TK protection     if ( get_gametime() - g_SpawnTime[victim] < get_cvar_float("amx_ffm_protectiontime") || get_gametime() - g_SpawnTime[killer] < get_cvar_float("amx_ffm_protectiontime") ){         set_task(0.5,"delayedkill",killerid)         g_credits[killer] = g_credits[killer]-8         set_hudmessage(255, 0, 255, 0.05, 0.8, 0, 5.0, 11.0, 0.1, 0.5, 8)         show_hudmessage(0,"%s slayed to have killed an ally at spawn^nand losses 8 credits, he has %i remaining!", name, g_credits[killer])         format(menuBody,120,"-8 credits for %s:^n1. Forgive^n2. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(killer)         log_message("[FF MANAGER] %s has killed an ally at spawn and has %i credits remaining!",name, g_credits[killer])         return PLUGIN_CONTINUE     }       // melee TK protection     if ( xmod_is_melee_wpn(wpnindex) ){         g_credits[killer] = g_credits[killer]-6         set_hudmessage(0, 255, 0, 0.05, 0.8, 0, 5.0, 11.0, 0.1, 0.5, 8)         show_hudmessage(0,"%s losses 6 credits to have killed an ally^nat melee; he has %i remaining!", name, g_credits[killer])         format(menuBody,120,"-6 credits for %s:^n1. Forgive^n2. Slap (40Hp) and forgive^n3. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(killer)         return PLUGIN_CONTINUE     }         // mortar TK protection     if ( wpnindex == DODW_MORTAR ){         g_credits[killer] = g_credits[killer]-3         set_hudmessage(0, 255, 0, 0.05, 0.8, 0, 5.0, 11.0, 0.1, 0.5, 8)         show_hudmessage(0,"%s losses 3 credits to have killed an ally^nwith mortar; he has %i remaining!", name, g_credits[killer])         format(menuBody,120,"-3 credits for %s:^n1. Forgive^n2. Slap (15Hp) and forgive^n3. Do not forgive",name)         show_menu(victim,keys,menuBody,40)         Check_credits(killer)         return PLUGIN_CONTINUE     }   // normal TK     new menuid     // prevents the double punishment if the wounder kills: it closes the forgive menu for the TA and forgives it invisibly     if (get_user_menu(victim,menuid,keys) && g_menu_attackerid[victim]==killer){         client_cmd(victim,"slot4")         g_credits[killer] = g_credits[killer]+3     }     g_credits[killer] = g_credits[killer]-4     set_hudmessage(255, 200, 0, 0.05, 0.8, 0, 5.0, 11.0, 0.1, 0.5, 8)     show_hudmessage(0,"%s losses 4 credits to have killed an ally; he has %i remaining!", name, g_credits[killer])      set_task(0.5,"delayedmenu",victimid) // delayedmenu to prevent (I believe) the previous command "slot4" closes this new one too.     return PLUGIN_CONTINUE } // checks the number of credits after a TA/TK Check_credits(player) {     if (g_credits[player] > g_credits_start)         return 0     new name[32], userid     get_user_name(player,name,31)     userid = get_user_userid(player)     set_hudmessage(255, 0, 0, 0.05, 0.6, 0, 8.0, 10.0, 0.1, 0.5, 8)     client_print(userid, print_chat, "If you have no credits anymore, you will be banned %d minutes!",g_bantime)     if (g_credits[player] < 5 && g_credits[player] > -1)     {         set_task(0.5,"delayedkill",userid)         show_hudmessage(0,"%s slayed  because he has less than 5 credits!", name, g_credits[player])     }     if (g_credits[player] < 0)     {         set_task(0.5,"delayedkill",userid)         if (g_adminimmunity && (get_user_flags(player) & ADMIN_BAN))         {             show_hudmessage(0,"%s has no credits anymore^nbut is not banned because he has the immunity!", name)                     }         else         {             if ((g_bantime % 1440)==0)             {                 show_hudmessage(0,"%s has no credits anymore^nand is banned %d hours!", name, (g_bantime / 60))             }             else if (g_bantime < 60)             {                 show_hudmessage(0,"%s has no credits anymore^nand is banned %d minutes!", name, (g_bantime % 1440))             }             else             {                 show_hudmessage(0,"%s%s has no credits anymore^nand is banned %d hours %d minutes!", name, (g_bantime / 60), (g_bantime % 1440))             }             g_credits[player] = g_credits_start // if during the same map the player is unbanned and reconnects, it prevents he starts with negatives credits...             set_task(0.7,"delayedban",userid)         }         log_message("[FF MANAGER] %s was banned %d minutes because he has no credits anymore!",name, g_bantime)         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public Menu1(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_attackerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 1             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 1 credit back", NameV, NameA)         }                 case 1:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 1             user_slap (g_menu_attackerid[id], 5)             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has slaped (5 Hp) %s^nand gives him 1 credit back", NameV, NameA)         }                 case 2:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public Menu2(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_attackerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 2             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 2 credits back", NameV, NameA)         }                 case 1:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 2             user_slap (g_menu_attackerid[id], 10)             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has slaped (10 Hp) %s^nand gives him 2 credits back", NameV, NameA)         }                 case 2:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public Menu3(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_attackerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 3             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 3 credits back", NameV, NameA)         }                 case 1:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 3             user_slap (g_menu_attackerid[id], 15)             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has slaped (15 Hp) %s^nand gives him 3 credits back", NameV, NameA)         }                 case 2:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public Menu4(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_killerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_killerid[id]] = g_credits[g_menu_killerid[id]] + 4             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 4 credits back", NameV, NameA)         }                 case 1:{             g_credits[g_menu_killerid[id]] = g_credits[g_menu_killerid[id]] + 1             user_slap (g_menu_attackerid[id], 20)             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has slaped (20 Hp) %s^nand gives him 4 credits back", NameV, NameA)         }                 case 2:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public Menu5(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_attackerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 5             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 5 credits back", NameV, NameA)         }                 case 1:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 5             user_slap (g_menu_attackerid[id], 30)             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has slaped (30 Hp) %s^nand gives him 5 credits back", NameV, NameA)         }                 case 2:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public Menu6(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_killerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_killerid[id]] = g_credits[g_menu_killerid[id]] + 6             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 6 credits back", NameV, NameA)         }                 case 1:{             g_credits[g_menu_killerid[id]] = g_credits[g_menu_killerid[id]] + 6             user_slap (g_menu_attackerid[id], 40)             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has slaped (40 Hp) %s^nand gives him 6 credits back", NameV, NameA)         }                 case 2:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public Menu7(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_attackerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 7             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 7 credits back", NameV, NameA)         }                 case 1:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public Menu8(id,key) {     new NameV[32], NameA[32]     get_user_name(id,NameV,31)     get_user_name(g_menu_killerid[id],NameA,31)         switch(key)     {         case 0:{             g_credits[g_menu_killerid[id]] = g_credits[g_menu_killerid[id]] + 7             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s has forgiven %s^nand gives him 7 credits back", NameV, NameA)         }                 case 1:{             set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)               show_hudmessage(0,"%s does not forgive %s^nbut can do it later by writting forgive", NameV, NameA)         }     }     return PLUGIN_HANDLED } public delayedmenu(victimid){     new menuBody[192]     new name[32]     get_user_name(g_menu_killerid[victimid],name,31)     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)     format(menuBody,120,"-4 credits pour %s:^n1. Pardonner^n2. Gifler de 20Hp et pardonner^n3. Ne pas pardonner",name)     show_menu(victimid,keys,menuBody,40) } public delayedkill(id){     user_kill(id) } public delayedban(userid){     server_cmd("banid %d.0 #%d",g_bantime,userid)     server_cmd("writeid")     server_cmd("kick #%d",userid) } // checks players'chat and forgives until lasts 2 actions if asked public HandleSay(id) {     new text[12]     read_argv(1,text,11)     if ( containi(text,"pardonner") == 0 || containi(text,"pardon") == 0 || containi(text,"forgive") == 0 || containi(text,"forgivetk") == 0 )     {         new menuid, keys         new NameV[32]         new NameA[32]         new userid         set_hudmessage(0, 90, 235, 0.05, 0.72, 0, 3.0, 11.0, 0.1, 0.5, 9)         userid = get_user_userid(id)         if (id == Last1Victim)         {             if (get_user_menu(id,menuid,keys) && (g_menu_attackerid[id]==Last1Attacker || g_menu_killerid[id]==Last1Attacker) ) {                 client_cmd(id,"slot4")                 get_user_name(Last1Victim,NameV,31)                 get_user_name(Last1Attacker,NameA,31)                 g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 4                 show_hudmessage(0,"Finally %s has forgiven %s", NameV, NameA)                 Last1Victim = Last2Victim                 Last1Attacker = Last2Attacker                 Last2Victim = 0                 Last2Attacker = 0                 return PLUGIN_CONTINUE             }             client_print(userid, print_chat, "Sorry it is too late to forgive")         }                 if (id == Last2Victim)         {             if (get_user_menu(id,menuid,keys) && (g_menu_attackerid[id]==Last2Attacker || g_menu_killerid[id]==Last2Attacker) ) {                 client_cmd(id,"slot4")                 get_user_name(Last1Victim,NameV,31)                 get_user_name(Last1Attacker,NameA,31)                 g_credits[g_menu_attackerid[id]] = g_credits[g_menu_attackerid[id]] + 4                 show_hudmessage(0,"Finally %s has forgiven %s", NameV, NameA)                 Last2Victim = 0                 Last2Attacker = 0                 return PLUGIN_CONTINUE                          }             client_print(userid, print_chat, "Sorry it is too late to forgive")                 }             }     return PLUGIN_CONTINUE }


So if some of you wants to have a look and manage to find the errors, I would give them thousands of thanks . I have spent 2 weeks to do that, and I think it will be very nice to have a similar plugin on DOD servers. And sorry for my english not very good

NB: there is a french version
Attached Files
File Type: sma Get Plugin or Get Source (dod_ff_manager_0.1_fr.sma - 629 views - 22.6 KB)
File Type: amxx dod_ff_manager_0.1_us.amxx (15.5 KB, 126 views)
File Type: sma Get Plugin or Get Source (dod_ff_manager_0.1_us.sma - 642 views - 22.4 KB)
Colt 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 17:26.


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