AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_Killed help (https://forums.alliedmods.net/showthread.php?t=102139)

Fr33m@n 08-30-2009 09:21

Ham_Killed help
 
All that i need is in this code.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
 
public plugin_init()
{
      
register_plugin("Frags By Monster Killed""1.0""Fr33m@n")
      
RegisterHamHam_Killed"func_wall""monster_killed")
}
public 
monster_killed (monsterEntattackershouldgib)
{
     if ( 
pev(monsterEntpev_flags) & FL_MONSTER && is_user_alive(attacker) ) {
           new 
frags // Just an example
           
new newfrags get_user_frags(attacker) + frags
           set_user_frags
(attackernewfrags)
           
//what is the more efficient way beetween these two for add frags ?
           
ExecuteHamB(Ham_AddPointsattackerfragsfalse)
 
           
client_print(attackerprint_chat"You got %d Frags for killing a Monster"frags)
 
 
           new 
namea[32]
           
get_user_name(attackernameacharsmax(namea))
           
client_print(0print_chat"%s killed a Monster (%d Frags)"attackerfrags)
           
//I want that all players show it except the attacker, 0 isn't possible 
           //( and the more efficient way if is possible)
     
}


please help me ;)

Arkshine 08-30-2009 09:24

Re: Ham_Killed help
 
- The second, but the difference is trivial there.
- You have to loop through all players and checking if player is not "attacker".

Fr33m@n 08-30-2009 10:08

Re: Ham_Killed help
 
PHP Code:

new gIsAttacker[33]
 
...
 
gIsAttacker[attacker] = true
static players[32], playerCountplayeri
get_players
(playersplayerCount"h")
for ( 
0playerCounti++ ) {
     new 
namea[32]
     
get_user_nameattackernameacharsmax(namea) )
     
player players[i]
     if (!
gIsAttacker[player]) {
           
client_print(playerprint_chat"%s killed a Monster (%d Frags)"attackerfrags)
     }
}
gIsAttacker[attacker] = false 

something like that ?


All times are GMT -4. The time now is 14:58.

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