Raised This Month: $ Target: $400
 0% 

DM Counter help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AntagonistForHire
New Member
Join Date: Jan 2007
Old 02-04-2007 , 01:44   DM Counter help
Reply With Quote #1

Basically my question is, how do I get the actions in the switch case 0 to actually work. It won't compile as is because the variable "killer" in the switch is not defined, I get that. But how do I get the value from the event_deathmsg to the function that has the switch in it?

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Pluginr"
#define VERSION "1.0"
#define AUTHOR "Author"

new playerKills[33] = {0,...};
new 
maxKills 3;


public 
plugin_init()
{
    
register_event("DeathMsg","death_msg","a")    
    
set_task(150.0,"minusdm",0,"",0,"b")
    
}

public 
death_msg()
{

    new 
killerd read_data(1);
    new 
victim read_data(2);
    new 
menu[1024]
    new 
key = (1<<0|1<<1)

    if(!
killerd || killerd == victim) return;
    
killer read_data(1);

    
format(menu,sizeof(menu),"DM Menu")
    
add(menu,sizeof(menu)," ^n^n ")
    
add(menu,sizeof(menu),"Were you DMed?^n^n ")
    
add(menu,sizeof(menu),"1. Yes^n ")
    
add(menu,sizeof(menu),"2. No^n ")
    
show_menu(victimkeymenu)

}

public 
DMMenu(victim,key)
{
    switch(
key)
    {
        case 
0:
        {
            if (
playerKills[killer] < 3){
            
playerKills[killer] += 1;
            
client_print(killerprint_chat"[DM Counter] DM points increased (%i/%i)"playerKills[killer], maxKills)    
            }
            if (
playerKills[killer] == maxKills) {
            
server_cmd("banid 30 #%d kick^"[DM CounterYou were banned for deathmatching excessively^""get_user_userid(killer))
            }
        }
        case 
1:
        {
            
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
minusdm(id){
        
if (
playerKills[id] > 0) {
client_print(idprint_chat"[DM Counter] One DM point has been subtracted (%i/%i)"playerKills[id], maxKills)    
playerKills[id] -= 1;
}


Last edited by AntagonistForHire; 02-04-2007 at 23:53. Reason: Moved some text
AntagonistForHire is offline
GraffityMaster
Member
Join Date: Jan 2007
Old 02-04-2007 , 05:08   Re: DM Counter help
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Pluginr"
#define VERSION "1.0"
#define AUTHOR "Author"
new playerKills[33] = {0,...};
new 
maxKills 3;
public 
plugin_init()
{
 
register_event("DeathMsg","death_msg","a")    
 
set_task(150.0,"minusdm",0,"",0,"b")
 
}
public 
death_msg()
{
 new 
killer read_data(1);
 new 
victim read_data(2);
 
 new 
menu[1024]
 new 
key = (1<<0|1<<1)
 
 if(!
killer || killer == victim
  return 
PLUGIN_HANDLED;
 
 
format(menu,sizeof(menu),"DM Menu")
 
add(menu,sizeof(menu)," ^n^n ")
 
add(menu,sizeof(menu),"Were you DMed?^n^n ")
 
add(menu,sizeof(menu),"1. Yes^n ")
 
add(menu,sizeof(menu),"2. No^n ")
 
 
show_menu(victimkeymenu)
}
public 
DMMenu(victimkillerkey)
{
 switch(
key)
 {
  case 
0:
  {
   if (
playerKills[killer] < 3){
    
playerKills[killer] += 1;
    
client_print(killerprint_chat"[DM Counter] DM points increased (%i/%i)"playerKills[killer], maxKills)    
   }
   if (
playerKills[killer] == maxKills) {
    
server_cmd("banid 30 #%d kick^"[DM CounterYou were banned for deathmatching excessively^""get_user_userid(killer))
   }
  }
  
  case 
1:
  {
   
  }
 }
 return 
PLUGIN_HANDLED;
}
public 
minusdm(id){
 
 if (
playerKills[id] > 0) {
  
client_print(idprint_chat"[DM Counter] One DM point has been subtracted (%i/%i)"playerKills[id], maxKills)    
  
playerKills[id] -= 1;
 }

Dont know if it works havent tested it
__________________

Last edited by GraffityMaster; 02-04-2007 at 05:13. Reason: Edited some of your code
GraffityMaster is offline
Old 02-05-2007, 20:07
AntagonistForHire
This message has been deleted by AntagonistForHire.
AntagonistForHire
New Member
Join Date: Jan 2007
Old 02-08-2007 , 23:53   Re: DM Counter help
Reply With Quote #3

I'm still encountering the same problem. Does anyone have any additional ideas as to how to get this to function?


I've taken a peak at those TK punish plugins and tried a few things from them but to no avail.
AntagonistForHire is offline
Reply



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 02:37.


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