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

CS_RespawnPlayer Problem :/


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tooti
Member
Join Date: Apr 2012
Location: Germany
Old 06-03-2013 , 15:59   CS_RespawnPlayer Problem :/
Reply With Quote #1

Hey Allied-Modders,
I have a problem with the CS_RespawnPlayer command, the Plugin should respawn a death player when he die's within 10 Seconds but most of the time only the Second player who dies get's Re-spawned but only his "Body" gets Re-spawned, he can only crouch and only he can see his body other people seeing a floating Knife :/
Here is a Picture:
Spoiler


And here is the Code:
Spoiler

Last edited by tooti; 06-03-2013 at 16:00.
tooti is offline
API
Veteran Member
Join Date: May 2006
Old 06-03-2013 , 22:51   Re: CS_RespawnPlayer Problem :/
Reply With Quote #2

If creating a tiny delay (Such as CreateTimer with 0.1) doesn't fix it, then I would suggest disabling other plugins and testing again.
__________________
API is offline
Send a message via AIM to API
tooti
Member
Join Date: Apr 2012
Location: Germany
Old 06-04-2013 , 00:24   Re: CS_RespawnPlayer Problem :/
Reply With Quote #3

Quote:
Originally Posted by pimpinjuice View Post
disabling other plugins and testing again.
Doesn't Work :/
Any other ideas?
tooti is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 06-04-2013 , 00:47   Re: CS_RespawnPlayer Problem :/
Reply With Quote #4

Did you try using a timer, like he said?
bl4nk is offline
exCeeder.
Junior Member
Join Date: May 2013
Location: .
Old 06-04-2013 , 00:51   Re: CS_RespawnPlayer Problem :/
Reply With Quote #5

PHP Code:
CreateTimer(1.0Timer_Respawnclient);

public 
Action:Timer_Respawn(Handle:timerany:client)
{
     
CS_RespawnPlayer(client);

     return 
Plugin_Stop;

__________________
Best regards,
eXceeder
exCeeder. is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 06-04-2013 , 00:56   Re: CS_RespawnPlayer Problem :/
Reply With Quote #6

^ What he said, although you don't need to have a return value for a one-time timer.
bl4nk is offline
exCeeder.
Junior Member
Join Date: May 2013
Location: .
Old 06-04-2013 , 01:05   Re: CS_RespawnPlayer Problem :/
Reply With Quote #7

Stop the timer only if using TIMER_REPEAT ?
__________________
Best regards,
eXceeder
exCeeder. is offline
The End Is Near...
Member
Join Date: Dec 2012
Location: Siberia
Old 06-04-2013 , 02:40   Re: CS_RespawnPlayer Problem :/
Reply With Quote #8

PHP Code:
#include <sourcemod>
#include <cstrike>

new Handle:hTimer INVALID_HANDLE;

new 
iRespawn 0;

public 
OnPluginStart()
{
    
HookEvent("round_start"Event_OnRoundStart);
    
HookEvent("player_death"Event_OnPlayerDeath);
    
HookEvent("round_end"Event_OnRoundEnd);
}

public 
Event_OnRoundStart(Handle:event, const String:name[], bool:silent)
{
    
iRespawn 0;

    
hTimer CreateTimer(10.0Timer_TIMER_FLAG_NO_MAPCHANGE);
}

public 
Event_OnPlayerDeath(Handle:event, const String:name[], bool:silent)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if (
iRespawn == && client && GetClientTeam(client) < && !IsPlayerAlive(client))
    {
        
CS_RespawnPlayer(client);
    }
}

public 
Event_OnRoundEnd(Handle:event, const String:name[], bool:silent)
{
    if (
hTimer != INVALID_HANDLE)
    {
        
KillTimer(hTimer);
        
hTimer INVALID_HANDLE;
    }
}

public 
Action:Timer(Handle:timer)
{
    
iRespawn 1;
    
hTimer INVALID_HANDLE;

v2

Last edited by The End Is Near...; 06-04-2013 at 02:47.
The End Is Near... is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 06-04-2013 , 03:00   Re: CS_RespawnPlayer Problem :/
Reply With Quote #9

Quote:
Originally Posted by exCeeder. View Post
Stop the timer only if using TIMER_REPEAT ?

Yes.
The timer ends (via Plugin_Stop or being a one-time timer that is finished)
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-04-2013 , 04:11   Re: CS_RespawnPlayer Problem :/
Reply With Quote #10

Quote:
Originally Posted by bl4nk View Post
^ What he said, although you don't need to have a return value for a one-time timer.
True, but it's still a good practice since a return type has been declared. Also, if you later go and end the timer logic early (say by checking if a userid is a connected client, which should be done here) failing to return anything at the bottom is suddenly a compiler warning. And last I checked, plugins with compiler warnings don't get approved.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-04-2013 at 04:29.
Powerlord 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 11:27.


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