Raised This Month: $51 Target: $400
 12% 

Tag Mode Plugin not working right :(


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Trafalete
Senior Member
Join Date: Sep 2008
Location: Bucuresti ( Printre nori
Old 10-08-2008 , 14:08   Tag Mode Plugin not working right :(
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>   
// i am gonna try to convert to fakemeta
// a help could be used too

#define PLUGIN "Leapsa"
#define VERSION "0.1"
#define AUTHOR "anakin_cstrike"   
// little modifications by Trafa'

new g_msgscreenfade;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_forward(FM_PlayerPreThink,"fw_prethink");

    
register_event("Damage""evn_damage""b""2!0""3=0""4!0");
    
register_event("CurWeapon","evn_curwpn","be","1=1");

    
g_msgscreenfade get_user_msgid("ScreenFade");
}

public 
evn_damage(victim)
{
    new 
weapon,attacker get_user_attacker(victimweapon);

    if(!
attacker || !victim)
        return 
PLUGIN_CONTINUE;

    if(
weapon != CSW_KNIFE)
        return 
PLUGIN_CONTINUE;
    
    
cs_set_user_team(victim,CS_TEAM_T);
    
cs_set_user_team(attacker,CS_TEAM_CT);

    
set_pev(attacker,pev_takedamage,0.0);
    
Fade(victim,(6<<10),(5<<10),(1<<12),255,0,0,255);

    
set_task(5.0,"normal",attacker);

    return 
PLUGIN_CONTINUE;
}

public 
normal(id
    
set_pev(id,pev_takedamage,2.0);

public 
evn_curwpn(id)
    
engclient_cmd(id,"weapon_knife");

public 
fw_prethink(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;

    if(
cs_get_user_team(id) == CS_TEAM_T)
        
set_pev(id,pev_takedamage,0.0);
    else
        
set_pev(id,pev_takedamage,2.0);

    return 
FMRES_IGNORED;    
}
Fade(index,duration,holdtime,flags,red,green,blue,alpha)
{
    
message_begin(MSG_ONE,g_msgscreenfade,{0,0,0},index);

    
write_short(duration);
    
write_short(holdtime);
    
write_short(flags);

    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_byte(alpha);

    
message_end();

not sure why...but the Fade function wich has holdtime parameter isn't freezing at all....and i can't seem to tag anyone

i think i made it work once or twice...not sure what i did

PS: i would like to make it so noone takes any damage when tagged....but if i set the health after he gets damaged...he can still die if stabbed in the back / get's headshot
__________________


Trafalete is offline
platEE
Member
Join Date: Jul 2008
Location: Finland, Kuopio
Old 10-09-2008 , 09:37   Re: Tag Mode Plugin not working right :(
Reply With Quote #2

Code:
public normal(id) 
    set_pev(id,pev_takedamage,2.0);

public evn_curwpn(id)
    engclient_cmd(id,"weapon_knife");

u forgot opening and closing brackets ->
Code:
public normal(id) 
{
    set_pev(id,pev_takedamage,2.0);
}
public evn_curwpn(id)
{
    engclient_cmd(id,"weapon_knife");
}


Thats all i can do, sorry =(

__________________
ALWAYS leave your name when giving +Karma
platEE is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 10-09-2008 , 10:24   Re: Tag Mode Plugin not working right :(
Reply With Quote #3

platEE, that doesn't effect anything. If you have a single statement, function, loop, et cetera after it, curly brackets aren't required. You'll see another example in the code below.

A couple things that I noticed are...

You should ALWAYS check the player index to make sure that the player is alive before using any function with the supplied index as a parameter:
PHP Code:
public evn_damage(victim)
{
    if(!
victim || !is_user_alive(victim))
        return 
PLUGIN_CONTINUE;

    new 
weapon,attacker get_user_attacker(victimweapon);

    if(!
attacker)
        return 
PLUGIN_CONTINUE;

    if(
weapon != CSW_KNIFE)
        return 
PLUGIN_CONTINUE;
    
    
cs_set_user_team(victim,CS_TEAM_T);
    
cs_set_user_team(attacker,CS_TEAM_CT);

    
set_pev(attacker,pev_takedamage,0.0);
    
Fade(victim,(6<<10),(5<<10),(1<<12),255,0,0,255);

    
set_task(5.0,"normal",attacker);

    return 
PLUGIN_CONTINUE;

Same with these two:
PHP Code:
public normal(id)
    if(
is_user_alive(id))
        
set_pev(id,pev_takedamage,2.0);

public 
evn_curwpn(id)
    if(
is_user_alive(id))
        
engclient_cmd(id,"weapon_knife"); 
Proper way of using cs_get_user_team:
PHP Code:
public fw_prethink(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;

    new 
CsTeams:team cs_get_user_team(id);

    if(
team == CS_TEAM_T)
        
set_pev(id,pev_takedamage,0.0);
    else
        
set_pev(id,pev_takedamage,2.0);

    return 
FMRES_IGNORED;    

It's a common mistake.

I don't really get the point of this plugin, so I didn't bother to edit anything else. My changes may or may not fix it.

Good luck!
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Trafalete
Senior Member
Join Date: Sep 2008
Location: Bucuresti ( Printre nori
Old 10-09-2008 , 17:04   Re: Tag Mode Plugin not working right :(
Reply With Quote #4

thank you v3x...the point of this plugin is to make my own Tag Mod for CS / CZ to play with my friends...the ideea came to us one night after we got bored and started inventing rules for a small tag game...but it was kind of difficult to keep track who was IT and we were loosing hp and eventualy die in the progress...that's why i thought i could ask for / make a plugin for this mod...other than that...nothing special
__________________


Trafalete 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 18:37.


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