Quote:
Originally Posted by victorngl
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(AUTOR, VERSAO, NOME) register_clcmd("say /ulti" , "inDuck") g_iMax = get_maxplayers() } public InDuck( id ) { RegisterHam(Ham_Player_Duck, "player", "FwdPlayerDuck", 1); }
public FwdPlayerDuck(id) { gLastDuckedPlayer = id; SetGlow() }
// ...
SetGlow() { new i for (i = 0; i <= g_iMax; i++) { if( cs_get_user_team( i ) != CS_TEAM_T || !is_user_alive( i ) ) { return PLUGIN_HANDLED_MAIN } if(gLastDuckedPlayer && is_user_connected(gLastDuckedPlayer)) { new name[32]; get_user_name(gLastDuckedPlayer, name, charsmax(name)); fm_set_rendering(i, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20) } } }
|
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
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;
}
__________________