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

Fix Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-16-2012 , 16:10   Fix Plugin
Reply With Quote #1

PHP Code:
/********************************************************************************
*  AMX Mod X script.
*
*   Ultimate Sounds (Ultimate_Sounds.sma)
*   Copyright (C) 2006-2008 Bmann_420 / Dizzy / Hoboman
*
*   This program is free software; you can redistribute it and/or
*   modify it under the terms of the GNU General Public License
*   as published by the Free Software Foundation; either version 2
*   of the License, or (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with this program; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
*   In addition, as a special exception, the author gives permission to
*   link the code of this program with the Half-Life Game Engine ("HL
*   Engine") and Modified Game Libraries ("MODs") developed by Valve,
*   L.L.C ("Valve"). You must obey the GNU General Public License in all
*   respects for all of the code used other than the HL Engine and MODs
*   from Valve. If you modify this file, you may extend this exception
*   to your version of the file, but you are not obligated to do so. If
*   you do not wish to do so, delete this exception statement from your
*   version.
*
*********************************************************************************
*
*   AMXX Ultimate Sounds Vers. 1.7
*   Last Update: 1/26/2007
*
*   by  Dizzy / Bmann_420 & Hoboman
*   Link: http://forums.alliedmods.net/showthread.php?t=7342
*
*
*********************************************************************************
*
* ///////////////////////////////////////////////////
* //  AMXMOD[X]                                    //
* //   ::Ultimate sounds::                         //
* //    Origional: by Hephaistos            //
* //    Ported by: Dizzy                //
* //    Edited by: Hoboman, bmann_420            //
* //                                               //
* // cvar:                                         //
* //  streak_mode < flags >                        //
* //  "a" - messages                               //
* //  "b" - sounds                                 //
* //                                               //
* //  knife_mode < flags >                         //
* //  "a" - messages                               //
* //  "b" - sounds                                 //
* //                                               //
* //  hs_mode < flags >                            //
* //  "a" - messages                               //
* //  "b" - sounds                                 //
* //                                               //
* //  lastman_mode < flags >                       //
* //  "a" - messages                               //
* //  "b" - hp                                     //
* //  "c" - sounds                                 //
* ///////////////////////////////////////////////////
*
*********************************************************************************
*/

// Plugin Info
new const PLUGIN[]  = "Ultimate Sounds"
new const VERSION[] = "1.8"
new const AUTHOR[]  = "Dizzy / Bmann_420 / Quick edit: Freestyle"

// Includes
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

//Defines
#define KNIFEMESSAGES 5
#define MESSAGESNOHP 5
#define MESSAGESHP 5
#define LEVELS 10

//Pcvars
new streak_modeknife_modehs_modelastman_mode

new boolg_sounds[33]
new 
boolsounds[33]

new 
gmsgHudSync

new kills[33] = {0,...};
new 
deaths[33] = {0,...};
new 
alone_ann 0
new levels[10] = {234567891011};

//Streak Sounds
new stksounds[10][] = 
{
    
"misc/multikill",
    
"misc/megakill",
    
"misc/ultrakill",
    
"misc/monsterkill",
    
"misc/killingspree",
    
"misc/wickedsick",
    
"misc/rampage",
    
"misc/ludacrisskill",
    
"misc/godlike",
    
"misc/holyshit"
}

new 
stkmessages[10][] = 
{
    
"%s: Multi-Kill!",
    
"%s: Mega-Kill!",
    
"%s: Ultra-Kill!",
    
"%s: Monster-Kill!",
    
"%s: Killing Spree!",
    
"%s: Wicked Sick!",
    
"%s: Rampage!",
    
"%s: Ludacriss-Kill",
    
"%s: Godlike!",
    
"%s: Holy Shit!"
}

new 
knifemessages[KNIFEMESSAGES][] = 
{
    
"KNIFE_MSG_1"
    
"KNIFE_MSG_2"
    
"KNIFE_MSG_3"
    
"KNIFE_MSG_4"
    
"KNIFE_MSG_5"
}

new 
messagesnohp[MESSAGESNOHP][] = 
{
    
"NOHP_MSG_1"
    
"NOHP_MSG_2"
    
"NOHP_MSG_3"
    
"NOHP_MSG_4"
    
"NOHP_MSG_5"
}

