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

flags spawn error ? (jctf)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-10-2017 , 02:58   flags spawn error ? (jctf)
Reply With Quote #1

Hi Guys !
I have try to replaced the flags classname :
old classname found :
PHP Code:
new iFindSpawn find_ent_by_class(-1iFlagTeam == TEAM_BLUE "info_player_start" "info_player_deathmatch"
to ==>
new classname found :
PHP Code:
new iFindSpawn find_ent_by_class(-1iFlagTeam == TEAM_BLUE "item_flag_team1" "item_flag_team2"
but i get this error :
Quote:
L 12/10/2017 - 075:59: Start of error session.
L 12/10/2017 - 075:59: Info (map "agctf_duff") (file "addons/amxmodx/logs/error_20171210.log")
L 12/10/2017 - 075:59: [ENGINE] Invalid entity 107
L 12/10/2017 - 075:59: [AMXX] Displaying debug trace (plugin "new_jctf.amxx")
L 12/10/2017 - 075:59: [AMXX] Run time error 10: native error (native "entity_get_vector")
L 12/10/2017 - 075:59: [AMXX] [0] new_jctf.sma::flag_spawn (line 381)
L 12/10/2017 - 075:59: [AMXX] [1] new_jctf.sma::plugin_cfg (line 360)
Knowing this classname exist in the map (and othere maps to ! ) //CTF maps compatibility hack
Quote:
{
"origin" "0 -2984 66"
"classname" "item_flag_team1"
}
{
"origin" "0 2984 66"
"classname" "item_flag_team2"
}
PHP Code:
public flag_spawn(iFlagTeam)
{
    if(
g_fFlagBase[iFlagTeam][x] == 0.0 && g_fFlagBase[iFlagTeam][y] == 0.0 && g_fFlagBase[iFlagTeam][z] == 0.0)
    {
        new 
iFindSpawn find_ent_by_class(g_iMaxPlayersiFlagTeam == TEAM_BLUE "item_flag_team1" "item_flag_team2")

        if(
iFindSpawn)
        {
            
entity_get_vector(iFindSpawnEV_VEC_origing_fFlagBase[iFlagTeam])//[AMXX] Run time error 10: native error (native "entity_get_vector")
            
server_print("[CTF] %s flag origin not defined, set on player spawn."g_szTeamName[iFlagTeam])
        }
        else
        {
            
server_print("[CTF] WARNING: player spawn for ^"%s^" team does not exist !"g_szTeamName[iFlagTeam])
            
log_error(AMX_ERR_NOTFOUND"[CTF] WARNING: player spawn for ^"%s^" team does not exist !"g_szTeamName[iFlagTeam])
            
set_fail_state("Player spawn unexistent!")

            return 
PLUGIN_CONTINUE
        
}
    }
    
entity_set_origin(entg_fFlagBase[iFlagTeam]) 
__________________

Last edited by abdobiskra; 12-10-2017 at 03:00.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
E1_531G
Senior Member
Join Date: Dec 2017
Old 12-10-2017 , 10:09   Re: flags spawn error ? (jctf)
Reply With Quote #2

Quote:
[ENGINE] Invalid entity 107
Check if entity si valid:
Quote:
if( pev_valid(iFindSpawn) )
__________________
My English is A0
E1_531G is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-10-2017 , 11:18   Re: flags spawn error ? (jctf)
Reply With Quote #3

Thanks for the alert but it still does not work .

The flags can spawn in just one point. (i think in info_player_start)
__________________

Last edited by abdobiskra; 12-10-2017 at 11:24.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-10-2017 , 11:22   Re: flags spawn error ? (jctf)
Reply With Quote #4

What game is this for?
klippy is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-10-2017 , 11:51   Re: flags spawn error ? (jctf)
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
What game is this for?
hl1 > mini ag mod > (ctf mod)
__________________

Last edited by abdobiskra; 12-10-2017 at 11:56.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-20-2017 , 12:32   Re: flags spawn error ? (jctf)
Reply With Quote #6

look its can be done using forward pfn_keyvalue
PHP Code:
public pfn_keyvalue(entid)
{
   new 
szClassName[32], szKeyName[32], szValue[32]
   
copy_keyvalue(szClassName31szKeyName31szValue31)

   if(
equal(szClassNameENT_CLASSNAME) && equal(szKeyName"origin"))
   {
      new 
ent create_entity("info_target")
      
DispatchKeyValue(ent,"classname"ENT_CLASSNAME)
      
DispatchKeyValue(ent,"origin"szValue)
      
entity_set_model(entENT_MODEL)
      
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS)   
   }

The question is how can I pickout the coordinates & classname from it ?

what i try :
PHP Code:
enum
{
    
TEAM_NONE 0,
    
TEAM_RED,
    
TEAM_BLUE,
    
TEAM_SPEC
}

new 
g_iFlagEntity[3]
new 
g_iFlagHolder[3]
new 
Float:g_fFlagBase[3][3]

new 
ent

public plugin_init()
{
    
    
flag_spawn(TEAM_BLUE);// = 
    
flag_spawn(TEAM_RED);

}

public 
pfn_keyvalue(entid)
{
    
    new 
szClassName[32], szKeyName[32], szValue[33]
    
    
copy_keyvalue(szClassName31szKeyName31szValue32)
    
    if((
equal(szClassName"item_flag_team2") || equal(szClassName"item_flag_team1"))  && equal(szKeyName"origin"))
    {
        
        
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target")) 
        
        
DispatchKeyValue(ent,"origin"szValue)
        
DispatchKeyValue(ent,"classname"szClassName)
    }
}

public 
flag_spawn(iFlagTeam)
{
 
    
    if(
iFlagTeam == TEAM_BLUE){
        
        
entity_set_string(entEV_SZ_classname"item_flag_team1")
        
entity_get_vector(entEV_VEC_origing_fFlagBase[iFlagTeam])

    }else{
        
        
entity_set_string(entEV_SZ_classname"item_flag_team2")
        
entity_get_vector(entEV_VEC_origing_fFlagBase[iFlagTeam])
    }
        
    
entity_set_model(entFLAG_MODEL)

    
entity_set_int(entEV_INT_skiniFlagTeam == TEAM_BLUE TEAM_RED TEAM_BLUE)// flag has 2 skins

    
DispatchSpawn(ent)
        
    
entity_set_origin(entg_fFlagBase[iFlagTeam])

    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS)
    
entity_set_int(entEV_INT_solidSOLID_TRIGGER)
    

    
g_iFlagEntity[iFlagTeam] = ent
    g_iFlagHolder
[iFlagTeam] = FLAG_HOLD_BASE

but only one flag can spawn in "item_flag_team2"
Where can it be wrong?
__________________

Last edited by abdobiskra; 12-20-2017 at 12:54.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
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 03:27.


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