Raised This Month: $ Target: $400
 0% 

origin of players


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

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 #2

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 21:34.


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