Raised This Month: $ Target: $400
 0% 

DM Counter help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 00:45.


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