View Single Post
Author Message
Kusber
New Member
Join Date: Oct 2020
Old 10-16-2020 , 10:38   [L4D2] Get Ghost Spawntime
Reply With Quote #1

Hello all,

I'm new in Sourcemod Scripting so I'm sorry for this noob question.

I'm trying to get the ghost spawntime and excute some code if clients spawntime is under 4 seconds.

Here is my code:

PHP Code:
#include <sourcemod>

#define TEAM_INFECTED    3

public onPluginStart()
{
    
HookEvent("ghost_spawn_time",event_ghost_spawn_timeEventHookMode_Post); 
}

public 
event_ghost_spawn_time(Handle:event, const String:name[], bool:dontBroadcast)
{
    
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
    new 
spawntime GetEventFloat(event,"spawntime");
    if (
IsHumanPlayer(client) && IsPlayerGhost && GetClientTeam(client) == && spawntime 4)
    {
        
// DoSomeThing
    
}

But that isn't working. ;'(
Kusber is offline