Raised This Month: $ Target: $400
 0% 

Warnings, pls help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dark Killer
Senior Member
Join Date: May 2005
Location: Kowloon, Hong Kong
Old 04-09-2007 , 01:10   Warnings, pls help!
Reply With Quote #1

I got 5 warnings totally in this plugin. Please help me to debug it, cause I don't know what happened... Thanks...

Compile result:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Warning: Tag mismatch on line 95
Warning: Tag mismatch on line 96
Warning: Tag mismatch on line 98
Warning: Tag mismatch on line 98
Warning: Possibly unintended assignment on line 106
Header size: 1100 bytes
Code size: 6628 bytes
Data size: 4960 bytes
Stack/heap size: 16384 bytes; estimated max. usage=175 cells (700 bytes)
Total requirements: 29072 bytes

5 Warnings.
Done.

Code:
/*  * Catching Mod 0.1 */ #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <engine> // PCVARS new cvar_enable; new cvar_warnings; new cvar_glow; new cvar_higher; // VARS new bool:has_catcher; new bool:is_catcher[33]; new bool:kill_warned[33]; new bool:will_be_catcher[33]; new players; new timer; new firstVictim; public plugin_init() {     register_plugin("Catching Mod", "0.1", "Dark Killer");         cvar_enable = register_cvar("cc_enable", "0");     cvar_warnings = register_cvar("cc_warn", "1");     cvar_glow = register_cvar("cc_glow", "1");     cvar_higher = register_cvar("cc_catcher_stronger", "1");         register_concmd("catching_enable", "ccEnable", ADMIN_LEVEL_E, "- Enables or disables catching");         register_event("ResetHUD", "resetHud", "be");     register_event("ShowMenu", "blockTeam", "b", "1=#Team_Select_Terror");     register_event("HLTV", "hltv_newRound", "a", "1=0", "2=0")     register_event("DeathMsg", "death","a", "1!0", "4!c4")     register_logevent("logevent_round_end", 2, "1=Round_End") } public client_connect(id) {     is_catcher[id] = false;     will_be_catcher[id] = false; } public client_disconnect(id) {     if(!is_catcher[id]) {         return PLUGIN_CONTINUE;     } else {         has_catcher = false;                 set_hudmessage(0, 0, 255, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);         show_hudmessage(0, "Catcher is left! Restarting game...");                 set_cvar_num("sv_restart", 2);     }         is_catcher[id] = false;     will_be_catcher[id] = false;         return PLUGIN_CONTINUE; } public logevent_round_end(id) {     is_catcher[0] = false; } public hltv_newRound() {     firstVictim = 0; } public death() {     // First one died check     // Credits to Ryu2877     // Help thread for reference: <a href="http://forums.alliedmods.net/showthread.php?p=462214" target="_blank" rel="nofollow noopener">http://forums.alliedmods.net/showthread.php?p=462214</a>     if(firstVictim > 0)         return PLUGIN_CONTINUE;     new Killer = read_data(1); //killer id     new Victim = read_data(2); //victim id     if(Killer == Victim) {         set_cvar_num("sv_restart", 1);             set_hudmessage(0, 0, 255, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);         show_hudmessage(0, "Catcher is dead! Restarting round...");     }         firstVictim = Victim;     new sVictim[32];     get_user_name(Victim, sVictim, sizeof sVictim - 1);     client_print(0, print_chat, "%s is the first one who died and will be the catcher next round...", sVictim);     will_be_catcher[Killer] = true;     is_catcher[Victim] = false;     // End         new gVictimTeam, gKillerTeam;         gVictimTeam = cs_get_user_team(Victim);     gKillerTeam = cs_get_user_team(Killer);         if(gVictimTeam == CS_TEAM_CT && gKillerTeam == CS_TEAM_T) {         if(get_pcvar_num(cvar_warnings) == 1) { // Does warning enabled?             // Warn the killer             client_print(Killer, print_chat, "Warning! Stop killing the catcher.^nThis is the ONLY warning!");                         if(kill_warned[Killer] = false) {                 server_cmd("kick #%d ^"You are kicked because you killed the catcher.^"", get_user_userid(Killer));             }                         kill_warned[Killer] = true;         } else { // OMG! If warning isn't enabled...             server_cmd("kick #%d ^"You are kicked because you killed the catcher.^"", get_user_userid(Killer));         }                 set_cvar_num("sv_restart", 1);             set_hudmessage(0, 0, 255, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);         show_hudmessage(0, "Catcher is dead! Restarting round...");     }         return PLUGIN_CONTINUE; } public resetHud(id) {     if(get_pcvar_num(cvar_enable) == 0)         return PLUGIN_CONTINUE;         if(has_catcher == false) {         set_hudmessage(0, 0, 255, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);         show_hudmessage(0, "Randomizing catcher...");                 set_task(3.0, "selectCatcher");     }         if(will_be_catcher[id] == true) {         is_catcher[id] = true;         will_be_catcher[id] = false;     }         if(is_catcher[id] == true) { // Check whether player is a catcher         if (get_pcvar_num(cvar_higher) == 1) {             // Catcher has higher health and armor             set_user_health(id, 255);             set_user_armor(id, 255);         }                 // Glow catcher         if (get_pcvar_num(cvar_glow) == 1)             set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25);                 // Tell who is catcher         new name[32];         get_user_name(id, name, 31);                 set_hudmessage(255, 0, 0, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);         show_hudmessage(0, "Beware of %s,^ns/he is the catcher!", name);     } else {         cs_set_user_team(id, CS_TEAM_T);         set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25);     }         // Remove buyzones to prevent players buying anything     // Thanks T(+)rget for this part     new func_buy = find_ent_by_class(-1, "func_buyzone");     while(func_buy > get_maxplayers()) {         entity_set_int(func_buy, EV_INT_flags, FL_KILLME);         func_buy = find_ent_by_class(func_buy, "func_buyzone");     }     // Remove buyzones END     // Remove bombsites to prevent Ts planting bombs     new func_bomb = find_ent_by_class(-1, "func_bomb_target");     while(func_bomb > get_maxplayers()) {             entity_set_int(func_bomb, EV_INT_flags, FL_KILLME);             func_bomb = find_ent_by_class(func_bomb, "func_bomb_target");     }     // Remove bombsites END         // Strip and give essential weapons     strip_user_weapons(0);         give_item(0, "weapon_knife");         give_item(0, "weapon_scout");     give_item(0, "weapon_flashbang");     give_item(0, "weapon_flashbang");         give_item(0, "weapon_smokegrenade");         // Give some money (although useless)     cs_set_user_money(0, 16000);         return PLUGIN_CONTINUE; } public ccEnable() {     if(get_pcvar_num(cvar_enable) == 1) {         set_pcvar_num(cvar_enable, 0);                 set_cvar_num("mp_buytime", 15);         set_cvar_num("mp_roundtime", 5);         set_cvar_num("sv_gravity", 800);         set_cvar_num("decalfrequency", 30);                 set_task(0.9,"startCount",0);     } else {         set_pcvar_num(cvar_enable, 1);         set_cvar_num("mp_buytime", 18);         set_cvar_num("mp_roundtime", 9);         set_cvar_num("sv_gravity", 650);         set_cvar_num("decalfrequency", 60);         set_cvar_num("sv_alltalk", 1);                 set_task(0.9,"startCount",0);     } }     public startCount() {     if(!timer) {             timer = 5;         } else {             new output[32];             num_to_word(timer,output,31);             client_cmd(0,"spk vox/%s.wav",output);             if(timer > (5 / 2))                 set_hudmessage(20, 250, 20, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);             else                 set_hudmessage(255, 0, 0, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);             if(timer > (5 - 2))                 show_hudmessage(0, "Catching game will start/stop in... %i", timer);             else                 show_hudmessage(0, "%i", timer);             if(timer == 1)                 server_cmd("sv_restart 1");             timer--;             set_task(0.9,"startCount",0);     } } public selectCatcher(id) {      new maxplayers = get_maxplayers();          players = random_num(1, maxplayers);         is_catcher[players] = true;     cs_set_user_team(players, CS_TEAM_CT);     has_catcher = true;         set_hudmessage(0, 0, 255, -1.0, 0.55, 1, 1.0, 1.0, 1.0, 0.5, 2);     show_hudmessage(0, "A catcher has been selected!^nRestarting...");              set_cvar_num("sv_restart", 1); } public blockTeam(id)     show_menu(id, 0, " ", 1, "#Team_Select_Terror");
__________________

