AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Command REspawn last death (https://forums.alliedmods.net/showthread.php?t=28707)

Feren6 05-20-2006 20:01

Command REspawn last death
 
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

Hawk552 05-20-2006 21:36

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 }

Feren6 05-20-2006 21:50

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?

Hawk552 05-20-2006 21:56

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 }


All times are GMT -4. The time now is 16:18.

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