AlliedModders

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

AAleaderNik 04-06-2006 21:30

respawn
 
anybody wanna help me/walk me through making a respawn plugin like

amx_respawn nik then i respawn i found a few plugins that had that in it but with alot of other stuff i didnt want and i found one where everybody respawns till the cvar is off but i didnt find one like i wanted

johnjg75 04-06-2006 21:38

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {      register_plugin("Respawn","1.0","Johnjg75")      register_concmd("amx_respawn","dorespawn",ADMIN_SLAY," <player> - Respawns a player") } public dorespawn(id) {      new pplayer[33]      read_argv(1,pplayer, 32)      new iindex = get_user_index( pplayer )      if(!is_user_alive( iindex ))           spawn(iindex)      return PLUGIN_HANDLED }

Not sure if it works but you can try it

Hawk552 04-06-2006 21:56

Quote:

Originally Posted by johnjg75
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {      register_plugin("Respawn","1.0","Johnjg75")      register_concmd("amx_respawn","dorespawn",ADMIN_SLAY," <player> - Respawns a player") } public dorespawn(id) {      new pplayer[33]      read_argv(1,pplayer, 32)      new iindex = get_user_index( pplayer )      if(!is_user_alive( iindex ))           spawn(iindex)      return PLUGIN_HANDLED }

Not sure if it works but you can try it

That will not work. You either have to do 2 set_tasks and each one use spawn and then give them their weapons and suit, or do cs_user_spawn(iindex).

A fixed version would look like this:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_init() {      register_plugin("Respawn","1.0","Johnjg75")      register_concmd("amx_respawn","dorespawn",ADMIN_SLAY," <player> - Respawns a player") } public dorespawn(id,level,cid) {      if(!cmd_access(id,level,cid,2))     return PLUGIN_HANDLED          new pplayer[33]      read_argv(1,pplayer, 32)      new iindex = get_user_index( pplayer )      if(!is_user_alive( iindex ))           cs_user_spawn(iindex)            return PLUGIN_HANDLED }

AAleaderNik 04-06-2006 22:01

well i was just wanted to make them respawn you know like at the begining of the round with the usp or the glock depending on t or ct so this above would work for that?

also

Code:

    new pplayer[33]
    read_argv(1,pplayer, 32) 
    new iindex = get_user_index( pplayer ) 
    if(!is_user_alive( iindex ))
          cs_user_spawn(iindex)
     
    return PLUGIN_HANDLED

on new pplayer[33] how do u know to get the number 33 and on the read_argv what does that mean i often see numbers with argv and i dont know where these numbers come from :( if anyone could explain i would GREATLY appreciate it

GHW_Chronic 04-06-2006 22:05

O_o

Hawk552 04-06-2006 22:05

Quote:

Originally Posted by AAleaderNik
well i was just wanted to make them respawn you know like at the begining of the round with the usp or the glock depending on t or ct so this above would work for that?

also

Code:

    new pplayer[33]
    read_argv(1,pplayer, 32) 
    new iindex = get_user_index( pplayer ) 
    if(!is_user_alive( iindex ))
          cs_user_spawn(iindex)
     
    return PLUGIN_HANDLED

on new pplayer[33] how do u know to get the number 33 and on the read_argv what does that mean i often see numbers with argv and i dont know where these numbers come from :( if anyone could explain i would GREATLY appreciate it

What? You basically just completely contradicted yourself.

There are many plugins that do what you just said. You said in your original post that you wanted a plugin that would allow you to respawn a target.

SweatyBanana 04-06-2006 22:08

Quote:

on new pplayer[33] how do u know to get the number 33 and on the read_argv what does that mean i often see numbers with argv and i dont know where these numbers come from Sad if anyone could explain i would GREATLY appreciate it

there are 32 player slots max right?

the numbers you store are 0-32 so that is where new pplayer[33] comes from..
0-32 = 33 numbers

GHW_Chronic 04-06-2006 22:08

clearly Hawks does not understand that he is asking pretty much a COMPLETELY different question that has NOTHING to do with respawning. He is asking what [num] on strings means, and read_argv(id,str,NUM) is.

Edit: Sweaty Banana is EVEN more lost. Someone teach him what a string is O_o

PSS: DEBUG ERRORS BECAUSE get_user_index RETURNED 0 AND YOU TRIED TO SPAWN HIM OMFG

AAleaderNik 04-06-2006 22:16

yes chronic is GOD lol ya i was asking a different question with the agrv but ya the code didnt work like ghw said :( any other suggestions

GHW_Chronic 04-06-2006 22:47

http://forums.alliedmods.net/showthread.php?t=13987

and 33 means that the player can type up to 33 characters in for the name. IE:
He Wrote:
1234567890123456789012345678901234
We Read:
123456789012345678901234567890123

And names are only allowed to be 32 characters long in HL. So this is genrally why we use new arg1[32]

I dunno why JJG75 deviated and used 33...


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

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