Raised This Month: $ Target: $400
 0% 

Request: Resetscore


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ArminC
Senior Member
Join Date: Apr 2016
Old 01-30-2018 , 10:03   Request: Resetscore
Reply With Quote #1

So after the unsolved topic, I'l make a request for a plugin from 0

Can you make:
A resetscore (trough reapi, if you can) with:
  • Minimal Frags&Death (set by cvar) in order to allow the reset (if you are denied, there should be a chat message + spk)
  • A timer (set by cvar) that block from using reset for X seconds (if you already use this command within X seconds there should be a chat emssage)
  • Chat message just for that player, not for all
  • "spk" play sound alongside the chat message (for reseted and minimal frags acces denied)
  • A list of commands to triger it, not just a single one.. (const, right?) (like /rs, /reset, /resetscore and so on)
  • -- and all of these to disable them (separate for each one) if I don't wana use any of them (for example if I don' want spk, just messsage or vice-versa.., or no timer just minimal score and so on..)

Use whatever you want: define or cvar (just to be efficient, flexible)

Thanks ! [Hopefully this time is better]

Last edited by ArminC; 01-30-2018 at 12:00.
ArminC is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-30-2018 , 11:51   Re: Request: Resetscore
Reply With Quote #2

I can make a plugin that does this.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
ArminC
Senior Member
Join Date: Apr 2016
Old 01-30-2018 , 11:57   Re: Request: Resetscore
Reply With Quote #3

Ok, if you manage/want to make it post here, I will watch this topic
ArminC is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-30-2018 , 12:03   Re: Request: Resetscore
Reply With Quote #4

Post the sound file you want to be played.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
ArminC
Senior Member
Join Date: Apr 2016
Old 01-30-2018 , 12:07   Re: Request: Resetscore
Reply With Quote #5

No sound lol, I did put in post "spk", you know, that Half-Life sounds you just use these:

spk "cleanup(t20) denied(t20)"
spk "cleanup(t20) terminated(t20)"

I hope it is optimized unlike my repeted mess.. lol.

Last edited by ArminC; 01-30-2018 at 12:27.
ArminC is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-30-2018 , 12:32   Re: Request: Resetscore
Reply With Quote #6

This code is untested. I used the task_complete.wav sound located in your events sounds directory. I couldn't find the sounds you were talking about, or i just misunderstood you.

cvar explenations are described in the code.

PHP Code:
/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Advanced Reset Score"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

new szCommands[][] = { // All available commands. If you wish to add or delete some, make sure the layout stays the same. the last command shouldn't have a "," at the end, as all the rest does.
    
"say /resetscore",
    
"say /rs",
    
"say /scorereset",
    
"say_team /resetscore",
    
"say_team /rs",
    
"say_team /scorereset"
}

new 
pMainPlugin
new pDelayTime
new pMinimalFrags
new pMinimalDeaths
new pAdvertiseMethod

