Raised This Month: $ Target: $400
 0% 

client_putinserver - respawn problem/explanation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xTr3m3r
Member
Join Date: Feb 2010
Old 02-18-2017 , 07:22   client_putinserver - respawn problem/explanation
Reply With Quote #1

Its me again! (apparently)

So Im trying to add a task when a player joins my server to be automatically spawned after a few seconds but it seems that it bugs the whole hidenseek plugin and the plugins on the server doesnt work as supposed as well.

PHP Code:
public client_putinserver(plr)
{
    
g_bConnected[plr] = true;
    
g_bAlive[plr] = false;
    
g_bFirstSpawn[plr] = false;
    
        
set_task(5.0"TaskRespawn"plr); //this is what i added

    
return PLUGIN_CONTINUE;

Can somebody explain why I can't use set_task in client_putinserver and how can I make something similar to this? Thanks!

Last edited by xTr3m3r; 02-18-2017 at 07:24.
xTr3m3r is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-18-2017 , 07:27   Re: client_putinserver - respawn problem/explanation
Reply With Quote #2

We can't help if you don't explain what's wrong.
__________________
edon1337 is offline
xTr3m3r
Member
Join Date: Feb 2010
Old 02-18-2017 , 07:35   Re: client_putinserver - respawn problem/explanation
Reply With Quote #3

It doesnt respawn the player at all and the blocks from the blockmaker im using are just solid and they do nothing. When I remove the set_task everything works just fine. The TaskRespawn is working as supposed because Im using it when a player dies or gets killed so its not from it as you can see below:

PHP Code:
public TaskRespawn(plr)
{
    
// thanks GHW_Chronic & MeRcyLeZZ
    
set_pev(plrpev_deadflagDEAD_RESPAWNABLE);
    
dllfunc(DLLFunc_Thinkplr);

I was just wondering why wouldn't the task spawn the player when he gets put in to my server and how should I do that?
xTr3m3r is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-18-2017 , 07:50   Re: client_putinserver - respawn problem/explanation
Reply With Quote #4

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

#define TASK_RESPAWN 124253
#define TEAM_T      1
#define TEAM_CT    2

#define fm_get_user_team(%1)      ((get_user_team(%1)<0) ? 3:get_user_team(%1))

public client_putinserver(id)
{
       
remove_task(TASK_RESPAWN+id)
       
set_task(5.0"task_respawn"TASK_RESPAWN+id__"b")
}

public 
task_respawn(const taskid)
{
       new 
id taskid TASK_RESPAWN;
       if(!
is_user_connected(id)) remove_task(taskid)
       else if((
1<<fm_get_user_team(id)) & ((1<<TEAM_CT)|(1<<TEAM_T)))
       {
                 
client_cmd(id"joinclass 5");
                 
ExecuteHamB(Ham_CS_RoundRespawnid)
                 
remove_task(taskid)
       }

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-19-2017 at 09:01.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-18-2017 , 08:18   Re: client_putinserver - respawn problem/explanation
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
PHP Code:
#include <hamsandwich>

#define TASK_RESPAWN 124253
#define TEAM_T      1
#define TEAM_CT    2

public client_putinserver(id)
{
       
remove_task(TASK_RESPAWN+id)
       
set_task(5.0"task_respawn"TASK_RESPAWN+id__"b")
}

public 
task_respawn(taskid)
{
       new 
id taskid TASK_RESPAWN;
       if((
1<<get_user_team(id)) & ((1<<TEAM_CT)|(1<<TEAM_T))
       {
                 
client_cmd(id"joinclass 5");
                 
ExecuteHamB(Ham_CS_RoundRespawnid)
                 
remove_task(taskid)
       }

I'd love to see you compiling that. Also you can just use 'id' for the task id.
__________________
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-18-2017 , 08:46   Re: client_putinserver - respawn problem/explanation
Reply With Quote #6

Quote:
Originally Posted by edon1337 View Post
I'd love to see you compiling that. Also you can just use 'id' for the task id.
btw it compiles fine ... it was a sample..

if it dosent compile for you its you problem that youre too stupid to add #include <amxmodx> in the script...
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-18-2017 , 09:20   Re: client_putinserver - respawn problem/explanation
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
youre too stupid to add #include <amxmodx> in the script...
Sherlock, you're so smart you forgot to include the main module. I was pointing that out.
__________________
edon1337 is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 02-18-2017 , 09:22   Re: client_putinserver - respawn problem/explanation
Reply With Quote #8

Quote:
Originally Posted by Natsheh View Post
PHP Code:
#include <amxmodx>
#include <hamsandwich>

#define TASK_RESPAWN 124253
#define TEAM_T      1
#define TEAM_CT    2

public client_putinserver(id)
{
       
remove_task(TASK_RESPAWN+id)
       
set_task(5.0"task_respawn"TASK_RESPAWN+id__"b")
}

public 
task_respawn(const taskid)
{
       new 
id taskid TASK_RESPAWN;
       if((
1<<get_user_team(id)) & ((1<<TEAM_CT)|(1<<TEAM_T))
       {
                 
client_cmd(id"joinclass 5");
                 
ExecuteHamB(Ham_CS_RoundRespawnid)
                 
remove_task(taskid)
       }

Where is remove_task in client_disconnect?
__________________

Last edited by PRoSToTeM@; 02-18-2017 at 09:22.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 02-18-2017 , 09:23   Re: client_putinserver - respawn problem/explanation
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
PHP Code:

       
if((1<<get_user_team(id)) & ((1<<TEAM_CT)|(1<<TEAM_T)) 
why are you overly complicating this? when get_user_team() will return -1 this will have unforeseen consequences whereas a simple (1 <= get_user_team(id) <= 2) will have no problems
jimaway is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-18-2017 , 10:24   Re: client_putinserver - respawn problem/explanation
Reply With Quote #10

Quote:
Originally Posted by PRoSToTeM@ View Post
Where is remove_task in client_disconnect?
no need ... i just edited the code and checked if user isnt connected...

Quote:
Originally Posted by jimaway View Post
why are you overly complicating this? when get_user_team() will return -1 this will have unforeseen consequences whereas a simple (1 <= get_user_team(id) <= 2) will have no problems

youre right, i fixed it by adding fm_get_user_team..
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 21:01.


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