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

[CSS] Spawn on Connect


Post New Thread Reply   
 
Thread Tools Display Modes
Timtam
Junior Member
Join Date: Aug 2009
Old 01-01-2010 , 00:50   Re: [CSS] Spawn on Connect
Reply With Quote #11

Quote:
Originally Posted by psychonic View Post
The current version of this plugin does nothing at all. There is a timer callback that never gets called because the timer gets created in an event callback for an event that is never hooked.

I think you mean to have this in OnPluginStart()
PHP Code:
HookEvent("player_team"EventJoinTeam); 
PHP Code:
#include <sourcemod>
#include <cstrike>
#define PLUGIN_VERSION "1.1.0"

new Handle:Cvar_SOC_ENABLED INVALID_HANDLE;

public 
Plugin:myinfo 
{
    
name "Respawn on Join",
    
author "Alexander",
    
description "Allows players to respawn when they fist join the server.",
    
version PLUGIN_VERSION,
    
url "http://www.sourcemod.net"
}

public 
OnPluginStart()
{
    
HookEvent("player_team"EventJoinTeam);  
    
CreateConVar("sm_soc_version"PLUGIN_VERSION"Current plugin version"
    
FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
    
Cvar_SOC_ENABLED CreateConVar("sm_soc_enabled""1""Enable/disable plugin 0/1"FCVAR_PLUGIN)
}
public 
OnMapStart()
{
    if (
GetConVarBool(Cvar_SOC_ENABLED)==false) return;
}

public 
EventJoinTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
client == 0)
    {
        return;
    }
    
CreateTimer(1.0SpawnThePlayerclient);
}

public 
Action:SpawnThePlayer(Handle:timerany:client)
{
    new 
team GetClientTeam(client);
    if (!
IsPlayerAlive(client) && (team == || team == 3))
    {
        
CS_RespawnPlayer(client);
    }
    return 
Plugin_Continue;

Like this?
Timtam is offline
Keksmampfer
Junior Member
Join Date: Apr 2009
Old 01-08-2010 , 09:28   Re: [CSS] Spawn on Connect
Reply With Quote #12

hi,

look in my example. I edited some things and reworked your on/off function. I added some commentaries.

mfg Keks
Attached Files
File Type: sp Get Plugin or Get Source (spawnonconnect.sp - 410 views - 2.1 KB)
__________________
My Plugins: Death Sound
Keksmampfer 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 00:21.


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