Raised This Month: $ Target: $400
 0% 

ResetScore Optimizing/Remove Fakemeta


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tcPane
Senior Member
Join Date: Sep 2010
Old 09-29-2012 , 10:13   ResetScore Optimizing/Remove Fakemeta
Reply With Quote #1

Hello,
can u remove fakemeta module and optimize this code?

Spoiler
tcPane is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 09-29-2012 , 10:21   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #2

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

#define PLUGIN "Reset Score" 
#define VERSION "0.0.1" 

public plugin_init()  

    
register_pluginPLUGINVERSION"kostov" 
    
    
register_clcmd("say /rs""Cmd_ResetScore"
    
register_clcmd("say_team /rs""Cmd_ResetScore"
    
register_clcmd("say /resetscore""Cmd_ResetScore"
    
register_clcmd("say_team /resetscore""Cmd_ResetScore"


public 
Cmd_ResetScore(id)  

    
set_user_frags(id0
    
cs_set_user_deaths(id0
    
    new 
szName[33
    
get_user_name(idUserNamecharsmax(szName))
    
    
client_print(0print_chat"%s has just reset his score"szName


public 
client_putinserver(id)  

    
set_task(10.0"ResetScoreMsg"id


public 
ResetScoreMsg(id)  

    if ( 
is_user_connectedid ) ) 
    { 
        
client_print(0print_chat"To restart your score just write /rs or /resetscore"
    } 

__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 09-29-2012 at 10:25.
pokemonmaster is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 09-29-2012 , 10:23   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #3

Why you don't use this? https://forums.alliedmods.net/showthread.php?p=933493

PHP Code:
get_user_name(idUserNamecharsmax(szName
You forgot to close the parenthesis.

Last edited by guipatinador; 09-29-2012 at 10:24.
guipatinador is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 09-29-2012 , 10:25   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #4

Quote:
Originally Posted by guipatinador View Post
PHP Code:
get_user_name(idUserNamecharsmax(szName
You forgot to close the parenthesis.
Thanks
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-29-2012 , 11:24   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #5

Damn forget the idea to remove fakemeta, it's fine and what you gonna do is to make inefficient plugins and run them on your server.

Want to optimize ? Remove the useless task and use that code :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Reset Score"
#define VERSION "0.0.2"

#define m_iDeaths 444

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )
    
register_clcmd("say /rs""ClCmd_ResetScore")
    
register_clcmd("say_team /rs""ClCmd_ResetScore")
}

public 
ClCmd_ResetScore(id
{
    new 
frags get_user_frags(id)
    if( 
frags || get_pdata_int(idm_iDeaths) )
    {
        
set_pdata_int(idm_iDeaths0)
        
ExecuteHam(Ham_AddPointsid, -frags1)

        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))

        
client_print(0print_chat"%s has just reset his score"szName)
        return 
PLUGIN_CONTINUE
    
}
    
client_print(idprint_chat"Your score is already null")
    return 
PLUGIN_HANDLED_MAIN

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-29-2012 at 13:45. Reason: added #6 request
ConnorMcLeod is offline
tcPane
Senior Member
Join Date: Sep 2010
Old 09-29-2012 , 12:28   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #6

I am not tested your code yet, connor, but can u add option, when you score is 0;0 to show message "Your score is already reset" and block public message ( which shows to all ) ?

Last edited by tcPane; 09-29-2012 at 14:35.
tcPane is offline
PandaDnB
Senior Member
Join Date: Jan 2012
Old 09-29-2012 , 14:13   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #7

How about this ?
PHP Code:
#include <amxmodx> 
#include <cstrike>
#include <fun>

public plugin_init()

    
register_plugin("ResetScore""1.0""PandaDNB"
    
register_clcmd("say /resetscore""ResetScore"
    
register_clcmd("say /rs""ResetScore")


public 
ResetScore(id)
{
    
set_user_frags(id0
    
cs_set_user_deaths(id0
    
client_print(idprint_chat"[TAG] Your score and deaths are successfully reset!")


Last edited by PandaDnB; 09-29-2012 at 14:19.
PandaDnB is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-29-2012 , 14:17   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #8

Would work but ScoreInfo message sent from cs_set_user_death is not sent from dll to engine, but directly to engine, so a plugin that would hook such a message (via register_event("ScoreInfo", ..) or register_message() ) would never receive it.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-29-2012 at 14:18.
ConnorMcLeod is offline
tcPane
Senior Member
Join Date: Sep 2010
Old 09-29-2012 , 14:34   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #9

Quote:
Originally Posted by tcPane View Post
can u add option, when you score is 0;0 to show message "Your score is already reset" and block public message ( which shows to all ) ?

Last edited by tcPane; 09-29-2012 at 14:35.
tcPane is offline
Ax3l
Member
Join Date: Nov 2009
Old 09-29-2012 , 17:17   Re: ResetScore Optimizing/Remove Fakemeta
Reply With Quote #10

Thx Connor i will use your plugin from now on
__________________
Ax3l 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 22:10.


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