new 
messageshp[MESSAGESHP][] = 
{
    
"HP_MSG_1"
    
"HP_MSG_2"
    
"HP_MSG_3"
    
"HP_MSG_4"
    
"HP_MSG_5"
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("ultimate_sounds",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
register_dictionary("ultimate_sounds.txt")
    
register_event("DeathMsg","hs","a","3=1")
    
register_event("DeathMsg","knife_kill","a","4&kni")
    
register_event("ResetHUD""reset_hud""b");
    
register_event("DeathMsg""death_event""a""1>0");
    
register_event("DeathMsg","death_msg","a")
    
register_event("SendAudio","roundend_msg","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
    
register_event("TextMsg","roundend_msg","a","2&#Game_C","2&#Game_w")
    
    
lastman_mode register_cvar("lastman_mode","abc")
    
streak_mode register_cvar("streak_mode","ab")
    
knife_mode register_cvar("knife_mode","ab")
    
hs_mode register_cvar("hs_mode","ab")

    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawnPost"1)
    
    
gmsgHudSync CreateHudSyncObj()
}
        
public 
FwdPlayerSpawnPost(id
{
    if(
sounds[id])
    {
        
ConfirmationMenu(id)
        
sounds[id] = false    
    
}
}

public 
ConfirmationMenu(id)
{
    new 
menu menu_create("\r[ UltimateSounds ]\y^nYou wanna hear the sounds?""menu_handler")
 
    
menu_additem(menu"\wYes""1"0)
    
menu_additem(menu"\wNo""2"0)
 
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
 
    
menu_display(idmenu0)
}
 
public 
menu_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accescallback
    menu_item_getinfo
(menuitemaccesdata,5iName63callback)
     
    new 
key str_to_num(data)
     
    switch(
key)
    { 
        case 
g_sounds[id] = true
        
case g_sounds[id] = false
    
}
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


get_streak()
{
    new 
streak[3]
    
get_pcvar_string(streak_mode,streak,2)
    return 
read_flags(streak)
}

public 
death_event(id)
{
    new 
streak get_streak()

    if ((
streak&1) || (streak&2))
    {
        new 
killer read_data(1);
        new 
victim read_data(2);
        
        if (
killer <= get_maxplayers())
            return 
PLUGIN_CONTINUE;
        
        
kills[killer] += 1;
        
kills[victim] = 0;
        
deaths[killer] = 0;
        
deaths[victim] += 1;

        for (new 
0LEVELSi++)
        {
            if (
kills[killer] == levels[i])
            {
                
announce(killeri);
                return 
PLUGIN_CONTINUE;
            }
        }
    }
    return 
PLUGIN_CONTINUE;
}

announce(killerlevel)
{
    new 
streak get_streak()
    
    for(new 
i=1;i<=get_maxplayers();i++)

    if(
g_sounds[i])
    {    
        if (
streak&1)
        {
            new 
name[32];
            
            
get_user_name(killername32);
            
set_hudmessage(01002000.050.6520.026.00.010.12);
            
ShowSyncHudMsg(0gmsgHudSyncstkmessages[level], name);
        }
            
        if (
streak&2)
        {
            for(new 
i=1;i<=get_maxplayers();i++)
                if(
is_user_connected(i)==)
                
client_cmd(i"spk %s"stksounds[level]);
        }
    }
}

public 
reset_hud(id)
{
    new 
streak get_streak()

    if (
streak&1)
    {

        if (
kills[id] > levels[0])

        {
                
client_print(idprint_chat,"%L"id"KILL_STREAK"kills[id]);
        }

        else if (
deaths[id] > 1)

        {
            
client_print(idprint_chat,"%L"id"DEATH_STREAK"deaths[id]);
        }
    }
}

public 
client_connect(id)
{
    
sounds[id] = true    
    
    
new streak get_streak()

    if ((
streak&1) || (streak&2))
    {
        
kills[id] = 0;
        
deaths[id] = 0;
    }
}

public 
knife_kill()
{
    for(new 
i=1;i<=get_maxplayers();i++)
    
    if(
g_sounds[i])
    {
        new 
knifemode[4]
        
get_pcvar_string(knife_mode,knifemode,4)
        new 
knifemode_bit read_flags(knifemode)
        
        if (
knifemode_bit 1)
        {
            new 
killer_id read_data(1)
            new 
victim_id read_data(2)
            new 
killer_name[33], victim_name[33]
        
            
get_user_name(killer_id,killer_name,33)
            
get_user_name(victim_id,victim_name,33)
        
        
            
set_hudmessage(2001000, -1.00.3006.06.00.50.151)
            
ShowSyncHudMsg(0gmsgHudSync"%L"LANG_PLAYERknifemessagesrandom_num(0,KNIFEMESSAGES-1) ],killer_name,victim_name)
        }
        
        if (
knifemode_bit 2)
        {
                
client_cmd(i,"spk misc/humiliation")
        }
    }
}


public 
roundend_msg(id)

    
alone_ann 0

public death_msg(id)
{

    new 
lmmode[8]
    
get_pcvar_string(lastman_mode,lmmode,8)
    new 
lmmode_bit read_flags(lmmode)

    new 
players_ct[32], players_t[32], ictitelast
    get_players
(players_ct,ict,"ae","CT")  
    
get_players(players_t,ite,"ae","TERRORIST")  

    if(
g_sounds[id])
    {
        if (
ict==1&&ite==1)
        {
        new 
name1[32], name2[32]
        
get_user_name(players_ct[0],name1,32)
        
get_user_name(players_t[0],name2,32)
        
set_hudmessage(2001000, -1.00.3006.06.00.50.151)
    
        if (
lmmode_bit 1)
        {
            if (
lmmode_bit 2)
            {
            
ShowSyncHudMsg(0gmsgHudSync"%s (%i hp) vs. %s (%i hp)",name1,get_user_health(players_ct[0]),name2,get_user_health(players_t[0]))
            }
    
            else
            {
            
ShowSyncHudMsg(0gmsgHudSync"%s vs. %s",name1,name2)
            }
    
            if (
lmmode_bit 4)
            {
            for(new 
i=1;i<=get_maxplayers();i++)
                if( 
is_user_connected(i) == )
                
client_cmd(i,"spk misc/maytheforce")
            }
        }
        }
        else
        {   
        if (
ict==1&&ite>1&&alone_ann==0&&(lmmode_bit 4))
        {
        
last=players_ct[0]
        
client_cmd(last,"spk misc/oneandonly")
    
        }
    
        else if (
ite==1&&ict>1&&alone_ann==0&&(lmmode_bit 4))
        {
        
last=players_t[0]
        
client_cmd(last,"spk misc/oneandonly")
        }
    
        else
        {
        return 
PLUGIN_CONTINUE
        
}
        
alone_ann last
        
new name[32]  
        
get_user_name(last,name,32)
    
        if (
lmmode_bit 1)
        {
        
set_hudmessage(2001000, -1.00.3006.06.00.50.151)
    
        if (
lmmode_bit 2)
        {
            
ShowSyncHudMsg(0gmsgHudSync"%L"LANG_PLAYERmessageshprandom_num(0,MESSAGESHP-1) ],ite ,ict ,name,get_user_health(last))
        }
    
        else
        {
            
ShowSyncHudMsg(0gmsgHudSync"%L"LANG_PLAYERmessagesnohprandom_num(0,MESSAGESNOHP-1) ],ite ,ict ,name )
        }
        }
    
    } 
    }
    return 
PLUGIN_CONTINUE 
}


