Raised This Month: $ Target: $400
 0% 

Command REspawn last death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Feren6
Junior Member
Join Date: May 2006
Old 05-20-2006 , 20:01   Command REspawn last death
Reply With Quote #1

How would you make a command that would resurrect the last person that died on the same team the client command executed? I'm stuck on how that would work. Thanks a lot
Feren6 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-20-2006 , 21:36  
Reply With Quote #2

I'm not exactly sure what you mean. Something like this though? (script is not optimized, I made it as short as possible)

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> new g_iLastDead[2] public plugin_init() {     register_plugin("Revive Last","1.0","Hawk552")         register_clcmd("amx_revive_last","fnReviveLast")         register_event("DeathMsg","fnEventDeathMsg","a")     register_logevent("fnLogEventRoundEnd",2,"1=Round_End")     register_logevent("fnLogEventRoundEnd",2,"1&Restart_Round_") } public fnReviveLast(id)     cs_user_spawn(g_iLastDead[get_user_team(id) - 1])     public fnEventDeathMsg()     g_iLastDead[get_user_team(read_data(2)) - 1] = read_data(2)     public fnLogEventRoundEnd() {     g_iLastDead[0] = 0     g_iLastDead[1] = 0 }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Feren6
Junior Member
Join Date: May 2006
Old 05-20-2006 , 21:50  
Reply With Quote #3

Thanks for your feedback so quick, i'm not sure how that script works, though. Here is what i mean.

Lets say you are a "Priest" Class that can resurect fellow teammates. So the person with the priest class types. /resurect or whatever the command would be, and it would ressurect the last person who died on the priest's team. Can you explain how your script worked?
Feren6 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-20-2006 , 21:56  
Reply With Quote #4

Couple errors I noticed:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> // 2 cells, 1 is for team T, the other is for team CT new g_iLastDead[2] public plugin_init() {     // register plugin     register_plugin("Revive Last","1.0","Hawk552")         // this is the command to revive the last dead player     register_clcmd("amx_revive_last","fnReviveLast")         // Register the death event     register_event("DeathMsg","fnEventDeathMsg","a")     // Register the events where the round ends, to make sure it's zeroed     register_logevent("fnLogEventRoundEnd",2,"1=Round_End")     register_logevent("fnLogEventRoundEnd",2,"1&Restart_Round_") } // amx_revive_last command public fnReviveLast(id) {     // get the person's team     new iTeam = get_user_team(id)     // check if anyone on the team is dead     if(g_iLastDead[iTeam-1])     {         // if so, spawn that last dead person         cs_user_spawn(g_iLastDead[iTeam - 1])                 // they aren't dead now, are they?         g_iLastDead[iTeam - 1] = 0     } } // set the last dead, when they die public fnEventDeathMsg()     g_iLastDead[get_user_team(read_data(2)) - 1] = read_data(2)     // zero out the things when round ends public fnLogEventRoundEnd() {     g_iLastDead[0] = 0     g_iLastDead[1] = 0 }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 16:18.


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