Raised This Month: $ Target: $400
 0% 

[HELP] Rebel script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 01-21-2009 , 10:07   [HELP] Rebel script
Reply With Quote #1

My skills are not too advanced yet, so I thought maybe you guys could help me on this part of my script.


I need a code that will detect if a terrorist shoots a CT. If they shoot a ct, I want it to say in chat "<nameofterrorist> is a rebel!"

And once the CT kills the "rebel" I want the plugin to say "<nameofct> killed a rebel!"


And also, if a CT randomly kills more than two terrorists, I want the CT to get slayed.


Do you think this is possible?


If it isn't a hassle, I would like one of you to show me a piece of code that can get this done, every part of my plugin except this is done.
VMAN is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-21-2009 , 10:46   Re: [HELP] Rebel script
Reply With Quote #2

Use this.
Kills counter and rebels will be reset.
(Untested):
PHP Code:
#include <amxmodx>

new g_iTKills[33], g_iMaxPlayers;
new 
bool:g_bRebel[33];

public 
plugin_init()
{
    
register_event("DeathMsg""ev_Death""a");
    
register_event("Damage""ev_Damage""b");
    
register_event("HLTV""ev_newRound""a""1=0""2=0");
    
g_iMaxPlayers get_maxplayers();
}

public 
ev_Death()
{
    static 
iVic iVic read_data(2);
    static 
iAtt iAtt read_data(1);
    
    if(!(
<= iAtt <= g_iMaxPlayers)
    || !(
<= iVic <= g_iMaxPlayers))
    {
        return 
PLUGIN_CONTINUE;
    }
    
    static 
aName[32], vName[32];
    
    if(
get_user_team(iAtt) == 2)
    {
        
get_user_name(iAttaNamecharsmax(aName));
        
        if(
get_user_team(iVic) == && ++g_iTKills[iAtt] > 2)
        {
            
user_silentkill(iAtt);
            
client_print(0print_chat"[Rebel] CT Player ^"%s^" was slayed after killing more than 2 terrorists"aName);
            
g_iTKills[iAtt] = 0;
        }
        
    }
    
    if(
g_bRebel[iVic])
    {
        if(
aName[0])
        {
            
get_user_name(iVicvNamecharsmax(vName));
            
client_print(0print_chat"[Rebel] CT Player ^"%s^" killed rebel ^"%s^""aNamevName);
        }
        
g_bRebel[iVic] = false;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
ev_Damage(iVic)
{
    static 
iAtt iAtt get_user_attacker(iVic);
    
    if(!(
<= iAtt <= g_iMaxPlayers))
    {
        return 
PLUGIN_CONTINUE;
    }
    
    static 
TName[32];
    
    if(
get_user_team(iVic) == && get_user_team(iAtt) == 1)
    {
        if(!
g_bRebel[iAtt])
        {
            
get_user_name(iAttTNamecharsmax(TName));
            
client_print(0print_chat"[Rebel] T Player ^"%s^" is a rebel!");
            
g_bRebel[iAtt] = true;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
ev_newRound()
{
    for(new 
<= g_iMaxPlayers i++)
    {
        
g_bRebel[i] = false;
        
g_iTKills[i] = 0;
    }
}

public 
client_disconnect(id)
{
    
g_bRebel[id] = false;
    
g_iTKills[id] = 0;

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 01-22-2009 at 00:04.
Dores is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 01-21-2009 , 19:08   Re: [HELP] Rebel script
Reply With Quote #3

Thank you so much Dores.


I can't wait to try this when I get home!
VMAN is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 01-21-2009 , 22:20   Re: [HELP] Rebel script
Reply With Quote #4

I compiled and tested with bots.

The slaying part worked, however there were no messages.


Found this in my console:

Quote:
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
L 01/21/2009 - 19:17:44: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 19:17:44: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 19:17:44: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 19:17:44: [AMXX] [0] rebel.sma::ev_Death (line 34)
VMAN is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-22-2009 , 00:04   Re: [HELP] Rebel script
Reply With Quote #5

Fixed code.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 01-22-2009 , 00:20   Re: [HELP] Rebel script
Reply With Quote #6

Now the message is showing when I get slayed for killing more than 2 T's!

But no message appears when T's attack me.


From console:
Quote:
L 01/21/2009 - 21:172: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 21:172: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 21:172: [AMXX] [0] rebel.sma::ev_Damage (line 95)
L 01/21/2009 - 21:172: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 21:172: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 21:172: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 21:172: [AMXX] [0] rebel.sma::ev_Damage (line 95)
L 01/21/2009 - 21:172: String formatted incorrectly - parameter 4 (total 3)
VMAN is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-22-2009 , 05:08   Re: [HELP] Rebel script
Reply With Quote #7

change
PHP Code:
            get_user_name(iAttTNamecharsmax(TName));
            
client_print(0print_chat"[Rebel] T Player ^"%s^" is a rebel!");

// to ->

            
get_user_name(iAttTNamecharsmax(TName));
            
client_print(0print_chat"[Rebel] T Player ^"%s^" is a rebel!"TName); 
__________________
xPaw is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-22-2009 , 07:59   Re: [HELP] Rebel script
Reply With Quote #8

Technical issues I forgot to check. ^^
Do what xPaw said.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 10-23-2009 , 22:47   Re: [HELP] Rebel script
Reply With Quote #9

I and give u a better one with colours.
shuttle_wave 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 01:43.


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