Raised This Month: $ Target: $400
 0% 

action thru register_concmd to dead players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-12-2007 , 10:48   action thru register_concmd to dead players
Reply With Quote #1

how to make actions thru register_concmd performing on dead players ?
__________________
Voi is offline
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 05-12-2007 , 14:01   Re: action thru register_concmd to dead players
Reply With Quote #2

Quote:
Originally Posted by Voi View Post
how to make actions thru register_concmd performing on dead players ?
Simple example:
PHP Code:
public plugin_init()
{
register_concmd("amx_function""cmdMyFunc"ADMIN_ADMIN"- To perform action on dead players")
}
public 
cmdMyFunc(id)
{
for (new 
0get_playersnum();i++) // check all players in server
{
   if (!
is_user_alive(i)) // check if they are dead
   
{
       
client_cmd(i"say I am dead - it sucks"// perform the action - in this case say "I am dead - it sucks"
   
}

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 05-12-2007 , 15:22   Re: action thru register_concmd to dead players
Reply With Quote #3

PHP Code:
public cmdMyFunc(id){
    new 
players[32], num
    
    get_players
(playersnum"b")
    for(new 
0numi++){
        
//
        // ACTION HERE FOR DEAD PLAYERS (playerid = players[i])
        //
    
}

_Master_ is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 05-12-2007 , 15:22   Re: action thru register_concmd to dead players
Reply With Quote #4

Quote:
Originally Posted by slmclarengt View Post
Simple example:
PHP Code:
public plugin_init()
{
register_concmd("amx_function""cmdMyFunc"ADMIN_ADMIN"- To perform action on dead players")
}
public 
cmdMyFunc(id)
{
for (new 
0get_playersnum();i++) // check all players in server
{
   if (!
is_user_alive(i)) // check if they are dead
   
{
       
client_cmd(i"say I am dead - it sucks"// perform the action - in this case say "I am dead - it sucks"
   
}

Slmclarengt
get_playersnum() << Only return the number of players in the server unless you specify the first parameter it then it will include the number of player in and connecting to the server.

Let say get_playersnum() return 5 but let say player 1 is in slot 1, player 2 is in slot 3, player 3 is in slot 5, and player 4 is in slot 9, and player 5 is in slot 10.

That for loop will only go out to 4. Skippign player 3, 4, 5. Also player id start from 1 not 0. If you use use on some depending on the native it will throw an error.

So use get_players() or get_maxplayers().
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-13-2007 , 06:40   Re: action thru register_concmd to dead players
Reply With Quote #5

uh, actually i wanted this command on single persons wherever they dead or not

thx for help
__________________
Voi is offline
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 05-13-2007 , 13:38   Re: action thru register_concmd to dead players
Reply With Quote #6

Quote:
Originally Posted by teame06 View Post
get_playersnum() << Only return the number of players in the server unless you specify the first parameter it then it will include the number of player in and connecting to the server.

Let say get_playersnum() return 5 but let say player 1 is in slot 1, player 2 is in slot 3, player 3 is in slot 5, and player 4 is in slot 9, and player 5 is in slot 10.

That for loop will only go out to 4. Skippign player 3, 4, 5. Also player id start from 1 not 0. If you use use on some depending on the native it will throw an error.

So use get_players() or get_maxplayers().
I'm well aware as I have used those other functions before; when I wrote this I was in a rush and just grabbed the function off the top of my head without any real pre-thought but I remembered I should be using get_players() but didn't want/have the time to fix it.

@ Voi - what do you mean? Do you want the player to type something like /amidead and the plugin to check if their dead and if they are, tell them? Or do you want it to automatically tell everyone when they die that they died (not like that's completely obvious or anything :-)).

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-20-2007 , 11:59   Re: action thru register_concmd to dead players
Reply With Quote #7

no, something like admin writes "amx_something playername" and a function is executed on that player wherever he is dead or not, for example client_print and client_cmd and perhaps emit_sound
__________________
Voi is offline
Minimum
Senior Member
Join Date: Jun 2006
Old 05-20-2007 , 17:22   Re: action thru register_concmd to dead players
Reply With Quote #8

Is this what you are looking for?

Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_func","MyFunc",ADMIN_ADMIN,"My Function's Description") } public MyFunc(id) {     new playerid, playername[64]     read_argv(1,playername,63)     // Flag Ids - cmd_target(adminid,playername,flagid)     // 1 - obey immunity     // 2 - allow yourself     // 4 - must be alive     // 8 - can't be bot     playerid = cmd_target(id,playername,2)     client_print(playerid,print_chat,"Oh no!  Someone has executed amx_func on you!") }
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-20-2007 , 17:35   Re: action thru register_concmd to dead players
Reply With Quote #9

yes, thank you very much
__________________
Voi is offline
Reply


Thread Tools
Display Modes

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 06:42.


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