AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Rebel script (https://forums.alliedmods.net/showthread.php?t=84137)

VMAN 01-21-2009 10:07

[HELP] Rebel script
 
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.

Dores 01-21-2009 10:46

Re: [HELP] Rebel script
 
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;



VMAN 01-21-2009 19:08

Re: [HELP] Rebel script
 
Thank you so much Dores.


I can't wait to try this when I get home!

VMAN 01-21-2009 22:20

Re: [HELP] Rebel script
 
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)

Dores 01-22-2009 00:04

Re: [HELP] Rebel script
 
Fixed code.

VMAN 01-22-2009 00:20

Re: [HELP] Rebel script
 
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:17:32: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 21:17:32: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 21:17:32: [AMXX] [0] rebel.sma::ev_Damage (line 95)
L 01/21/2009 - 21:17:32: String formatted incorrectly - parameter 4 (total 3)
L 01/21/2009 - 21:17:32: [AMXX] Displaying debug trace (plugin "rebel.amxx")
L 01/21/2009 - 21:17:32: [AMXX] Run time error 25: parameter error
L 01/21/2009 - 21:17:32: [AMXX] [0] rebel.sma::ev_Damage (line 95)
L 01/21/2009 - 21:17:32: String formatted incorrectly - parameter 4 (total 3)

xPaw 01-22-2009 05:08

Re: [HELP] Rebel script
 
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); 


Dores 01-22-2009 07:59

Re: [HELP] Rebel script
 
Technical issues I forgot to check. ^^
Do what xPaw said.

shuttle_wave 10-23-2009 22:47

Re: [HELP] Rebel script
 
I and give u a better one with colours.


All times are GMT -4. The time now is 01:43.

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