Raised This Month: $ Target: $400
 0% 

last players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pob18
Member
Join Date: Jun 2014
Old 06-30-2014 , 15:55   last players
Reply With Quote #1

Hi, I need a function that will do some fun when at the round stays 2 players,
play some sounds/etc when one wins
pob18 is offline
Porta0123
Member
Join Date: Apr 2014
Location: Spain
Old 06-30-2014 , 16:30   Re: last players
Reply With Quote #2

i think this will works but im not sure....
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Play sound" #define VERSION "1.0" #define AUTHOR "Porta0123" new bool:are_2players = false public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event( "DeathMsg" , "DeathMsgEvent" , "a" ); } public DeathMsgEvent() {     new pnum     new players[32], tempid;     new count = 0         get_players(players, pnum);         for(new i=0; i < pnum; i++)     {         tempid = players[i];                 if(is_user_alive(tempid))         {         count++         }     }         if(are_2players == true)     {         are_2players = false         //here the sounds etc...     }       if(count == 2)     dosound() } public dosound() {     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)     show_hudmessage(0, "1 vs 1")     are_2players = true         //here you can add one sound like "you are alone" or something... }

Last edited by Porta0123; 06-30-2014 at 16:37.
Porta0123 is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 06-30-2014 , 16:55   Re: last players
Reply With Quote #3

Code:
#include <amxmodx> public plugin_init() {     register_plugin("Last 2 players", "1.0", "Freezo")         register_event( "DeathMsg" , "DeathMsgEvent" , "a" ); } public DeathMsgEvent() {     new players[ 32 ], iNum       get_players( players, iNum, "ach" )           if( iNum == 2 )     {         for ( new i=0,id ; i < iNum ; i++ )         {             id = players[ i ]             // Do your stuf         }     } }

Last edited by Freezo Begin; 06-30-2014 at 16:55.
Freezo Begin is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-30-2014 , 17:07   Re: last players
Reply With Quote #4

Freezo, if the two players are from the same team?
(Also, it's not good to post ready codes in scripting help. Let them do it theirself ;))
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 06-30-2014 , 17:17   Re: last players
Reply With Quote #5

Hey Flick3rR
What about mine? xD

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Play sound"
#define VERSION "2.0"
#define AUTHOR "Porta0123"

new const my_sound[] = "jbextreme/nm_goodbadugly.wav"
new bool:duel

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event"DeathMsg" "DeathMsgEvent" "a" );
}

public 
plugin_precache()
{
    
precache_sound(my_sound)
}

public 
DeathMsgEvent()
{
    new 
pnumplayers[32]
    
get_players(playerspnum"a"//get all alive players

    
if(duel && pnum == 1)    //duel ended
    
{
        
duel false
        duelends
(players[0]) //show who won :)
    
}
    else
    {
        if(
pnum == 2//only 2 alives?
        
{
            if(
get_user_team(players[0]) != get_user_team(players[1])) //diferent team?
            
{
                
duel true    // duel started!
                
duelstart(players[0], players[1]) //show who vs who
            
}
        }
        else
        {
            
duel false
        
}
    }
}

stock duelstart(id1id2)
{
    if(
id1 && id2)
    {
        new 
name1[32], name2[32]
        
get_user_name(id1name131)
        
get_user_name(id2name231)
        
        
set_hudmessage(25500, -1.0, -1.006.012.0)
        
show_hudmessage(0"%s vs %s"name1name2)
        
emit_sound(0CHAN_AUTOmy_sound1.0ATTN_NORM0PITCH_NORM)
    }
}

stock duelends(id)
{
    if(
id)
    {
        new 
name1[32]
        
get_user_name(idname131)
        
        
set_hudmessage(25500, -1.0, -1.006.012.0)
        
show_hudmessage(0"%s wons"name1)
        
//emit_sound(0, CHAN_AUTO, my_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
    
}

I can't upload the sound but can be downloaded from jbextreme resources
NikKOo31 is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 06-30-2014 , 17:17   Re: last players
Reply With Quote #6

Quote:
Originally Posted by Flick3rR View Post
Freezo, if the two players are from the same team?
yes i know what i have done ! because he didn't give enough information !
Freezo Begin is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-30-2014 , 17:26   Re: last players
Reply With Quote #7

Yup, I think nikko's one is good enough (it will be strange if I say "Ahh sh*t it's AWESOME", right?). There could be added more funny stuff (I'm thinking about some Mortal Kombat sounds ). Also, Nikko, there are some stuff you can do in your code (redundant or could be improved.) Mainly that emit_sound, will be better with spk.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
pob18
Member
Join Date: Jun 2014
Old 06-30-2014 , 21:04   Re: last players
Reply With Quote #8

sorry for no info, when 2 players stay alive (ct and tt), show message/stuff who won
pob18 is offline
Porta0123
Member
Join Date: Apr 2014
Location: Spain
Old 07-01-2014 , 09:33   Re: last players
Reply With Quote #9

if the 2 players are in the same team and there are 2 players thats means that the round its ended , Freezo Begin and mine are correct, i think

or add this:

Code:
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")

and then:
Code:
public event_new_round() { are_2players = false }

Last edited by Porta0123; 07-01-2014 at 09:40.
Porta0123 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 21:11.


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