Last edited by Dark Killer; 04-09-2007 at 01:27. Reason: Update the code
Dark Killer is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-09-2007 , 01:52   Re: Warnings, pls help!
Reply With Quote #2

PHP Code:
/*
 * Catching Mod 0.1
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>

// PCVARS
new cvar_enable;
new 
cvar_warnings;
new 
cvar_glow;
new 
cvar_higher;

// VARS
new bool:has_catcher;
new 
bool:is_catcher[33];
new 
bool:kill_warned[33];
new 
bool:will_be_catcher[33];
new 
players;
new 
timer;
new 
firstVictim;

public 
plugin_init() {
    
register_plugin("Catching Mod""0.1""Dark Killer");
    
    
cvar_enable register_cvar("cc_enable""0");
    
cvar_warnings register_cvar("cc_warn""1");
    
cvar_glow register_cvar("cc_glow""1");
    
cvar_higher register_cvar("cc_catcher_stronger""1");
    
    
register_concmd("catching_enable""ccEnable"ADMIN_LEVEL_E"- Enables or disables catching");
    
    
register_event("ResetHUD""resetHud""be");
    
register_event("ShowMenu""blockTeam""b""1=#Team_Select_Terror");
    
register_event("HLTV""hltv_newRound""a""1=0""2=0")
    
register_event("DeathMsg""death","a""1!0""4!c4")
    
register_logevent("logevent_round_end"2"1=Round_End")
}

public 
client_connect(id) {
    
is_catcher[id] = false;
    
will_be_catcher[id] = false;
}

public 
client_disconnect(id) {
    if(!
is_catcher[id]) {
        return 
PLUGIN_CONTINUE;
    } else {
        
has_catcher false;
        
        
set_hudmessage(00255, -1.00.5511.01.01.00.52);
        
show_hudmessage(0"Catcher is left! Restarting game...");
        
        
set_cvar_num("sv_restart"2);
    }
    
    
is_catcher[id] = false;
    
will_be_catcher[id] = false;
    
    return 
PLUGIN_CONTINUE;
}

public 
logevent_round_end(id) {
    
is_catcher[0] = false;
}

public 
hltv_newRound() {
    
firstVictim 0;
}

public 
death() {
    
// First one died check
    // Credits to Ryu2877
    // Help thread for reference: <a href="http://forums.alliedmods.net/showthread.php?p=462214" target="_blank">http://forums.alliedmods.net/showthread.php?p=462214</a>
    
if(firstVictim 0)
        return 
PLUGIN_CONTINUE;
    new 
Killer read_data(1); //killer id
    
new Victim read_data(2); //victim id
    
if(Killer == Victim) {
        
set_cvar_num("sv_restart"1);
    
        
set_hudmessage(00255, -1.00.5511.01.01.00.52);
        
show_hudmessage(0"Catcher is dead! Restarting round...");
    }
    
    
firstVictim Victim;
    new 
sVictim[32];
    
get_user_name(VictimsVictimsizeof sVictim 1);
    
client_print(0print_chat"%s is the first one who died and will be the catcher next round..."sVictim);
    
will_be_catcher[Killer] = true;
    
is_catcher[Victim] = false;
    
// End
    
    
if(cs_get_user_team(Victim) == CS_TEAM_CT && cs_get_user_team(Killer) == CS_TEAM_T) {
        if(
get_pcvar_num(cvar_warnings) == 1) { // Does warning enabled?
            // Warn the killer
            
client_print(Killerprint_chat"Warning! Stop killing the catcher.^nThis is the ONLY warning!");
            
            if(
kill_warned[Killer] == false) {
                
server_cmd("kick #%d ^"You are kicked because you killed the catcher.^""get_user_userid(Killer));
            }
            
            
kill_warned[Killer] = true;
        } else { 
// OMG! If warning isn't enabled...
            
server_cmd("kick #%d ^"You are kicked because you killed the catcher.^""get_user_userid(Killer));
        }
        
        
set_cvar_num("sv_restart"1);
    
        
set_hudmessage(00255, -1.00.5511.01.01.00.52);
        
show_hudmessage(0"Catcher is dead! Restarting round...");
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
resetHud(id) {
    if(
get_pcvar_num(cvar_enable) == 0)
        return 
PLUGIN_CONTINUE;
    
    if(
has_catcher == false) {
        
set_hudmessage(00255, -1.00.5511.01.01.00.52);
        
show_hudmessage(0"Randomizing catcher...");
        
        
set_task(3.0"selectCatcher");
    }
    
    if(
will_be_catcher[id] == true) {
        
is_catcher[id] = true;
        
will_be_catcher[id] = false;
    }
    
    if(
is_catcher[id] == true) { // Check whether player is a catcher
        
if (get_pcvar_num(cvar_higher) == 1) {
            
// Catcher has higher health and armor
            
set_user_health(id255);
            
set_user_armor(id255);
        }
        
        
// Glow catcher
        
if (get_pcvar_num(cvar_glow) == 1)
            
set_user_rendering(idkRenderFxGlowShell25500kRenderNormal25);
        
        
// Tell who is catcher
        
new name[32];
        
get_user_name(idname31);
        
        
set_hudmessage(25500, -1.00.5511.01.01.00.52);
        
show_hudmessage(0"Beware of %s,^ns/he is the catcher!"name);
    } else {
        
cs_set_user_team(idCS_TEAM_T);
        
set_user_rendering(idkRenderFxGlowShell000kRenderNormal25);
    }
    
    
// Remove buyzones to prevent players buying anything
    // Thanks T(+)rget for this part
    
new func_buy find_ent_by_class(-1"func_buyzone");
    while(
func_buy get_maxplayers()) {
        
entity_set_int(func_buyEV_INT_flagsFL_KILLME);
        
func_buy find_ent_by_class(func_buy"func_buyzone");
    }
    
// Remove buyzones END
    // Remove bombsites to prevent Ts planting bombs
    
new func_bomb find_ent_by_class(-1"func_bomb_target");
    while(
func_bomb get_maxplayers()) {
            
entity_set_int(func_bombEV_INT_flagsFL_KILLME);
            
func_bomb find_ent_by_class(func_bomb"func_bomb_target");
    }
    
// Remove bombsites END
    
    // Strip and give essential weapons
    
strip_user_weapons(0);
    
    
give_item(0"weapon_knife");
    
    
give_item(0"weapon_scout");

    
give_item(0"weapon_flashbang");
    
give_item(0"weapon_flashbang");
    
    
give_item(0"weapon_smokegrenade");
    
    
// Give some money (although useless)
    
cs_set_user_money(016000);
    
    return 
PLUGIN_CONTINUE;
}

public 
ccEnable() {
    if(
get_pcvar_num(cvar_enable) == 1) {
        
set_pcvar_num(cvar_enable0);
        
        
set_cvar_num("mp_buytime"15);
        
set_cvar_num("mp_roundtime"5);
        
set_cvar_num("sv_gravity"800);
        
set_cvar_num("decalfrequency"30);
        
        
set_task(0.9,"startCount",0);
    } else {
        
set_pcvar_num(cvar_enable1);
        
set_cvar_num("mp_buytime"18);
        
set_cvar_num("mp_roundtime"9);
        
set_cvar_num("sv_gravity"650);
        
set_cvar_num("decalfrequency"60);
        
set_cvar_num("sv_alltalk"1);
        
        
set_task(0.9,"startCount",0);
    }
}
    

public 
startCount() {
    if(!
timer) {
            
timer 5;
        } else {
            new 
output[32];
            
num_to_word(timer,output,31);
            
client_cmd(0,"spk vox/%s.wav",output);

            if(
timer > (2))
                
set_hudmessage(2025020, -1.00.5511.01.01.00.52);
            else
                
set_hudmessage(25500, -1.00.5511.01.01.00.52);

            if(
timer > (2))
                
show_hudmessage(0"Catching game will start/stop in... %i"timer);
            else
                
show_hudmessage(0"%i"timer);

            if(
timer == 1)
                
server_cmd("sv_restart 1");
            
timer--;
            
set_task(0.9,"startCount",0);
    }
}

public 
selectCatcher(id) {  
    new 
maxplayers get_maxplayers();    
    
players random_num(1maxplayers);
    
    
is_catcher[players] = true;
    
cs_set_user_team(playersCS_TEAM_CT);
    
has_catcher true;
    
    
set_hudmessage(00255, -1.00.5511.01.01.00.52);
    
show_hudmessage(0"A catcher has been selected!^nRestarting...");  
        
    
set_cvar_num("sv_restart"1);
}

public 
blockTeam(id)
    
show_menu(id0" "1"#Team_Select_Terror"); 
Please give karma

and
In IF statements, you have to use == not =
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
Dark Killer
Senior Member
Join Date: May 2005
Location: Kowloon, Hong Kong
Old 04-09-2007 , 01:57   Re: Warnings, pls help!
Reply With Quote #3

Thanks for helping me. +karma
__________________
Dark Killer 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 06:46.


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