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

Restart frags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
StoleA
Junior Member
Join Date: Nov 2011
Location: Romania
Old 01-06-2014 , 10:32   Restart frags
Reply With Quote #1

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{
    ....

__________________
StoleA is offline
Send a message via Yahoo to StoleA Send a message via Skype™ to StoleA
Strick3n
Member
Join Date: Apr 2013
Old 01-06-2014 , 16:18   Re: Restart frags
Reply With Quote #2

try to change this:
PHP Code:
server_cmd ("sv_restart 1"); 
to this:
PHP Code:
set_cvar_num"sv_restart"); 
Strick3n is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 01-06-2014 , 19:06   Re: Restart frags
Reply With Quote #3

Quote:
Originally Posted by Strick3n View Post
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.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
StoleA
Junior Member
Join Date: Nov 2011
Location: Romania
Old 01-07-2014 , 04:05   Re: Restart frags
Reply With Quote #4

And the solution is ?
__________________
StoleA is offline
Send a message via Yahoo to StoleA Send a message via Skype™ to StoleA
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-07-2014 , 04:31   Re: Restart frags
Reply With Quote #5

Quote:
Originally Posted by StoleA View Post
And the solution is ?
The solution is already given...

Quote:
Originally Posted by hornet View Post
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.
__________________

Last edited by 11922911; 01-07-2014 at 04:33.
11922911 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 01-07-2014 , 05:14   Re: Restart frags
Reply With Quote #6

Quote:
Originally Posted by StoleA View Post
And the solution is ?
Quote:
Originally Posted by hornet View Post
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.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
StoleA
Junior Member
Join Date: Nov 2011
Location: Romania
Old 01-07-2014 , 08:19   Re: Restart frags
Reply With Quote #7

It's worked. Thank you very much
__________________
StoleA is offline
Send a message via Yahoo to StoleA Send a message via Skype™ to StoleA
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 09:12.


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