This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

last player to run +duck


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
victorngl
Member
Join Date: Feb 2011
Old 12-29-2011 , 14:06   last player to run +duck
Reply With Quote #1

Can anyone tell me how to detect the last player to run the command +duck ?
victorngl is offline
Send a message via MSN to victorngl Send a message via Skype™ to victorngl
Old 12-29-2011, 14:23
Devil259
This message has been deleted by Devil259.
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-29-2011 , 15:07   Re: last player to run +duck
Reply With Quote #2

Code:
#include <amxmodx> #include <hamsandwich> new gLastDuckedPlayer = 0; public plugin_init() {     RegisterHam(Ham_Player_Duck, "FwdPlayerDuck", 1); } public FwdPlayerDuck(id) {     gLastDuckedPlayer = id; } // ... YourFunction() {     if(gLastDuckedPlayer && is_user_connected(gLastDuckedPlayer)) {         new name[32];         get_user_name(gLastDuckedPlayer, name, charsmax(name));     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
victorngl
Member
Join Date: Feb 2011
Old 12-29-2011 , 15:54   Re: last player to run +duck
Reply With Quote #3

if I want to glow for the last player to run +duck, I do it?

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
#include <cstrike>

#define AUTOR "exolent"
#define VERSAO "1.0"
#define NOME "InDuck"

new g_iMax
new gLastDuckedPlayer 0;

public 
plugin_init() {
    
register_plugin(AUTORVERSAONOME)
    
register_clcmd("say /ulti" "inDuck")
    
g_iMax get_maxplayers()
    
}
public 
InDuckid )
{
    
RegisterHam(Ham_Player_Duck"player""FwdPlayerDuck"1);
}

public 
FwdPlayerDuck(id) {
    
gLastDuckedPlayer id;
    
SetGlow()
}

// ...

SetGlow() {
    
    new 
i
    
for (0<= g_iMaxi++)
    {
        
        if( 
cs_get_user_team) != CS_TEAM_T || !is_user_alive) ) {
            return 
PLUGIN_HANDLED_MAIN
        
}
        if(
gLastDuckedPlayer && is_user_connected(gLastDuckedPlayer)) {
            new 
name[32];
            
get_user_name(gLastDuckedPlayernamecharsmax(name));
            
fm_set_rendering(ikRenderFxGlowShell25000kRenderNormal20)
        }
        
    }

victorngl is offline
Send a message via MSN to victorngl Send a message via Skype™ to victorngl
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 12-29-2011 , 16:28   Re: last player to run +duck
Reply With Quote #4

Can I detect the first and the last player used the +jump command?
__________________
kramesa is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-29-2011 , 17:14   Re: last player to run +duck
Reply With Quote #5

Quote:
Originally Posted by victorngl View Post
if I want to glow for the last player to run +duck, I do it?

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
#include <cstrike>

#define AUTOR "exolent"
#define VERSAO "1.0"
#define NOME "InDuck"

new g_iMax
new gLastDuckedPlayer 0;

public 
plugin_init() {
    
register_plugin(AUTORVERSAONOME)
    
register_clcmd("say /ulti" "inDuck")
    
g_iMax get_maxplayers()
    
}
public 
InDuckid )
{
    
RegisterHam(Ham_Player_Duck"player""FwdPlayerDuck"1);
}

public 
FwdPlayerDuck(id) {
    
gLastDuckedPlayer id;
    
SetGlow()
}

// ...

SetGlow() {
    
    new 
i
    
for (0<= g_iMaxi++)
    {
        
        if( 
cs_get_user_team) != CS_TEAM_T || !is_user_alive) ) {
            return 
PLUGIN_HANDLED_MAIN
        
}
        if(
gLastDuckedPlayer && is_user_connected(gLastDuckedPlayer)) {
            new 
name[32];
            
get_user_name(gLastDuckedPlayernamecharsmax(name));
            
fm_set_rendering(ikRenderFxGlowShell25000kRenderNormal20)
        }
        
    }

Why are you looping through players? You already have the player's index.
Also, you don't even need the player's name. It was just an example.
Finally, you would also need to remove glow from the player who last ducked before the newest player that last ducked.

Quote:
Originally Posted by kramesa View Post
Can I detect the first and the last player used the +jump command?
Use the same method with Ham_Player_Jump.
You would need another variable.

Code:
new gFirstPlayerJumped; new gLastPlayerJumped; // ... RegisterHam(Ham_Player_Jump, "FwdPlayerJump"); // ... public FwdPlayerJump(id) {     if(!gFirstPlayerJumped) {         gFirstPlayerJumped = id;     }     gLastPlayerJumped = id; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 12-29-2011 at 17:14.
Exolent[jNr] is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-29-2011 , 20:28   Re: last player to run +duck
Reply With Quote #6

Code:
public FwdPlayerJump(id) {     if(!gFirstPlayerJumped)     {         gFirstPlayerJumped = id;     }     gLastPlayerJumped = id; }


is it the same as

Code:
public FwdPlayerJump(id) {     gLastPlayerJumped = id; }


?
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Old 12-30-2011, 03:50
Hunter-Digital
This message has been deleted by Hunter-Digital. Reason: Hmm, sleepy, nvm :P
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 20:56.


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