AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   JailBreak Rebel System (https://forums.alliedmods.net/showthread.php?t=93870)

shadow.hk 06-03-2009 13:53

JailBreak Rebel System
 
I'm trying to make a PrisonBreak mod for 1.6 but am still fairly noob when it comes to scripting... :|

I want to make the rebel system that they have on source, so what happens is when a terrorist damages a counter-terrorist once, a message pops up saying they're a rebel and they turn red, until a new round begins. I compiled a small script that I knew wouldn't work but someone might be able to finish correctly... I got it to work to a degree but it kept on repeating the "%name% is now a rebel!" line over and over after the first hit.

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
#include <colorchat>
#define PLUGIN "Rebel Detector"
#define VERSION "1.0"
#define AUTHOR "shadow.hk"
new g_shown_message[33];
public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR);
 
register_event("Damage""damage_event""b"
 
register_event("HLTV""event_new_round""a");
}
public 
event_new_round(id,attacker)
{
 if(
get_user_team(id) == 1)
 {
  
g_shown_message[id] = 0;
  
fm_set_user_rendering(id,kRenderFxNone,255,255,255,kRenderNormal,16);
 }
}
public 
damage_event(id)
{
 if(
get_user_team(id) == && g_shown_message[id] == 0)
 {
  
fm_set_rendering(idkRenderFxGlowShell25500kRenderNormal1);
 
  new 
name[32];
  
get_user_name(id,name,31);
  
ColorChat(0,NORMAL,"[ ^x04PrisonBreak^x01 ] ^x04%s^x01 Is Now a Rebel!",name);
 
  
g_shown_message[id] = 1;
 }
 return 
HAM_HANDLED;


Any help would be greatly appreciated :)

fysiks 06-03-2009 14:38

Re: JailBreak Rebel System
 
Try this:

. . .

TitANious 06-03-2009 14:40

Re: JailBreak Rebel System
 
Quote:

Originally Posted by shadow.hk (Post 840891)
I'm trying to make a PrisonBreak mod for 1.6 but am still fairly noob when it comes to scripting... :|

I want to make the rebel system that they have on source, so what happens is when a terrorist damages a counter-terrorist once, a message pops up saying they're a rebel and they turn red, until a new round begins. I compiled a small script that I knew wouldn't work but someone might be able to finish correctly... I got it to work to a degree but it kept on repeating the "%name% is now a rebel!" line over and over after the first hit.

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
#include <colorchat>
#define PLUGIN "Rebel Detector"
#define VERSION "1.0"
#define AUTHOR "shadow.hk"
new g_shown_message[33];
public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR);
 
register_event("Damage""damage_event""b"
 
register_event("HLTV""event_new_round""a");
}
public 
event_new_round(id,attacker)
{
 if(
get_user_team(id) == 1)
 {
  
g_shown_message[id] = 0;
  
fm_set_user_rendering(id,kRenderFxNone,255,255,255,kRenderNormal,16);
 }
}
public 
damage_event(id)
{
 if(
get_user_team(id) == && g_shown_message[id] == 0)
 {
  
fm_set_rendering(idkRenderFxGlowShell25500kRenderNormal1);
 
  new 
name[32];
  
get_user_name(id,name,31);
  
ColorChat(0,NORMAL,"[ ^x04PrisonBreak^x01 ] ^x04%s^x01 Is Now a Rebel!",name);
 
  
g_shown_message[id] = 1;
 }
 return 
HAM_HANDLED;


Any help would be greatly appreciated :)

Is
PHP Code:

get_user_name(idname31);
-->
name get_user_name(id

correct?

fysiks 06-03-2009 14:41

Re: JailBreak Rebel System
 
Quote:

Originally Posted by TitANious (Post 840930)
Is
PHP Code:

get_user_name(idname31);
-->
name get_user_name(id

correct?

NO. Not even close.

TitANious 06-03-2009 15:01

Re: JailBreak Rebel System
 
Sorry then.. :(

shadow.hk 06-03-2009 15:29

Re: JailBreak Rebel System
 
Didn't work :(

You had the wrong team, but i changed that round, but it's still displaying the message everytime I get damaged or hit a counter-terrorist. I only need it to show once, and only when i hit a ct.

fysiks 06-03-2009 16:21

Re: JailBreak Rebel System
 
Quote:

Originally Posted by shadow.hk (Post 840969)
You had the wrong team

I didn't change anything having to to with teams.

shadow.hk 06-04-2009 00:33

Re: JailBreak Rebel System
 
Still doesn't work. Same issues as before, however, it doesn't say you're a rebel when damaging yourself anymore.

Problems...
Says you're a rebel on every startround (but resets your rendering to normal anyway)
Says you're a rebel EVERYtime you attack a ct

ConnorMcLeod 06-04-2009 00:40

Re: JailBreak Rebel System
 
Filter the damage event :

PHP Code:

register_event("Damage""Event_Damage""b""2>0""3=0")

public 
Event_DamageiVictim )
{
    if( 
read_data(4) || read_data(5) || read_data(6) )
    { 


fysiks 06-04-2009 01:41

Re: JailBreak Rebel System
 
Quote:

Originally Posted by shadow.hk (Post 841222)
Says you're a rebel on every startround (but resets your rendering to normal anyway)

I don't know what this means. Please elaborate.

Added Connor's suggestion:

PHP Code:

#include <amxmodx>
#include <fun>
// #include <colorchat>

#define PLUGIN "Rebel Detector"
#define VERSION "1.0"
#define AUTHOR "shadow.hk"

new g_is_rebel[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event("Damage""damage_event""b""2>0""3=0")
    
register_event("HLTV""event_new_round""a")
}

public 
client_connect(id)
{
    
g_is_rebel[id] = 0
}

public 
event_new_round()
{
    new 
iPlayers[32], iPlayersNum
    get_players
(iPlayersiPlayersNum)
    
    for( new 
0iPlayersNumi++ )
    {
        
g_is_rebel[iPlayers[i]] = 0
        set_user_rendering
(i)
    }
}

public 
damage_event(iVictim)
{
    new 
iAttacker get_user_attacker(iVictim)
    
    if( 
read_data(4) || read_data(5) || read_data(6) ) 
    {
        if( 
g_is_rebel[iAttacker] == && get_user_team(iAttacker) == && get_user_team(iVictim) == )
        {
            
set_user_rendering(iAttackerkRenderFxGlowShell25500kRenderNormal1)
            
            new 
name[32]
            
get_user_name(iAttacker,name,31)
            
// ColorChat(0,NORMAL,"[ ^x04PrisonBreak^x01 ] ^x04%s^x01 Is Now a Rebel!",name)
            
client_print(0print_chat"[ PrisonBreak ] %s Is Now a Rebel!"name)
            
            
g_is_rebel[iAttacker] = 1
        
}
    }
    return 
PLUGIN_HANDLED


If this doesn't fix it you will just have to debug it.


All times are GMT -4. The time now is 14:02.

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