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

Spawns stock | cfg file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AstRoid
Junior Member
Join Date: May 2020
Location: Cordoba, Argentina
Old 02-16-2021 , 02:09   Spawns stock | cfg file
Reply With Quote #1

I made this stock to loop spawn my npc's using hlsdk as a guide

PHP Code:
stock Stock_ZbsSpawns(const szTargetName[])
{
    new 
iEnt = -1;

    while((
iEnt find_ent_by_tname(iEntszTargetName)) > 0)
    {
        if(
g_SpawnCount >= sizeof g_spawns)
        break;

        
entity_get_vector(iEntEV_VEC_origing_vOriginSp)

        
g_spawns[g_SpawnCount][0] = g_vOriginSp[0];
        
g_spawns[g_SpawnCount][1] = g_vOriginSp[1];
        
g_spawns[g_SpawnCount][2] = g_vOriginSp[2];

        
g_SpawnCount++;
    }

The problem is that's as far as my understanding goes ._.
what I really want to do is to set the spawn coordinates of the npc through a cfg.
like this

PHP Code:
    new szFile128 ], szMap32 ];
    
get_configsdirszFilecharsmaxszFile ) );
    
get_mapnameszMapcharsmaxszMap ) );
    
    
formatszFilecharsmaxszFile ), "%s/csdm/%s.spawns.cfg"szFileszMap ); 
thank you very much for your response

Last edited by AstRoid; 02-16-2021 at 02:11.
AstRoid is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-16-2021 , 23:31   Re: Spawns stock | cfg file
Reply With Quote #2

Here is a quick example that is done correctly (many examples/plugins use feof() as a condition which is not correct). You can use parse() in the loop on szLine to get your three parameters.

If you have issues, wlease provide the code that you wrote to read the file so that we can help you fix it.
__________________

Last edited by fysiks; 02-16-2021 at 23:34.
fysiks 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 14:16.


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