public 
hs()
{
    new 
hsmode[4]
    
get_pcvar_string(hs_mode,hsmode,4)
    new 
hsmode_bit read_flags(hsmode)

    for(new 
i=1;i<=get_maxplayers();i++)
    
    if(
g_sounds[i])
    {
        if (
hsmode_bit 1)
        {
        new 
killer_id read_data(1)
        new 
victim_id read_data(2)
        new 
victim_name[33]
    
        
get_user_name(victim_id,victim_name,33)
    
        
set_hudmessage(2001000, -1.00.3003.03.00.150.151)
        
ShowSyncHudMsg(killer_idgmsgHudSync"::HEADSHOT::^nYou Owned %s !!",victim_name)
        }
    
        if (
hsmode_bit 2)
        {
        for(new 
i=1;i<=get_maxplayers();i++)
        if( 
is_user_connected(i)==)
            
client_cmd(i,"spk misc/headshot")
        }
    }
}

public 
plugin_precache()
{
    
precache_sound("misc/monsterkill.wav")
    
precache_sound("misc/godlike.wav")
    
precache_sound("misc/headshot.wav")
    
precache_sound("misc/humiliation.wav")
    
precache_sound("misc/killingspree.wav")
    
precache_sound("misc/multikill.wav")
    
precache_sound("misc/ultrakill.wav")
    
precache_sound("misc/maytheforce.wav")
    
precache_sound("misc/oneandonly.wav")
    
precache_sound("misc/rampage.wav")
    
precache_sound("misc/holyshit.wav")
    
precache_sound("misc/megakill.wav")
    
precache_sound("misc/wickedsick.wav")
    
precache_sound("misc/ludacrisskill.wav")
        
    return 
PLUGIN_CONTINUE

This plugin was made to when a player enter in the server, a menu pop up, and he choose if he want hear the ultimate sounds or not. But dont work, I dont have the time to fix this, thanks to who wanna help
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 09-16-2012 , 16:53   Re: Fix Plugin
Reply With Quote #2

Quote:
Originally Posted by quilhos View Post
This plugin was made to when a player enter in the server, a menu pop up, and he choose if he want hear the ultimate sounds or not. But dont work, I dont have the time to fix this, thanks to who wanna help
Thats fucking hilarious. I find it funny how you can sell plugins and at the same time you ask help for something this simple.

Here is me saving your time:
Code:
public FwdPlayerSpawnPost( id )  {     if( is_user_alive( id ) )     {         if( sounds[ id ] )         {             ConfirmationMenu( id )             sounds[ id ] = false              }     } }
__________________

Accepting all kinds of requests via private message.
matsi is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 09-16-2012 , 16:56   Re: Fix Plugin
Reply With Quote #3

Quote:
Originally Posted by matsi View Post
Thats fucking hilarious. I find it funny how you can sell plugins and at the same time you ask help for something this simple.

Here is me saving your time:
Code:
public FwdPlayerSpawnPost( id )  {     if( is_user_alive( id ) )     {         if( sounds[ id ] )         {             ConfirmationMenu( id )             sounds[ id ] = false              }     } }
But, if I hook the player spawn(post) the player is already alive, isn't he? Is that check needed?
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 09-16-2012 at 18:27. Reason: removed code
pokemonmaster is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 09-16-2012 , 17:43   Re: Fix Plugin
Reply With Quote #4

Yes, because when a player connects player->spawn( ) is called.
__________________

Last edited by micapat; 09-16-2012 at 17:44.
micapat is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 09-16-2012 , 18:26   Re: Fix Plugin
Reply With Quote #5

Quote:
Originally Posted by micapat View Post
Yes, because when a player connects player->spawn( ) is called.
OK, thanks for the info...
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-16-2012 , 18:28   Re: Fix Plugin
Reply With Quote #6

matsi like I said, I'am tired and dont have time to review the plugin, small mistakes happen, I'm Human

Thanks to all
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-17-2012 , 14:08   Re: Fix Plugin
Reply With Quote #7

The bug persist, no menu displayed.
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 09-17-2012 , 14:31   Re: Fix Plugin
Reply With Quote #8

Quote:
Originally Posted by quilhos View Post
The bug persist, no menu displayed.
Just do what i said and it will be displayed ( remember its only on first spawn ).
__________________

Accepting all kinds of requests via private message.
matsi is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-17-2012 , 17:57   Re: Fix Plugin
Reply With Quote #9

I will test but explain to me how the check alive player will fix the menu not displayed?
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 09-17-2012 , 17:59   Re: Fix Plugin
Reply With Quote #10

Quote:
Originally Posted by micapat View Post
Yes, because when a player connects player->spawn( ) is called.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 00:05.


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