View Single Post
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-28-2007 , 12:15   Re: origin of players
Reply With Quote #7

I tested this and it works. Barney models are spawned on every player spawn Also, since you seem to be making flag models then I would manually set them if I were you. This way you can put them exactly where you want.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
 
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
plugin_precache()
 
precache_model("models/barney.mdl");

public 
pfn_keyvalue(entId)
{
    new 
ent;
    new 
className[64], keyName[64], value[64];
    new 
Float:origin[3], explodeOut[4][32];
    
    
copy_keyvalue(className63keyName63value63);
    
    
// Check if its a start
    
if(equali(className"info_player_start") && equali(keyName"origin"))
    {
        
// Get the 3 values to the origin
        
ExplodeString(explodeOut331value' ');
        
origin[0] = str_to_float(explodeOut[0]);
        
origin[1] = str_to_float(explodeOut[1]);
        
origin[2] = str_to_float(explodeOut[2]);
        
        
// Make the ct spawn model
        
ent create_entity("info_target");
        
entity_set_string(entEV_SZ_classname"my_classname");
        
entity_set_origin(entorigin); // set the entity to the origin of the spawn
        
entity_set_int(entEV_INT_solidSOLID_NOT); // setting this to bbox will cause the spawning player to get stuck
        
entity_set_int(entEV_INT_movetypeMOVETYPE_FLY);
        
entity_set_model(ent"models/barney.mdl"); // set the model here, remember to precache it
        
entity_set_size(entFloat:{-1.0,-1.0,-1.0}, Float:{1.0,1.0,1.0});
    }
 
    
// Check if its a deathmatch
    
if(equali(className"info_player_deathmatch") && equali(keyName"origin"))
    {
        
// Get the 3 values to the origin
        
ExplodeString(explodeOut331value' ');
        
origin[0] = str_to_float(explodeOut[0]);
        
origin[1] = str_to_float(explodeOut[1]);
        
origin[2] = str_to_float(explodeOut[2]);
        
        
// Make the t spawn model
        
ent create_entity("info_target");
        
entity_set_string(entEV_SZ_classname"my_classname");
        
entity_set_origin(entorigin); // set the entity to the origin of the spawn
        
entity_set_int(entEV_INT_solidSOLID_NOT); // setting this to bbox will cause the spawning player to get stuck
        
entity_set_int(entEV_INT_movetypeMOVETYPE_FLY);
        
entity_set_model(ent"models/barney.mdl"); // set the model here, remember to precache it
        
entity_set_size(entFloat:{-1.0,-1.0,-1.0}, Float:{1.0,1.0,1.0});
    }
    
    return 
PLUGIN_CONTINUE;
}

stock ExplodeStringp_szOutput[][], p_nMaxp_nSizep_szInput[], p_szDelimiter )
{
    new 
nIdx 0strlen(p_szInput)
    new 
nLen = (copycp_szOutput[nIdx], p_nSizep_szInputp_szDelimiter ))
    while( (
nLen l) && (++nIdx p_nMax) )
        
nLen += (copycp_szOutput[nIdx], p_nSizep_szInput[nLen], p_szDelimiter ))
    return


Last edited by hlstriker; 06-28-2007 at 12:18.
hlstriker is offline