AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ResetScore (https://forums.alliedmods.net/showthread.php?t=328746)

El Abuelo Loco 11-23-2020 18:29

ResetScore
 
Can someone tell me how I can add that he can reset his score in the next round? because if they reset it many times they saturate the being...

PHP Code:

#include <amxmodx>
#include <fun>
#include <cstrike>

new const PLUGIN_NAME[]  = "Reset_Score";
new const 
VERSION[] = "1.0";
new const 
AUTHOR[]  = "Silenttt Fixed by 9 rpamm!?";

new 
name[33];
new 
rs_hudmessage;
new 
rs_sound;
 
public 
plugin_init()
{
    
register_pluginPLUGIN_NAMEVERSIONAUTHOR );

    
register_clcmd("say /rs""reset_score");
    
register_clcmd("say /resetscore""reset_score");
    
    
rs_hudmessage register_cvar("rs_hudmessage""1");
    
rs_sound register_cvar("rs_sound""1");
}

public 
reset_score(id)
{
    
set_user_frags(id0);
    
cs_set_user_deaths(id0);

    if(
get_pcvar_num(rs_hudmessage))
    {
        
get_user_name(idname32);
        
set_dhudmessage(150150150, -1.00.7126.03.00.11.5 );
        
show_dhudmessage(id"%s, Resteo su Score.!"name);
        if(
get_pcvar_num(rs_sound))
        {
           
client_cmd(id"spk fvox/bell");
        }
 }




OciXCrom 11-23-2020 18:35

Re: ResetScore
 
Quote:

they saturate the being
???

El Abuelo Loco 11-23-2020 20:01

Re: ResetScore
 
Quote:

Originally Posted by OciXCrom (Post 2726040)
???

I mean, they use the / rs many times in a single round. and my idea would be to decrease use it 1 time per round

OciXCrom 11-23-2020 20:13

Re: ResetScore
 
Add a global bool new bool:g_bHasReset[33] and set it to true once the player resets, next round set it to false.
If the bool is true, block the command.

El Abuelo Loco 11-23-2020 20:24

Re: ResetScore
 
Quote:

Originally Posted by OciXCrom (Post 2726046)
Add a global bool new bool:g_bHasReset[33] and set it to true once the player resets, next round set it to false.
If the bool is true, block the command.

so I did not put the poor thing and it did not work. heh

PHP Code:

new name[33];
new 
boolg_bHasReset [33];
new 
rs_hudmessage;
new 
rs_sound


fysiks 11-23-2020 23:28

Re: ResetScore
 
You should post the plugin again with the code where you use the g_bHasReset variable as described by OciXCrom. If you have more questions, you need to ask them (but make sure to post the code that you tried with your question).

El Abuelo Loco 11-24-2020 00:17

Re: ResetScore
 
Quote:

Originally Posted by fysiks (Post 2726064)
You should post the plugin again with the code where you use the g_bHasReset variable as described by OciXCrom. If you have more questions, you need to ask them (but make sure to post the code that you tried with your question).

I added what they told me, I tried it but it doesn't work. you can keep pulling / rs as many times as you want

PHP Code:

#include <amxmodx>
#include <fun>
#include <cstrike>

new const PLUGIN_NAME[]  = "Reset_Score";
new const 
VERSION[] = "1.0";
new const 
AUTHOR[]  = "Silenttt Fixed by 9 rpamm!?";

new 
name[33];
new 
boolg_bHasReset [33];
new 
rs_hudmessage;
new 
rs_sound;
 
public 
plugin_init()
{
    
register_pluginPLUGIN_NAMEVERSIONAUTHOR );

    
register_clcmd("say /rs""reset_score");
    
register_clcmd("say /resetscore""reset_score");
    
    
rs_hudmessage register_cvar("rs_hudmessage""1");
    
rs_sound register_cvar("rs_sound""1");
}

public 
reset_score(id)
{
    
set_user_frags(id0);
    
cs_set_user_deaths(id0);

    if(
get_pcvar_num(rs_hudmessage))
    {
        
get_user_name(idname32);
        
set_dhudmessage(150150150, -1.00.7126.03.00.11.5 );
        
show_dhudmessage(id"%s, Resteo su Score.!"name);
        if(
get_pcvar_num(rs_sound))
        {
           
client_cmd(id"spk fvox/bell");
        }
 }




fysiks 11-24-2020 01:24

Re: ResetScore
 
OciXCrom gave you 4 steps to complete to make it work like you requested. You only did the first step. Here is the list of steps laid out in a more explicit format so that it's easier to understand what you need to do.
  1. Add a global bool: new bool:g_bHasReset[33]
  2. set it to true once the player resets: g_bHasReset[id] = true
  3. next round set it to false: arrayset(g_bHasReset, false, sizeof g_bHasReset)
  4. If the bool is true, block the command.

You need to add code for each of these steps.


All times are GMT -4. The time now is 23:24.

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