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

Solved reset score, add hud function


Post New Thread Reply   
 
Thread Tools Display Modes
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 01-07-2021 , 14:30   Re: reset score, add hud function
Reply With Quote #11

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
serverset_dhudmessage(02550, -1.00.3, .effects 0, .fxtime 2.0, .holdtime 1.0, .fadeintime 0.1, .fadeouttime 0.2
-->

PHP Code:
set_dhudmessage(02550, -1.00.3, .effects 0, .fxtime 2.0, .holdtime 1.0, .fadeintime 0.1, .fadeouttime 0.2
jesus, how didn`t i see that xD icompiles fine now, i will test it and post the result, thanks
tarsisd2 is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-07-2021 , 14:30   Re: reset score, add hud function
Reply With Quote #12

Code:
#include <dhudmessage>
amirwolf is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 01-07-2021 , 18:02   Re: reset score, add hud function
Reply With Quote #13

Quote:
Originally Posted by amirwolf View Post
Code:
#include <dhudmessage>
dhudmessage was implemented in amxmodx 1.8.3. You don`t need to include dhudmessage
tarsisd2 is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 01-12-2021 , 03:43   Re: reset score, add hud function
Reply With Quote #14

Quote:
Originally Posted by iceeedr View Post
Updated post, this time I was able to test, there were some errors so I optimized the previous code in general, you just need to change the place of the hud (xy) to your preference.
everything working great, thanks
tarsisd2 is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 02-04-2021 , 16:57   Re: reset score, add hud function
Reply With Quote #15

Quote:
Originally Posted by iceeedr View Post
Not tested

PHP Code:
#include <amxmodx>
#include <reapi>

#define PLUGIN          "resetscore(ReAPI)"
#define VERSION         "1.0"
#define AUTHOR          "modders"

#define TASK_SPEC 100

new iFragRestarts[33]

public 
plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR);
        
register_clcmd("say .rr""resetscore");
        
register_clcmd("say_team .rr""resetscore");
        
register_clcmd("say /rs""resetscore");
        
register_clcmd("say /resetscore""resetscore")

        
RegisterHookChain(RG_HandleMenu_ChooseTeam"HC_HandleMenu_ChooseTeam_Pre"false)
}

public 
resetscore(id)
{
        if(!
is_user_connected(id)) return;

        
set_entvar(idvar_frags0.0);
        
set_member(idm_iDeaths0);

        
client_print_color(idprint_team_blue"^3Score Resetado!");
        
client_cmd(id"spk fvox/buzz.wav");

        
message_begin(MSG_ALL85);
        
write_byte(id);
        
write_short(0); write_short(0); write_short(0); write_short(0);
        
message_end();

        
iFragRestarts[id]++
}

public 
HC_HandleMenu_ChooseTeam_Pre(idMenuChooseTeam:iSlot)
{
        switch(
iSlot)
        {
                case 
MenuChoose_Spec:
                {
                        
set_task(1.0"Observer"id TASK_SPEC, .flags "b")
                        return 
HC_CONTINUE
                
}
                case 
MenuChoose_CTMenuChoose_TMenuChoose_AutoSelect:
                {
                        
remove_task(id TASK_SPEC)
                        return 
HC_CONTINUE
                
}
        }

        return 
HC_CONTINUE
}

public 
client_disconnected(idbool:dropmessage[], maxlen)
{
        
remove_task(id TASK_SPEC)
        
iFragRestarts[id] = 0
}

public 
Observer(taskid)
{
        new 
id taskid TASK_SPEC

        
if(get_member(idm_iTeam) != TEAM_SPECTATOR)
        {
                
remove_task(id TASK_SPEC)
                return 
1
        
}

        static 
id2
        id2 
get_entvar(idvar_iuser2)

        if(
id2)
        {
                
serverset_dhudmessage(02550, -1.00.3, .effects 0, .fxtime 2.0, .holdtime 1.0, .fadeintime 0.1, .fadeouttime 0.2)
                
show_dhudmessage(id"Times restarted [%i]"iFragRestarts[id2])
                return 
0
        
}
        return 
1

i`m having a bug, if i choose spectate from the choose team menu, i can see fine the "Times restarted" but if i am dead and spectating, nothing shows, what could be wrong?
tarsisd2 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-04-2021 , 17:08   Re: reset score, add hud function
Reply With Quote #16

It is not a bug, it was only programmed to work when you are spec, test it and see if it works.

PHP Code:
#include <amxmodx>
#include <reapi>

#define PLUGIN          "resetscore(ReAPI)"
#define VERSION         "1.0"
#define AUTHOR          "modders"

#define TASK_SPEC 100

new iFragRestarts[33]

public 
plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR);
        
register_clcmd("say .rr""resetscore");
        
register_clcmd("say_team .rr""resetscore");
        
register_clcmd("say /rs""resetscore");
        
register_clcmd("say /resetscore""resetscore")
        
RegisterHookChain(RG_CBasePlayer_Killed"PlayerKilled", .post true)

        
RegisterHookChain(RG_HandleMenu_ChooseTeam"HC_HandleMenu_ChooseTeam_Pre"false)
}

public 
resetscore(id)
{
        if(!
is_user_connected(id)) return;

        
set_entvar(idvar_frags0.0);
        
set_member(idm_iDeaths0);

        
client_print_color(idprint_team_blue"^3Score Resetado!");
        
client_cmd(id"spk fvox/buzz.wav");

        
message_begin(MSG_ALL85);
        
write_byte(id);
        
write_short(0); write_short(0); write_short(0); write_short(0);
        
message_end();

        
iFragRestarts[id]++
}

public 
HC_HandleMenu_ChooseTeam_Pre(idMenuChooseTeam:iSlot)
{
        switch(
iSlot)
        {
                case 
MenuChoose_SpecMenuChoose_CTMenuChoose_TMenuChoose_AutoSelect:
                {
                        
set_task(1.0"Observer"id TASK_SPEC, .flags "b")
                        return 
HC_CONTINUE
                
}
        }

        return 
HC_CONTINUE
}

public 
PlayerKilled(const iVictim, const iKiller, const iGib)
{
        
set_task(1.0"Observer"iVictim TASK_SPEC, .flags "b")
}

public 
client_disconnected(idbool:dropmessage[], maxlen)
{
        
remove_task(id TASK_SPEC)
        
iFragRestarts[id] = 0
}

public 
Observer(taskid)
{
        new 
id taskid TASK_SPEC

        
if(is_user_alive(id) || !is_user_connected(id))
        {
                
remove_task(id TASK_SPEC)
                return 
1
        
}

        static 
id2
        id2 
get_entvar(idvar_iuser2)

        if(
id2)
        {
                
set_dhudmessage(02550, -1.00.3, .effects 0, .fxtime 2.0, .holdtime 1.0, .fadeintime 0.1, .fadeouttime 0.2)
                
show_dhudmessage(id"Times restarted [%i]"iFragRestarts[id2])
                return 
0
        
}
        return 
1

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Reply


Thread Tools
Display Modes

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 05:45.


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