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

[REQ] Auto resetscore plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
playsis
Member
Join Date: Nov 2015
Old 01-14-2018 , 11:19   [REQ] Auto resetscore plugin
Reply With Quote #1

Hi! I need auto resetscore plugin.

Description: On every round start plugin resets player's score, who have 0/1 kd
playsis is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 01-14-2018 , 11:41   Re: [REQ] Auto resetscore plugin
Reply With Quote #2

Try this
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "DeXTeR" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_event("HLTV", "reset_score", "a", "1=0", "2=0") } public reset_score(id) {     new frags = cs_get_user_frags(id);     new deaths = cs_get_user_deaths(id);         if(frags == 0 || frags == 1 || deaths == 0 || deaths == 1)     {         cs_set_user_deaths(id, 0)         cs_set_user_frags(id, 0)     }     return PLUGIN_HANDLED }
__________________

Last edited by D3XT3R; 01-14-2018 at 11:42.
D3XT3R is offline
Send a message via Skype™ to D3XT3R
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-14-2018 , 13:27   Re: [REQ] Auto resetscore plugin
Reply With Quote #3

optimized version:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DeXTeR"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""reset_score""a""1=0""2=0")
}

public 
reset_score(id) {
    if(
cs_get_user_frags(id) < || cs_get_user_deaths(id) < 2) {
        
cs_set_user_deaths(id0)
        
cs_set_user_frags(id0)
    }
    return 
PLUGIN_HANDLED

__________________
retired chump
DjSoftero is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-14-2018 , 13:43   Re: [REQ] Auto resetscore plugin
Reply With Quote #4

What's the point of reseting the score if the player has 0 score?!
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-14-2018 , 14:12   Re: [REQ] Auto resetscore plugin
Reply With Quote #5

lol
__________________
retired chump
DjSoftero is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-14-2018 , 15:11   Re: [REQ] Auto resetscore plugin
Reply With Quote #6

Quote:
Originally Posted by D3XT3R View Post
Try this
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <cstrike> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "DeXTeR" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_event("HLTV", "reset_score", "a", "1=0", "2=0") } public reset_score(id) {     new frags = cs_get_user_frags(id);     new deaths = cs_get_user_deaths(id);         if(frags == 0 || frags == 1 || deaths == 0 || deaths == 1)     {         cs_set_user_deaths(id, 0)         cs_set_user_frags(id, 0)     }     return PLUGIN_HANDLED }
dextar's first working plugin. GLORIOUS CODE
__________________
Relaxing is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-14-2018 , 15:15   Re: [REQ] Auto resetscore plugin
Reply With Quote #7

The return PLUGIN_HANDLED where it's not needed hurts my eyes though. In some far-away future (maybe when AMXX 4.5.8 is released), this may prevent the round from starting.
__________________

Last edited by OciXCrom; 01-14-2018 at 15:16.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-14-2018 , 16:12   Re: [REQ] Auto resetscore plugin
Reply With Quote #8

Quote:
Originally Posted by DjSoftero View Post
optimized version:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DeXTeR"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""reset_score""a""1=0""2=0")
}

public 
reset_score(id) {
    if(
cs_get_user_frags(id) < || cs_get_user_deaths(id) < 2) {
        
cs_set_user_deaths(id0)
        
cs_set_user_frags(id0)
    }
    return 
PLUGIN_HANDLED

IIRC, cs_set_user[deaths/frags] doesn't work correctly, use Ham_AddPoints instead.

Quote:
Originally Posted by OciXCrom View Post
In some far-away future (maybe when AMXX 4.5.8 is released), this may prevent the round from starting.
It never will, though.
__________________
edon1337 is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-14-2018 , 16:36   Re: [REQ] Auto resetscore plugin
Reply With Quote #9

Quote:
Originally Posted by edon1337 View Post
IIRC, cs_set_user[deaths/frags] doesn't work correctly, use Ham_AddPoints instead.
I never had problems with cs_set_user[deaths/frags]. Isn't Ham_AddPoints just for frags? If so, then it wouldn't matter if I change only 1 of non working natives. If they both don't work properly, they might as well do it in a synchronised way.
__________________
retired chump
DjSoftero is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 01-16-2018 , 09:21   Re: [REQ] Auto resetscore plugin
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
What's the point of reseting the score if the player has 0 score?!
good point never thinked but lets me tell u what point from it its when score of some one is 0 and deaths is 5 so will make deaths 0 as i know
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
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 18:26.


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