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

origin of players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 06-27-2007 , 19:06   origin of players
Reply With Quote #1

how can i place a model at both the T's spawn place and a CT's spawn place, no matter what map? thanks
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-27-2007 , 21:55   Re: origin of players
Reply With Quote #2

Hook when entities are spawned, then if it finds an "info_player_start" (CT spawn) and an "info_player_deathmatch" (T spawn), get the origin and use that to spawn one of your models.
hlstriker is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 06-27-2007 , 22:12   Re: origin of players
Reply With Quote #3

Quote:
Originally Posted by hlstriker View Post
Hook when entities are spawned, then if it finds an "info_player_start" (CT spawn) and an "info_player_deathmatch" (T spawn), get the origin and use that to spawn one of your models.
how would i do this?
sorry im newby
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-27-2007 , 22:17   Re: origin of players
Reply With Quote #4

Using this will set a model on every spawn point. If you only want one then make a variable to check if it should spawn more or not.

PHP Code:
public pfn_keyvalue(entId)
{
    new 
ent;
    new 
className[64], keyName[64], value[64];
    
    
copy_keyvalue(className63keyName63value63);
    
    
// Check if its a start
    
if(equali(className"info_player_start") && equali(keyName"origin"))
    {
        
// Make the ct spawn model
        
ent create_entity("info_target");
        
entity_set_string(entEV_SZ_classname"my_classname");
        
entity_set_origin(entvalue); // 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"))
    {
        
// Make the t spawn model
        
ent create_entity("info_target");
        
entity_set_string(entEV_SZ_classname"my_classname");
        
entity_set_origin(entvalue); // 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;

hlstriker is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 06-27-2007 , 23:08   Re: origin of players
Reply With Quote #5

thank you i will test this tonite
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 06-28-2007 , 04:22   Re: origin of players
Reply With Quote #6

yea i got some errors and this is going to turn into a ctf plugin so im gonna need a way to make the flag model stick to a person
here is the code and it got some errors:
Code:
/home/groups/amxmodx/tmp3/textienbE6.sma(30) : error 047: array sizes do not match, or destination array is too small
/home/groups/amxmodx/tmp3/textienbE6.sma(43) : error 047: array sizes do not match, or destination array is too small
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
 
public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
// Add your code here...
}
public 
pfn_keyvalue(entId)
{
    new 
ent;
    new 
className[64], keyName[64], value[64];
 
    
copy_keyvalue(className63keyName63value63);
 
    
// Check if its a start
    
if(equali(className"info_player_start") && equali(keyName"origin"))
    {
        
// Make the ct spawn model
        
ent create_entity("info_target");
        
entity_set_string(entEV_SZ_classname"my_classname");
        
entity_set_origin(entvalue); // 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"))
    {
        
// Make the t spawn model
        
ent create_entity("info_target");
        
entity_set_string(entEV_SZ_classname"my_classname");
        
entity_set_origin(entvalue); // 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;
}
public 
plugin_precache()
 
precache_model("models/barney.mdl"
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
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
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 12:11.


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