AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   DM Counter help (https://forums.alliedmods.net/showthread.php?t=50800)

AntagonistForHire 02-04-2007 01:44

DM Counter help
 
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;
}



GraffityMaster 02-04-2007 05:08

Re: DM Counter help
 
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

AntagonistForHire 02-08-2007 23:53

Re: DM Counter help
 
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.


All times are GMT -4. The time now is 00:45.

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