AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Remove origins data from file (https://forums.alliedmods.net/showthread.php?t=102506)

xbatista 09-03-2009 09:35

Remove origins data from file
 
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 :/
?

xPaw 09-03-2009 10:05

Re: Remove origins data from file
 
Just because it doesnt equal ?xD

xbatista 09-03-2009 10:07

Re: Remove origins data from file
 
:mrgreen: what?
I don't understand ,show me correct example :{}

Jon 09-03-2009 10:15

Re: Remove origins data from file
 
What are you trying to do? Remove entities and saved which ones are removed to a file?

xbatista 09-03-2009 10:20

Re: Remove origins data from file
 
Quote:

Remove entities and saved which ones are removed to a file?
Yes , removing aimed entity and aimed entitie's origins from file, which was saved.
And it won't delete aimed entitie's origins data from file.

xPaw: Yes it doesn't ,but I don't understand why ? :/

xbatista 09-03-2009 14:15

Re: Remove origins data from file
 
Problem was when I'm creating entity :/
PHP Code:

entity_set_int(item_entEV_INT_movetypeMOVETYPE_TOSS)
drop_to_floor(item_ent

That was a problem, cuz it drops to floor and entity is in unknown place, how to fix that MOVETYPE_TOSS problem?

I need to set it somehow, without gravity + it must be on the floor

Exolent[jNr] 09-03-2009 15:02

Re: Remove origins data from file
 
Try using drop_to_floor( ) without setting the movetype.

xbatista 09-04-2009 02:40

Re: Remove origins data from file
 
It won't drop to floor without MOVETYPE_TOSS

xPaw 09-04-2009 07:16

Re: Remove origins data from file
 
Quote:

Originally Posted by xbatista (Post 922479)
It won't drop to floor without MOVETYPE_TOSS

Yes it will

xbatista 09-04-2009 07:29

Re: Remove origins data from file
 
Quote:

Yes it will
Not it not, I've just set entitie's origin on where am I standing and it just floats on the air(also player stuck on that ent origin)...

PHP Code:

// Create entity
new Origin[3]
get_user_origin(idOrigin0)
Create_Items(Origin)

// Function
Create_Items(Origin[3])
{
    new 
Float:flOrigin[3]
    
IVecFVec(OriginflOrigin)
    
//    new Float:fGlowColors[3] = {255.0, 0.0, 20.0}
    
new item_ent create_entity("info_target")
    if(
pev_valid(item_ent))
    {
        
entity_set_string(item_entEV_SZ_classname"Item")
                
        
entity_set_int(item_entEV_INT_solidSOLID_BBOX)
        
entity_set_int(item_entEV_ENT_owner0)
//        entity_set_int(item_ent, EV_INT_renderfx, kRenderFxGlowShell)
//        entity_set_vector(item_ent, EV_VEC_rendercolor, fGlowColors)

        
drop_to_floor(item_ent)
        
entity_set_vector(item_entEV_VEC_originflOrigin)
        
        
entity_set_model(item_entg_w_item)
        
entity_set_size(item_entFloat:{-2.5, -2.5, -1.5}, Float:{2.52.51.5})

    }




All times are GMT -4. The time now is 15:13.

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