AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My command. (https://forums.alliedmods.net/showthread.php?t=82639)

ianglowz 12-27-2008 01:04

My command.
 
I always see plugin have command.But their command different with my command.

My command do not see at chat.How to make it can see at chat?

I will +karma who help me.:)

Spunky 12-27-2008 02:05

Re: My command.
 
I'd help you if I understood what you were trying to say. O_o

Are you saying that you want your command to print something?

http://www.amxmodx.org/funcwiki.php?go=func&id=22

ianglowz 12-27-2008 03:55

Re: My command.
 
Ok,I give the code.

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define VERSION "1.0"

new p_Onp_Limit;
new 
g_iRespawnCount33 ];

public 
plugin_init()
{
    
register_plugin"Manual Respawn"VERSION"Ianglowz | Dores" );
    
    
p_On register_cvar"mr_allow""1" );
    
p_Limit register_cvar"mr_limit""3" );
    
register_clcmd"say /respawn""Cmd_Respawn" );
    
    
register_event"HLTV""ev_newRound""a""1=0""2=0" );
}

public 
Cmd_Respawnid )
{
    if( !
get_pcvar_nump_On ) )
    {
        
client_printidprint_chat"Manual Respawn is off!" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
limit;
    if( ++
g_iRespawnCountid ] > ( limit get_pcvar_nump_Limit ) ) )
    {
        
client_printidprint_chat"You have respawned yourself too much. Wait to new round." );
        return 
PLUGIN_HANDLED;
    }
    
    if( !
is_user_aliveid ) )
    {
        
ExecuteHamBHam_CS_RoundRespawnid );
        
client_printidprint_chat"Respawns left: %d", ( limit g_iRespawnCountid ] ) );
  
        
give_item(id,"weapon_mp5navy")
        
give_item(id,"ammo_9mm")
        
give_item(id,"ammo_9mm")    
  
    }
    
    else
    {
        
client_printidprint_chat"You must be dead." );
    }
    
    return 
PLUGIN_HANDLED;
}

public 
ev_newRound()
{
    for( new 
<= get_maxplayers() ; i++ )
    {
        
g_iRespawnCount] = 0;
    }
}

public 
client_disconnectid )
{
    
g_iRespawnCountid ] = 0;


When I say /respwan,
It will show like this:

Respawn left:2

I see at one plugin,it show like this.Example that was my plugin.

ianglowz:/respawn
Respawn left at ianglowz:2

I want like this because many people don't that my server has respawn plugin.

Exolent[jNr] 12-27-2008 04:18

Re: My command.
 
Change "return PLUGIN_HANDLED" to "return PLUGIN_CONTINUE"

ianglowz 12-27-2008 04:31

Re: My command.
 
Which return must be changed?

PHP Code:

public Cmd_Respawnid )
{
    if( !
get_pcvar_nump_On ) )
    {
        
client_printidprint_chat"Manual Respawn is off!" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
limit;
    if( ++
g_iRespawnCountid ] > ( limit get_pcvar_nump_Limit ) ) )
    {
        
client_printidprint_chat"You have respawned yourself too much. Wait to new round." );
        return 
PLUGIN_HANDLED;
    }
    
    if( !
is_user_aliveid ) )
    {
        
ExecuteHamBHam_CS_RoundRespawnid );
        
client_printidprint_chat"Respawns left: %d", ( limit g_iRespawnCountid ] ) );
  
        
give_item(id,"weapon_mp5navy")
        
give_item(id,"ammo_9mm")
        
give_item(id,"ammo_9mm")    
  
    }
    
    else
    {
        
client_printidprint_chat"You must be dead." );
    }
    
    return 
PLUGIN_HANDLED;


This "return PLUGIN_HANDLED"?

ianglowz 12-27-2008 04:36

Re: My command.
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define VERSION "1.0"

new p_Onp_Limit;
new 
g_iRespawnCount33 ];

public 
plugin_init()
{
    
register_plugin"Manual Respawn"VERSION"Ianglowz | Dores" );
    
    
p_On register_cvar"mr_allow""1" );
    
p_Limit register_cvar"mr_limit""1" );
    
register_clcmd"say /respawn""Cmd_Respawn" );
    
    
register_event"HLTV""ev_newRound""a""1=0""2=0" );
}

public 
Cmd_Respawnid )
{
    if( !
get_pcvar_nump_On ) )
    {
        
client_printidprint_chat"Manual Respawn is off!" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
limit;
    if( ++
g_iRespawnCountid ] > ( limit get_pcvar_nump_Limit ) ) )
    {
        
client_printidprint_chat"You have respawned yourself too much. Wait to new round." );
        return 
PLUGIN_HANDLED;
    }
    
    if( !
is_user_aliveid ) )
    {
        new 
name[32]
        
get_user_name(id,name,31)    
        
ExecuteHamBHam_CS_RoundRespawnid );
        
client_printidprint_chat"%s use Manual Respawn.%d respawn left.", ( name,limit g_iRespawnCountid ] ) );
  
        
give_item(id,"weapon_mp5navy")
        
give_item(id,"ammo_9mm")
        
give_item(id,"ammo_9mm")

    }
    
    else
    {
        
client_printidprint_chat"You must be dead to acces Manual Respawn." );
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
ev_newRound()
{
    for( new 
<= get_maxplayers() ; i++ )
    {
        
g_iRespawnCount] = 0;
    }
}

public 
client_disconnectid )
{
    
g_iRespawnCountid ] = 0

Correct?

Spunky 12-27-2008 04:42

Re: My command.
 
Stop double posting, and yes, that's correct. Although I don't see why you would return PLUGIN_CONTINUE. I return PLUGIN_HANDLED for all commands.

jim_yang 12-27-2008 04:56

Re: My command.
 
return plugin_continue in a say-style registered cmd will show the say text

ianglowz 12-27-2008 04:57

Re: My command.
 
Sorry about double post.
This from Scripting Tutorial.

Code:

Also, note PLUGIN_HANDLED. There are two main return values you should concern yourself with. PLUGIN_CONTINUE generally means "continue with normal operation", and PLUGIN_HANDLED means "block further operation". The differences are subtle but important. For example, when binding a command, you should never return PLUGIN_CONTINUE. But if you return PLUGIN_HANDLED while binding to the "say" command, it will block the player's text from ever appearing. You must be careful with which you choose in certain situations. However, most things are unaffected (such as tasks, events, and other things you will run into later on)
Like you can see.I want the text appear for everyone in my server.

ianglowz 12-27-2008 05:06

Re: My command.
 
My plugin come more worst when put PLUGIN_CONTINUE.It don't say anything and don't give mp5navy.Just respawn.


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

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