AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   simple reset score log (https://forums.alliedmods.net/showthread.php?t=223123)

slypire 08-10-2013 03:15

simple reset score log
 
Hi guys, i made one simple plugin for /rs, /resetscore and I get next log:

Code:

L 08/10/2013 - 00:52:53: [AMXX] Displaying debug trace (plugin "explosion_rs.amxx")
L 08/10/2013 - 00:52:53: [AMXX] Run time error 10: native error (native "cs_set_user_deaths")
L 08/10/2013 - 00:52:53: [AMXX]    [0] explosion_rs.sma::cmdReset (line 25)
L 08/10/2013 - 00:54:20: Invalid player id 128


there is a .sma

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <colorchat>

#define PLUGIN "rs basic"
#define VERSION "1.0"
#define AUTHOR "Author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /resetscore""cmdReset")
    
register_clcmd("say /restartscore""cmdReset")
    
register_clcmd("say /rs""cmdReset")
    
    
register_clcmd("say_team /resetscore""cmdReset")
    
register_clcmd("say_team /restartscore""cmdReset")
    
register_clcmd("say_team /rs""cmdReset")
    
}

public 
cmdReset(id){
    
cs_set_user_deaths(id0)
    
set_user_frags(id0)
    
cs_set_user_deaths(id0)
    
set_user_frags(id0)
    
    
ColorChat(idGREEN"^4[Resete Score] ^1Uspesno ste resetovali skor!")    
    


And line 25 is cs_set_user_deaths(id, 0) first time ..
thanks

Black Rose 08-10-2013 04:34

Re: simple reset score log
 
I'd say this is impossible. The code you have provided should work unless you have some other function that is calling cmdReset() that we can't see.

You don't need to set deaths and frags twice, one time each is enough.

slypire 08-10-2013 04:38

Re: simple reset score log
 
When i set deaths and frags just one time, then plugin dont resetscore to player x)

simanovich 08-10-2013 08:53

Re: simple reset score log
 
Quote:

Originally Posted by slypire (Post 2009811)
When i set deaths and frags just one time, then plugin dont resetscore to player x)

When you set it only one time, the score will be updated only next round

DWIGHTpN 08-10-2013 11:47

Re: simple reset score log
 
Try this:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <colorchat>

#define PLUGIN "rs basic"
#define VERSION "1.0"
#define AUTHOR "Author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /resetscore""cmdReset")
    
register_clcmd("say /restartscore""cmdReset")
    
register_clcmd("say /rs""cmdReset")
    
    
register_clcmd("say_team /resetscore""cmdReset")
    
register_clcmd("say_team /restartscore""cmdReset")
    
register_clcmd("say_team /rs""cmdReset")
    
}

public 
cmdReset(id){
    if( !
is_user_bot(id) && 1<=id<=get_maxplayers() ) {
           
cs_set_user_deaths(id0)
           
set_user_frags(id0)
           
cs_set_user_deaths(id0)
           
set_user_frags(id0)
    
           
ColorChat(idGREEN"^4[Resete Score] ^1Uspesno ste resetovali skor!")   
    } 
    return 
PLUGIN_HANDLED



wickedd 08-10-2013 12:18

Re: simple reset score log
 
PHP Code:

public cmdReset(id){
    
cs_set_user_deaths(id0)
    
set_user_frags(id0)
    
cs_set_user_deaths(id0)
    
set_user_frags(id0)
    
    
client_print(idprint_chat"^4[Resete Score] ^1Uspesno ste resetovali skor!")    
    


:arrow:

PHP Code:

public cmdReset(id){
    
cs_set_user_deaths(id0)
    
set_user_frags(id0)
    
    
client_print(idprint_chat"^4[Resete Score] ^1Uspesno ste resetovali skor!")        


Then update players frags in the scoreboard.

@DWIGHTpN

No.


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

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