Raised This Month: $ Target: $400
 0% 

Is this the right way?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 06-26-2012 , 06:27   Is this the right way?
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <hamsandwich>

public plugin_init(){
   
register_plugin("RESPAWN""1.0""Kinnekt")
   
register_event("DeathMsg""hook_death""a")
   
register_clcmd("say /respawn""res")
}

public 
hook_death(){
   new 
victim read_data(2)
   
   if(
get_user_team(victim) == 2)
      
set_task(0.5"res"victim)
}

public 
client_putinserver(id)
{
   if( !
is_user_alive(id) || !(CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT) )
      
set_task(0.5"res"id)
   
   return 
PLUGIN_CONTINUE
}

public 
res(id){
   if(!
is_user_connected(id))
      return 
PLUGIN_HANDLED
   
   ExecuteHamB
(Ham_CS_RoundRespawnid)
   
   return 
PLUGIN_CONTINUE

__________________
We all live under the same sky but we have different horizons.

Last edited by bLacK-bLooD; 06-26-2012 at 07:37.
bLacK-bLooD is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-26-2012 , 07:06   Re: Is this the right way?
Reply With Quote #2

you should add check if player is in a team (you dont want alive spectators running around dont you?)
also instead of client_putinserver hook jointeam command or something like that
jimaway is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 06-26-2012 , 07:37   Re: Is this the right way?
Reply With Quote #3

Better?
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-26-2012 , 07:51   Re: Is this the right way?
Reply With Quote #4

not rly, you still dont check the team in death event, and player will never be in a team in client_putinserver.
put the check just before respawning player and replace client_putinserver with jointeam command hook
jimaway is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-26-2012 , 08:48   Re: Is this the right way?
Reply With Quote #5

It's better to hook the joinclass command.
__________________
<VeCo> is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 06-26-2012 , 08:57   Re: Is this the right way?
Reply With Quote #6

Problem solved.

It should have looked like this :

PHP Code:
#include <amxmodx>
#include <hamsandwich>

public plugin_init(){
   
register_plugin("RESPAWN""1.0""Kinnekt")
   
register_event("DeathMsg""hook_death""a")
   
register_clcmd("say /respawn""cl_cmd")
}

public 
cl_cmd(id) {
   if(
is_user_alive(id)) {
      
client_print(idprint_chat"You must be dead to use this command !")
      return 
PLUGIN_HANDLED
   
}

   
set_task(1.0"res"id)

   return 
PLUGIN_CONTINUE
}

public 
hook_death(){
   new 
victim read_data(2)
   
   
set_task(1.0"res"victim)
}

public 
client_putinserver(id) {
   if(
is_user_alive(id))
      return 
PLUGIN_HANDLED

   set_task
(2.5"res"id)

   return 
PLUGIN_CONTINUE
}

public 
res(id){   
   
ExecuteHamB(Ham_CS_RoundRespawnid)
   
   return 
PLUGIN_CONTINUE

__________________
We all live under the same sky but we have different horizons.

Last edited by bLacK-bLooD; 06-26-2012 at 09:01.
bLacK-bLooD is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-26-2012 , 10:35   Re: Is this the right way?
Reply With Quote #7

and ur still not checking players team... try to connect and join spectator, or just type this in console while in game: kill;jointeam 6
jimaway is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-26-2012 , 10:48   Re: Is this the right way?
Reply With Quote #8

Code:
#include < amxmodx > #include < fakemeta > public plugin_init( )   set_task( 2.0, "TaskCheckForDeadPlayers", .flags = "b" ); public TaskCheckForDeadPlayers( ) {   static iPlayers[ 32 ], iNum, i, cModel[ 32 ], iTeam;   get_players( iPlayers, iNum, "b" );   if( iNum )   {     for( i = 0; i < iNum; i++ )     {       if( pev_valid( iPlayers[ i ] ) == 2 /* Supposed to prevent any crashes */ )       {           iTeam = get_pdata_int( iPlayers[ i ], 114 );           pev( iPlayers[ i ], pev_model, cModel, 31 );           if( iTeam > 0 && iTeam < 3 && ( -1 == containi( cModel, "player.mdl" ) ) /* Makes sure he chosed a model */ )             dllfunc( DLLFunc_Spawn, iPlayers[ i ] );       }     }   } }
__________________

Last edited by claudiuhks; 06-26-2012 at 10:52.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 06-26-2012 , 11:43   Re: Is this the right way?
Reply With Quote #9

Quote:
Originally Posted by jimaway View Post
and ur still not checking players team... try to connect and join spectator, or just type this in console while in game: kill;jointeam 6
I have team manager by exolent. It's no need to check player's team since that plugin is active.

@claudiuhks Again, it's no need to check if a player has chosen a model, because when he connects to the server, he is automatically transfered to CT.

Anyway, thanks for help guys.
__________________
We all live under the same sky but we have different horizons.

Last edited by bLacK-bLooD; 06-26-2012 at 11:44. Reason: misspell
bLacK-bLooD 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 06:17.


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