Raised This Month: $ Target: $400
 0% 

Remove origins data from file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 09-03-2009 , 09:35   Remove origins data from file
Reply With Quote #1

Example in dust2.cfg file is written this information:
Quote:
1037 2233 65
1272 2234 76
1453 2211 72
1603 2184 80
PHP Code:
new const mod_dir_name[] = "itemorigin";
// In menu
case 2:
{
    new 
entbody
    get_user_aiming
(identbody300)
    
RemoveItemAim(ent)

PHP Code:
public RemoveItemAim(ent)
{
    new 
classname[32]
    
pev(entpev_classnameclassname31)
    if( !
equal(classname"MedItem") )
        return;
    
    new 
Floatorigin[3];
    
pev(entpev_originorigin)
    new 
eorigin[128]
    
    new 
x[8], y[8], z[8]
    if( 
equal(classname"MedItem") ) 
    {
        new 
configsdir[128]
        
get_configsdir(configsdir127)
        
        new 
file[256], CurMap[51]
        
get_mapname(CurMap50)
        
format(file255"%s/%s/%s.cfg"configsdir,mod_dir_nameCurMap)
        
format(eorigin127"%i %i %i"floatround(origin[0]), floatround(origin[1]), floatround(origin[2]))
        new 
fh fopen(file"rt")
        
        if(
fh
        {
            new 
buffer[128]
            new 
counter
        
            
while(!feof(fh)) 
            {
                
fgets(fhbuffer127)
            
                
parse(bufferx7y7z7)
                
format(buffer127"%i %i %i"str_to_num(x), str_to_num(y), str_to_num(z))
            
                if(
equal(buffereorigin)) 
                {
                    
format(buffer127"")
                
                    
write_file(filebuffercounter)
                }
                
                
counter++
            }
            
fclose(fh)
        }
    }
    
    
remove_entity(ent)

Why it won't remove the origins data from file, when aiming, it removes only the entity :/
?
__________________

Last edited by xbatista; 09-03-2009 at 09:38.
xbatista is offline
Send a message via Skype™ to xbatista
 



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 15:13.


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