Raised This Month: $51 Target: $400
 12% 

Biohazard Mod respawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rzvbv
New Member
Join Date: Sep 2016
Old 09-19-2016 , 06:43   Biohazard Mod respawn
Reply With Quote #1

Hello guys, I`m using this plugin:
PHP Code:
 /*
 _,.~^*^~.,_Halo Style Respawning_,.~^*^~.,_
 
 Credits:
    CSDM - for the CSDM spawn points - duh!
         - for the csdm_spawn_preset.sma - thanks open source ^_^
 
 //- Cvars -
 sv_HSR            //Turns HSR on(1|2) and off(0)
                    //1 - kills subtract time, deaths add time
                    //2 - suicides and team kills add time
 sv_HSRspawns    //Use CSDM spawns(1) or normal team spawns(0)
                    //- Note: If there is no CSDM spawn configuration
                    //          for the current map, normal team spawns
                    //          will be used. Also, players will be given
                    //          pistols every spawn.
 sv_HSRtime        //How many seconds are added
 sv_HSRmaxtime    //Max seconds for players
 */

 #include <amxmodx>
 #include <amxmisc>
 #include <cstrike>
 #include <engine>
 #include <fun>
 #include <biohazard>

 #define PLUGNAME        "Halo Style Respawning"
 #define AUTHOR            "Emp`"
 #define VERSION        "1.31"

 #define    MAX_SPAWNS    60
 #define    MAX_SPEAK    10

 
new Float:HSRtime[33]                //countdown for the users
 
new SOrigin[33][3];

 new 
Float:g_SpawnVecs[MAX_SPAWNS][3];
 new 
Float:g_SpawnAngles[MAX_SPAWNS][3];
 new 
Float:g_SpawnVAngles[MAX_SPAWNS][3];
 new 
g_TotalSpawns;
 
 
//for pcvars
 
new sv_HSRsv_HSRspawnssv_HSRtimesv_HSRmaxtime
 
public plugin_init()
 {

    
register_plugin(PLUGNAMEVERSIONAUTHOR)

    
sv_HSR register_cvar("sv_HSR""1")
    
sv_HSRspawns register_cvar("sv_HSRspawns""1")
    
sv_HSRtime register_cvar("sv_HSRtime""1.0")
    
sv_HSRmaxtime register_cvar("sv_HSRmaxtime""10.0")

    
register_event("DeathMsg","DeathEvent","a")

    
readSpawns()
    
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET);
 }
////////////////////////////////////////////////////////////////////////////
// To lazy to rewrite everything, and plus I bet this is probably written //
//   the best it can be, right? I mean BAILOPAN and Freecode wrote it!      //
////////////////////////////////////////////////////////////////////////////
 
