AlliedModders

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

StoleA 01-06-2014 10:32

Restart frags
 
Hi everyone,

I have a problem with this plugin after update to amxmodx 1.8.2. On my old engine(5787) works perfect, but on new engine(6027) doesn't work anymore.. Small description: When a player reach 300 frags, server execute command sv_restart 1. Thank you

PHP Code:

#include < amxmodx >
#include <amxmisc>

new g_Frags;

public 
plugin_init( )
{
    
register_plugin"Restart Frags""1.0""Author" );
    
register_event"DeathMsg""death_a""a" );
    
g_Frags register_cvar"player_maxfrags""300" );
}

public 
death_a( )
{
    new 
players[32], num;
    
get_players(playersnum);
    new 
Frags;
    
    for (new 
i=0i<numi++)
    {
        
Frags get_user_frags(players[i])
        
        if(
Frags >= get_pcvar_num(g_Frags))
        {
            
chat_color(0"Round will reseted in 5 seconds !")
            
server_cmd ("sv_restart 1");
        }    
    }
    return 
PLUGIN_HANDLED;
}

stock chat_color{
    ....



Strick3n 01-06-2014 16:18

Re: Restart frags
 
try to change this:
PHP Code:

server_cmd ("sv_restart 1"); 

to this:
PHP Code:

set_cvar_num"sv_restart"); 


hornet 01-06-2014 19:06

Re: Restart frags
 
Quote:

Originally Posted by Strick3n (Post 2082167)
try to change this:
PHP Code:

server_cmd ("sv_restart 1"); 

to this:
PHP Code:

set_cvar_num"sv_restart"); 


They are the same thing.


Don't check every player's frags on each kill - Check only the killer's frags.
Also, frags haven't been updated at this stage therefore check your cvar num - 1.

StoleA 01-07-2014 04:05

Re: Restart frags
 
And the solution is ?

11922911 01-07-2014 04:31

Re: Restart frags
 
Quote:

Originally Posted by StoleA (Post 2082368)
And the solution is ?

The solution is already given...

Quote:

Originally Posted by hornet (Post 2082222)
Don't check every player's frags on each kill - Check only the killer's frags.
Also, frags haven't been updated at this stage therefore check your cvar num - 1.


hornet 01-07-2014 05:14

Re: Restart frags
 
Quote:

Originally Posted by StoleA (Post 2082368)
And the solution is ?

Quote:

Originally Posted by hornet (Post 2082222)
Don't check every player's frags on each kill - Check only the killer's frags.
Also, frags haven't been updated at this stage therefore check your cvar num - 1.

There is your solution. Give that a try, and if you have trouble post your new code here and we'll fix it from there.

StoleA 01-07-2014 08:19

Re: Restart frags
 
It's worked. Thank you very much


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

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