AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   ResetScore Optimizing/Remove Fakemeta (https://forums.alliedmods.net/showthread.php?t=197135)

tcPane 09-29-2012 10:13

ResetScore Optimizing/Remove Fakemeta
 
Hello,
can u remove fakemeta module and optimize this code?

Spoiler

pokemonmaster 09-29-2012 10:21

Re: ResetScore Optimizing/Remove Fakemeta
 
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"
    } 



guipatinador 09-29-2012 10:23

Re: ResetScore Optimizing/Remove Fakemeta
 
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.

pokemonmaster 09-29-2012 10:25

Re: ResetScore Optimizing/Remove Fakemeta
 
Quote:

Originally Posted by guipatinador (Post 1808887)
PHP Code:

get_user_name(idUserNamecharsmax(szName

You forgot to close the parenthesis.

Thanks

ConnorMcLeod 09-29-2012 11:24

Re: ResetScore Optimizing/Remove Fakemeta
 
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



tcPane 09-29-2012 12:28

Re: ResetScore Optimizing/Remove Fakemeta
 
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 ) ?

PandaDnB 09-29-2012 14:13

Re: ResetScore Optimizing/Remove Fakemeta
 
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!")



ConnorMcLeod 09-29-2012 14:17

Re: ResetScore Optimizing/Remove Fakemeta
 
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.

tcPane 09-29-2012 14:34

Re: ResetScore Optimizing/Remove Fakemeta
 
Quote:

Originally Posted by tcPane (Post 1808966)
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 ) ?


Ax3l 09-29-2012 17:17

Re: ResetScore Optimizing/Remove Fakemeta
 
Thx Connor i will use your plugin from now on


All times are GMT -4. The time now is 22:10.

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