readSpawns()
 {
    
//-617 2648 179 16 -22 0 0 -5 -22 0
    // Origin (x,y,z), Angles (x,y,z), vAngles(x,y,z), Team (0 = ALL) - ignore
    // :TODO: Implement team specific spawns
    
    
new Map[32], config[32],  MapFile[64];
    
    
get_mapname(Map31)
    
get_configsdir(config31 )
    
format(MapFile63"%s\csdm\%s.spawns.cfg"configMap);
    
g_TotalSpawns 0;
    
    if (
file_exists(MapFile)) 
    {
        new 
Data[124], len;
            new 
line 0;
            new 
pos[12][8];
            
        while(
g_TotalSpawns MAX_SPAWNS && (line read_file(MapFile line Data 123 len) ) != 
        {
            if (
strlen(Data)<|| Data[0] == '[')
                continue;

            
parse(Datapos[1], 7pos[2], 7pos[3], 7pos[4], 7pos[5], 7pos[6], 7pos[7], 7pos[8], 7pos[9], 7pos[10], 7);
            
            
// Origin
            
g_SpawnVecs[g_TotalSpawns][0] = str_to_float(pos[1]);
            
g_SpawnVecs[g_TotalSpawns][1] = str_to_float(pos[2]);
            
g_SpawnVecs[g_TotalSpawns][2] = str_to_float(pos[3]);
            
            
//Angles
            
g_SpawnAngles[g_TotalSpawns][0] = str_to_float(pos[4]);
            
g_SpawnAngles[g_TotalSpawns][1] = str_to_float(pos[5]);
            
g_SpawnAngles[g_TotalSpawns][2] = str_to_float(pos[6]);
            
            
//v-Angles
            
g_SpawnVAngles[g_TotalSpawns][0] = str_to_float(pos[7]);
            
g_SpawnVAngles[g_TotalSpawns][1] = str_to_float(pos[8]);
            
g_SpawnVAngles[g_TotalSpawns][2] = str_to_float(pos[9]);
            
            
//Team - ignore
            
            
g_TotalSpawns++;
        }
        
        
log_amx("Loaded %d spawn points for map %s."g_TotalSpawnsMap)
    } else {
        
log_amx("No spawn points file found (%s)"MapFile)
    }
    
    return 
1;
 }
 
// I didn't see the point in the "num" in spawn_Preset(id, num) since
 // there is a new num being created. Anyone want to tell me why it's there?
 
public spawn_Preset(id)
 {
    if (
g_TotalSpawns 2)
        return 
PLUGIN_CONTINUE
    
    
new list[MAX_SPAWNS];
    new 
num 0
    new final = -
1
    new 
total=0
    new 
players[32], n0;
    new 
Float:loc[32][3], locnum
    
    
//cache locations
    
get_players(playersnum)
    for (new 
i=0i<numi++)
    {
        if (
is_user_alive(players[i]) && players[i] != id)
        {
            
entity_get_vector(players[i], EV_VEC_originloc[locnum])
            
locnum++
        }
    }
    
    
num 0
    
while (num <= g_TotalSpawns)
    {
        
//have we visited all the spawns yet?
        
if (num == g_TotalSpawns)
            break;
        
//get a random spawn
        
random_num(0g_TotalSpawns-1);
        
//have we visited this spawn yet?
        
if (!list[n])
        {
            
//yes, set the flag to true, and inc the number of spawns we've visited
            
list[n] = 1;
            
num++;
        } 
        else 
        {
            
//this was a useless loop, so add to the infinite loop prevention counter
            
total++;
            if (
total 100// don't search forever
                
break;
            continue;   
//don't check again
        
}

        new 
trace  trace_hull(g_SpawnVecs[n],1);
        if (
trace)
            continue;
        
        if (
locnum 1)
        {
            final = 
n
            
break
        }
        
        final = 
n
        
for (0locnumx++)
        {
            new 
Float:distance get_distance_f(g_SpawnVecs[n], loc[x]);
            if (
distance 250.0)
            {
                
//invalidate
                
final = -1;
                break;
            }
        }
        
        if (final != -
1)
            break
    }
    
    if (final != -
1)
    {
        
entity_set_origin(idg_SpawnVecs[final]);
        
entity_set_int(idEV_INT_fixangle1);
        
entity_set_vector(idEV_VEC_anglesg_SpawnAngles[final]);
        
entity_set_vector(idEV_VEC_v_angleg_SpawnVAngles[final]);
        
entity_set_int(idEV_INT_fixangle1);
        
        return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE
 
}
 public 
DeathEvent()
 {
    new 
attacker read_data(1)
    new 
id read_data(2)

    if(
get_pcvar_num(sv_HSR)<1) return PLUGIN_CONTINUE
    
if(1>get_user_team(id)>2) return PLUGIN_CONTINUE

    
switch(get_pcvar_num(sv_HSR))
    {
        case 
2:{
            if(
is_user_connected(attacker)){
                if(
get_user_team(id)==get_user_team(attacker) || id==attacker){
                    
HSRtime[attacker] += get_pcvar_num(sv_HSRtime)
                    if(
HSRtime[attacker] > get_pcvar_num(sv_HSRmaxtime))
                        
HSRtime[attacker] = get_pcvar_float(sv_HSRmaxtime)
                }
            }
        }
        case 
1:{
            if(
is_user_alive(attacker)){
                
HSRtime[attacker] -= get_pcvar_num(sv_HSRtime)
                if(
HSRtime[attacker]<1.0)
                    
HSRtime[attacker] = 1.0
            
}

            
HSRtime[id] += get_pcvar_num(sv_HSRtime)
            if(
HSRtime[id] > get_pcvar_num(sv_HSRmaxtime))
                
HSRtime[id] = get_pcvar_float(sv_HSRmaxtime)
        }
        default: return 
PLUGIN_CONTINUE
    
}

    new 
time floatround(HSRtime[id]) + 1

    
new parm[2]
    
parm[0] = id
    parm
[1] = time

    set_task
(0.1,"check_respawn",0,parm,2)

    return 
PLUGIN_CONTINUE
 
}
 public 
check_respawn(parm[])
 {
    new 
id parm[0]
    
parm[1]--

    if(
is_user_alive(id) || !is_user_zombie(id) )
        return

    if(
parm[1]==0){
        
respawn(id)
    }
    else{
        if(
parm[1]<MAX_SPEAK){
            new 
speak[30]
            
num_to_word(parm[1], speak29)
            
client_cmd(id,"spk ^"fvox/%s^"",speak
        }
        
client_print(idprint_center"You will respawn in %d seconds."parm[1])
        
set_task(1.0,"check_respawn",0,parm,2)
    }
 }
 public 
respawn(id)
 {
    if( 
is_user_alive(id) ||  !is_user_connected(id)) return -1

    
if(is_user_zombie(id) ) {
        new 
parm[2]
        
parm[0] = id
        parm
[1] = 0
        set_task
0.5"actual_revive"1parm2)
        
parm[1] = 1
        set_task
0.7"actual_revive"1parm2)
        return 
1
    
}
    return 
0
 
}
 public 
actual_revive(parm[])
 {
    new 
id parm[0], parm[1]
    
spawn(id)
    if(
a==0)
        
get_user_origin(idSOrigin[id])
    else {
        if(
get_pcvar_num(sv_HSRspawns) > 0)
            
spawn_Preset(id)
        else
            
set_user_origin(idSOrigin[id])
    }
 }


 public 
client_connect(id)
 {
    
HSRtime[id] = get_pcvar_float(sv_HSRtime)
 }
 public 
client_putinserver(id)
 {
    
set_task(1.0,"first_respawn",id)
 }
 public 
first_respawn(id)
 {
    if(!
respawn(id))
        
set_task(1.0,"first_respawn",id)
 }
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
1. Can someone help me to modify this plugin to respawn 1 time only per round?
to control this by a cvar
2. This plugin is using sounds fvox, I want to not use the sounds.

sorry for my bad english
rzvbv is offline
gyda
Member
Join Date: Jul 2016
Location: Iran
Old 09-20-2016 , 06:30   Re: Biohazard Mod respawn
Reply With Quote #2

use this
https://forums.alliedmods.net/showpo...16&postcount=5
cvar : "spawn_time", "2" set number of time that player can respawn in round default 2
__________________
«There exists a field, beyond all notions of right and wrong. I will meet you there»

Last edited by gyda; 09-23-2016 at 05:09.
gyda is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 09-20-2016 , 06:35   Re: Biohazard Mod respawn
Reply With Quote #3

........
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
rzvbv
New Member
Join Date: Sep 2016
Old 09-22-2016 , 04:34   Re: Biohazard Mod respawn
Reply With Quote #4

it not good, I`m using it for biohazard mod and players are not respawned at zombies, I want a plugin when you die you get a respawn only as zombie.
rzvbv is offline
gyda
Member
Join Date: Jul 2016
Location: Iran
Old 09-22-2016 , 15:49   Re: Biohazard Mod respawn
Reply With Quote #5

i am using that plugin in biohazard mod .with that human and zombies can respawn after death
__________________
«There exists a field, beyond all notions of right and wrong. I will meet you there»

Last edited by gyda; 09-23-2016 at 05:09.
gyda is offline
gyda
Member
Join Date: Jul 2016
Location: Iran
Old 09-23-2016 , 00:37   Re: Biohazard Mod respawn
Reply With Quote #6

if you want just zombies can use respawn and only 1 time per round (without sound)
use this

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "Player Respawn"
#define VERSION "1.0"
#define AUTHOR "Someone over the rainbow"

new Time
new g_RespawnCvar
new g_Respawn[33]
new 
g_MaxPlayers

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg""EventDeathMsg""a")
    
Time register_cvar("spawn_delay""3")
    
g_RespawnCvar register_cvar("spawn_time""1")
    
g_MaxPlayers get_maxplayers()
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
}
public 
EventDeathMsg(id)
{    
    new 
cheese read_data(2)
    new 
Floattime get_pcvar_float(Time)
    
g_Respawn[cheese]++
    if(
g_Respawn[cheese] <= get_pcvar_num(g_RespawnCvar))
    {
        
client_print(cheeseprint_chat"You will respawn in %s seconds!"time)
        
set_task(time"Respawn"cheese)
    }
    else
    {
        
client_print(cheeseprint_chat"You are out of respawn!")
    }
}
public 
Event_NewRound()
{
    for(new 
0<= g_MaxPlayersi++)
    
g_Respawn[i] = 0
}
public 
Respawn(id)
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_T:
        {
            
ExecuteHamB(Ham_CS_RoundRespawnid)
        }
    }

CVAR
"spawn_time", "1" set number of time that player can revive in 1 round default 1
__________________
«There exists a field, beyond all notions of right and wrong. I will meet you there»

Last edited by gyda; 09-23-2016 at 00:46.
gyda is offline
rzvbv
New Member
Join Date: Sep 2016
Old 09-23-2016 , 04:01   Re: Biohazard Mod respawn
Reply With Quote #7

Quote:
Originally Posted by gyda View Post
if you want just zombies can use respawn and only 1 time per round (without sound)
use this

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "Player Respawn"
#define VERSION "1.0"
#define AUTHOR "Someone over the rainbow"

new Time
new g_RespawnCvar
new g_Respawn[33]
new 
g_MaxPlayers

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg""EventDeathMsg""a")
    
Time register_cvar("spawn_delay""3")
    
g_RespawnCvar register_cvar("spawn_time""1")
    
g_MaxPlayers get_maxplayers()
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
}
public 
EventDeathMsg(id)
{    
    new 
cheese read_data(2)
    new 
Floattime get_pcvar_float(Time)
    
g_Respawn[cheese]++
    if(
g_Respawn[cheese] <= get_pcvar_num(g_RespawnCvar))
    {
        
client_print(cheeseprint_chat"You will respawn in %s seconds!"time)
        
set_task(time"Respawn"cheese)
    }
    else
    {
        
client_print(cheeseprint_chat"You are out of respawn!")
    }
}
public 
Event_NewRound()
{
    for(new 
0<= g_MaxPlayersi++)
    
g_Respawn[i] = 0
}
public 
Respawn(id)
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_T:
        {
            
ExecuteHamB(Ham_CS_RoundRespawnid)
        }
    }

CVAR
"spawn_time", "1" set number of time that player can revive in 1 round default 1
This is good, but the message it`s not good to appear in chat (You will respawn in %s seconds!)
maybe it`s better to appear in hud!

1.edit: and the message appear only : You will respawn in
seconds doesn`t appear

2.edit: if I die at the end of the round and immediately begins another round during delay the plugin gives me another respawn in new round as CT

Last edited by rzvbv; 09-23-2016 at 04:38.
rzvbv is offline
gyda
Member
Join Date: Jul 2016
Location: Iran
Old 09-23-2016 , 04:48   Re: Biohazard Mod respawn
Reply With Quote #8

use this i set Hud message
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "Player Respawn"
#define VERSION "1.0"
#define AUTHOR "Someone over the rainbow"

new Time
new g_RespawnCvar
new g_Respawn[33]
new 
g_MaxPlayers

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg""EventDeathMsg""a")
    
Time register_cvar("spawn_delay""3")
    
g_RespawnCvar register_cvar("spawn_time""1")
    
g_MaxPlayers get_maxplayers()
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
}
public 
EventDeathMsg(id)
{    
    new 
cheese read_data(2)
    new 
Floattime get_pcvar_float(Time)
    
g_Respawn[cheese]++
    if(
g_Respawn[cheese] <= get_pcvar_num(g_RespawnCvar))
    {
        
set_hudmessage12825500.350.5006.03.0 0.10.2);
        
show_hudmessagecheese,  "[Respawn] You will revive in %f seconds!"time)
        
set_task(time"Respawn"cheese)
    }
    else
    {
        
client_print(cheeseprint_chat"You are out of respawn!")
    }
}
public 
Event_NewRound()
{
    for(new 
0<= g_MaxPlayersi++)
    
g_Respawn[i] = 0
}
public 
Respawn(id)
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_T:
        {
            
ExecuteHamB(Ham_CS_RoundRespawnid)
        }
    }

