AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   amx_respawn -- works.. ya.. but only once (https://forums.alliedmods.net/showthread.php?t=11421)

KaOs 03-19-2005 01:22

amx_respawn -- works.. ya.. but only once
 
I made this plugin a few days ago, and it works perfectly, but it only works one time per map load.. I'm guessing its something I haven't decremented but I can't figure it out.. please help :)

Code:
see next 2 posts

KaOs 03-19-2005 02:38

Edit: I think I figured it out, i'll post updated code if it works

KaOs 03-19-2005 02:49

ill post it as a plugin soon

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new g_respawnCount = -1 new g_respawnIndex[5] public plugin_init(){     register_plugin("AMX Respawn", "1.1", "whitemike")     register_clcmd("amx_respawn", "startRespawn", ADMIN_KICK, " <authid, nick, or #userid> - Respawn a player") } public startRespawn(id) {     if(!access(id, ADMIN_KICK)) {         console_print(id, "[AMXX] You have no access to this command")         return PLUGIN_HANDLED     }     new plrId[33]     read_argv(1, plrId, 32)     new plrIndex = cmd_target(id, plrId, 0)     if(!plrIndex) {         console_print(id, "[AMXX] Cannot find the specified player, try again")         return PLUGIN_HANDLED     }     else if(is_user_alive(plrIndex)) {         console_print(id, "[AMXX] That player is already alive, wait until they die")         return PLUGIN_HANDLED     }     for(new i=0; i<5; i++) {         if(g_respawnIndex[i] == plrIndex) {             console_print(id, "[AMXX] This player is already in queue for respawn")             return PLUGIN_HANDLED         }     }     if(g_respawnCount == 4) {         console_print(id, "[AMXX] There is too many players in the queue (5 max)")         return PLUGIN_HANDLED     }     g_respawnCount++     g_respawnIndex[g_respawnCount] = plrIndex     spawn(plrIndex)     set_task(0.5, "finishRespawn")     if(plrIndex != id) {         new adminName[33]         get_user_name(id, adminName, 32)         new clientName[33]         get_user_name(plrIndex, clientName, 32)         client_print(plrIndex, print_chat, "[AMXX] %s has granted you an extra life!", adminName)         console_print(id, "[AMXX] %s has been respawned successfully", clientName)     }     else {         client_print(id, print_chat, "[AMXX] You have been respawned.")         console_print(id, "[AMXX] You have been respawned.")     }     return PLUGIN_HANDLED } public finishRespawn() {     spawn(g_respawnIndex[g_respawnCount])     g_respawnIndex[g_respawnCount] = false     g_respawnCount--     return PLUGIN_HANDLED }

NiGHTFiRE 03-19-2005 03:27

Is your name whitemike?

KaOs 03-19-2005 14:40

Yes sir :)

DiscoBBQ 03-19-2005 16:14

Thats an awsome idea. I'd use it if i played cs.

KaOs 03-19-2005 17:30

Doesn't have to be CS I don't think.. cstrike module isnt required at least :)

knekter 03-19-2005 19:54

hmm
 
use spawn(id)
spawn(id)

Theres a bug with it I believe

KaOs 03-21-2005 17:35

that's what i'm using isn't it?

vittu 03-21-2005 21:40

Yea, but he means use it twice just after each other like:
spawn(id)
spawn(id)

It prevents some glitches, mainly with hud I think.


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

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