View Single Post
Author Message
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 03-23-2020 , 14:50   [CSGO]Entity not spawning
Reply With Quote #1

I suppose I'm missing something obvious, but the entity doesn't spawn. Any help would be

All I'm trying to do below is spawn an entity and teleport it to the client who called it. The location is correct so I'm assuming my error has to do with the entity itself spawning. Or my return?

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

int g_iEntityIndex;

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_cfire"Command_CreateFire"sm_cfire - Creates fire @ player orig");
}

public 
Action Command_CreateFire(int iClientint Args)
{
    
float f_vCoords[3];
    
GetClientAbsOrigin(iClientf_vCoords);
    
PrintToChatAll("Origin Stored: %f, %f, %f"f_vCoords[0], f_vCoords[1], f_vCoords[2]);

    
g_iEntityIndex CreateEntityByName("env_fire");
    
DispatchKeyValue(g_iEntityIndex"firesize""72");
    
DispatchKeyValue(g_iEntityIndex"duration""15");
    
DispatchKeyValue(g_iEntityIndex"damagescale""0.0"); //Might not work as intended
    
DispatchKeyValue(g_iEntityIndex"LightRadiusScale""1.5");
    
DispatchSpawn(g_iEntityIndex);
    
TeleportEntity(g_iEntityIndexf_vCoordsNULL_VECTORNULL_VECTOR);
    
PrintToChatAll("%i Has Spawned @ %f, %f, %f"g_iEntityIndexf_vCoords[0], f_vCoords[1], f_vCoords[2]);

    return 
Plugin_Handled;

Halt is offline