__________________
«There exists a field, beyond all notions of right and wrong. I will meet you there»

Last edited by gyda; 09-23-2016 at 08:34.
gyda is offline
Old 09-23-2016, 04:56
gyda
This message has been deleted by gyda.
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 09-23-2016 , 07:53   Re: Biohazard Mod respawn
Reply With Quote #9

Héy Gyda you forgot to add %d
PHP Code:
        set_hudmessage12825500.350.5006.03.0 0.10.2);
        
show_hudmessagecheese,  "[Respawn] You will revive"time)
        
set_task(time"Respawn"cheese
To
PHP Code:
        set_hudmessage12825500.350.5006.03.0 0.10.2);
        
show_hudmessagecheese,  "[Respawn] You will revive in %d seconds"time)
        
set_task(time"Respawn"cheese
BTW : numbers just use %d or %f
__________________
Invisible System | 100%
ـــــــــــــــــــــــــــــ
Anti setinfo check | Ez Plugin and lite
ـــــــــــــــــــــــــــــ
[ZP] Free VIP Menu | Free VIP menu | ZP-Mod |

Last edited by Dr Zayd; 09-23-2016 at 07:54.
Dr Zayd is offline
gyda
Member
Join Date: Jul 2016
Location: Iran
Old 09-23-2016 , 08:11   Re: Biohazard Mod respawn
Reply With Quote #10

I was in a hurry
fixed
__________________
«There exists a field, beyond all notions of right and wrong. I will meet you there»
gyda is offline
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 19:33.


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