AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] Auto resetscore plugin (https://forums.alliedmods.net/showthread.php?t=304410)

playsis 01-14-2018 11:19

[REQ] Auto resetscore plugin
 
Hi! I need auto resetscore plugin.

Description: On every round start plugin resets player's score, who have 0/1 kd

D3XT3R 01-14-2018 11:41

Re: [REQ] Auto resetscore plugin
 
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 }

DjSoftero 01-14-2018 13:27

Re: [REQ] Auto resetscore plugin
 
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



OciXCrom 01-14-2018 13:43

Re: [REQ] Auto resetscore plugin
 
What's the point of reseting the score if the player has 0 score?!

DjSoftero 01-14-2018 14:12

Re: [REQ] Auto resetscore plugin
 
lol

Relaxing 01-14-2018 15:11

Re: [REQ] Auto resetscore plugin
 
Quote:

Originally Posted by D3XT3R (Post 2571929)
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

OciXCrom 01-14-2018 15:15

Re: [REQ] Auto resetscore plugin
 
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.

edon1337 01-14-2018 16:12

Re: [REQ] Auto resetscore plugin
 
Quote:

Originally Posted by DjSoftero (Post 2571948)
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 (Post 2571968)
In some far-away future (maybe when AMXX 4.5.8 is released), this may prevent the round from starting.

It never will, though.

DjSoftero 01-14-2018 16:36

Re: [REQ] Auto resetscore plugin
 
Quote:

Originally Posted by edon1337 (Post 2571983)
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.

D3XT3R 01-16-2018 09:21

Re: [REQ] Auto resetscore plugin
 
Quote:

Originally Posted by OciXCrom (Post 2571952)
What's the point of reseting the score if the player has 0 score?!

good point :3 never thinked but lets me tell u what point from it :D its when score of some one is 0 and deaths is 5 so will make deaths 0 :3 as i know


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

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