new bool:OnCoolDown[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    for(new 
isizeof(szCommands); i++) {
        
register_clcmd(szCommands[i], "ResetScore")
    }
    
    
pMainPlugin register_cvar("rs_resetscore""1"// Enables/disables the plugin. 0 = disabled.
    
pDelayTime register_cvar("rs_delaytime""10.0"// Default = 10.0 seconds, should always be a float to avoid trouble.
    
pMinimalFrags register_cvar("rs_minfrags""0"
    
pMinimalDeaths register_cvar("rs_mindeaths""0")
    
pAdvertiseMethod register_cvar("rs_message""1"// 1 = print text & play sound, 2 = print text only, 3 = play sound only.
}

public 
plugin_precache() {
    
precache_sound("events/task_complete.wav")
}

public 
ResetScore(id) {
    if(!
get_pcvar_num(pMainPlugin)) { // Plugin disabled
        
return PLUGIN_HANDLED
    
}
    
    if(
OnCoolDown[id] == true) { // Has already used command.
        
client_print(idprint_chat"[RS] You have to wait a little longer to use this command again.")
        return 
PLUGIN_HANDLED
    
}
    
    new 
iFrags get_user_frags(id)
    new 
iDeaths get_user_deaths(id)
    
    if(
iFrags >= get_pcvar_num(pMinimalFrags) && iDeaths >= get_pcvar_num(pMinimalDeaths)) {
        
cs_set_user_deaths(id0)
        
set_user_frags(id0)
        
OnCoolDown[id] = true
        
        set_task
(get_pcvar_float(pDelayTime), "EndDelayTime"id)
        
        
DisplayMessage(id)
    }
    else {
        
client_print(idprint_chat"[RS] You don't meet the minimum requirments to use this command.")
        
client_print(idprint_chat"[RS] Minimum deaths: %i - Minimum frags: %i"get_pcvar_num(pMinimalDeaths), get_pcvar_num(pMinimalFrags))
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
DisplayMessage(id) {
    switch(
pAdvertiseMethod) {
        case 
1: {
            
client_print(idprint_chat"[RS] You reset your score.")
            
client_cmd(id"spk events/task_complete.wav")
        }
        case 
2: {
            
client_print(idprint_chat"[RS] You reset your score.")
        }
        case 
3: {
            
client_cmd(id"spk events/task_complete.wav")
        }
    }
}

public 
EndDelayTime(id) {
    if(
is_user_connected(id) && get_pcvar_num(pMainPlugin)) {
        
client_print(idprint_chat"[RS] You can use the resetscore function again.")
        
OnCoolDown[id] = false
    
}

__________________

Last edited by Napoleon_be; 01-30-2018 at 12:32.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
ArminC
Senior Member
Join Date: Apr 2016
Old 01-30-2018 , 13:03   Re: Request: Resetscore
Reply With Quote #7

Thanks, here are some things:

1. Can you make it trough ReAPI?
2. At the commands list can't you make just /rs instead of say /rs and say_team /rs? (look at my plugin example)
3. Don't you hear about "spk" command in console? lol (look at plugin example)
4. At you have to wait a bit to reset .. can you put like you have to wait %s seconds?
5. At you need %i frags/deaths in order to reset.. try to make it in a single sentence.. (You don't have minimum %i frags and %i deaths to reset the score) instead of 2..
6. "[RS] You can use the resetscore function again." - can you delete it or make a cvar (1/0)?


Original Plugin Example (without my mess)
Spoiler


Plugin example edited by me with floodtime (but a mess)
Spoiler

Last edited by ArminC; 01-30-2018 at 13:11.
ArminC is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-31-2018 , 12:58   Re: Request: Resetscore
Reply With Quote #8

1. No
2. Your plugin is doing the exact same thing, the format is just different.
3. I'll change this when i get home.
4. Same as point 3.
5. Idem ditto
6. Same as 3, 4 and 5.
__________________

Last edited by Napoleon_be; 02-25-2018 at 09:19.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-01-2018 , 14:17   Re: Request: Resetscore
Reply With Quote #9

Untested. Everything is changed as requested.

PHP Code:
/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Advanced Reset Score"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

new szCommands[][] = { // All available commands. If you wish to add or delete some, make sure the layout stays the same. the last command shouldn't have a "," at the end, as all the rest does.
    
"say /resetscore",
    
"say /rs",
    
"say /scorereset",
    
"say_team /resetscore",
    
"say_team /rs",
    
"say_team /scorereset"
}

new 
pMainPlugin
new pDelayTime
new pMinimalFrags
new pMinimalDeaths
new pAdvertiseMethod

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    for(new 
isizeof(szCommands); i++) {
        
register_clcmd(szCommands[i], "ResetScore")
    }
    
    
pMainPlugin register_cvar("rs_resetscore""1"// Enables/disables the plugin. 0 = disabled.
    
pDelayTime register_cvar("rs_delaytime""10"
    
pMinimalFrags register_cvar("rs_minfrags""0"
    
pMinimalDeaths register_cvar("rs_mindeaths""0")
    
pAdvertiseMethod register_cvar("rs_message""1"// 1 = print text & play sound, 2 = print text only, 3 = play sound only.
}

public 
plugin_precache() {
    
precache_sound("events/task_complete.wav")
}

public 
ResetScore(id) {
    if(!
get_pcvar_num(pMainPlugin)) { // Plugin disabled
        
return PLUGIN_HANDLED
    
}
    
    static 
iCoolDown[33], systime
    
if(iCoolDown[id] > (systime get_systime())) {
        
client_print(idprint_chat"[RS] You have to wait %i seconds to reset your score again."iCoolDown[id] - systime)
    }
        
    new 
iFrags get_user_frags(id)
    new 
iDeaths get_user_deaths(id)
    
    if(
iFrags >= get_pcvar_num(pMinimalFrags) && iDeaths >= get_pcvar_num(pMinimalDeaths)) {
        
cs_set_user_deaths(id0)
        
set_user_frags(id0)
        
        
iCoolDown[id] = systime get_pcvar_num(pDelayTime)
        
        
DisplayMessage(id)
    }
    else {
        
client_print(idprint_chat"[RS] You don't have minimum %i frags and %i deaths to reset the score"get_pcvar_num(pMinimalDeaths), get_pcvar_num(pMinimalFrags))
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
DisplayMessage(id) {
    switch(
pAdvertiseMethod) {
        case 
1: {
            
client_print(idprint_chat"[RS] You reset your score.")
            
client_cmd(id"spk ^"cleanup(t20denied(t20)^"")
        }
        case 
2: {
            
client_print(idprint_chat"[RS] You reset your score.")
        }
        case 
3: {
            
client_cmd(id"spk ^"cleanup(t20denied(t20)^"")
        }
    }

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
ArminC
Senior Member
Join Date: Apr 2016
Old 02-01-2018 , 15:27   Re: Request: Resetscore
Reply With Quote #10

Thanks

Somehow you made my day =)
1. client_print(id, print_chat, "[RS] You reset your score.") -> client_cmd(id, "spk ^"cleanup(t20) denied(t20)^"") -- 10/10
2. Why you precache that sound anyway?
3. You forgot to add the cleanup client_cmd(id, "spk ^"cleanup(t20) terminated(t20)^"")
4. It would be nicer to have colors inside the message (See my example)
-> This I can edit/fix by myself (anyway you could include these too for those are watching the topic) but this not:

PS: Can you make the commands to auto-detect if it's AllChat or TeamChat (like in list: /rs, /resetscore instead of say /rs say_team /rs and so on..)?.. I didn't want to bother you again but it did give me some errors
+ Add a cvar in order to chose wich to use timer or kill/death ratio not the 2 in same time

Last edited by ArminC; 02-02-2018 at 16:11.
ArminC is offline
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 04:27.


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