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 ent, body
get_user_aiming(id, ent, body, 300)
RemoveItemAim(ent)
}
PHP Code:
public RemoveItemAim(ent)
{
new classname[32]
pev(ent, pev_classname, classname, 31)
if( !equal(classname, "MedItem") )
return;
new Float: origin[3];
pev(ent, pev_origin, origin)
new eorigin[128]
new x[8], y[8], z[8]
if( equal(classname, "MedItem") )
{
new configsdir[128]
get_configsdir(configsdir, 127)
new file[256], CurMap[51]
get_mapname(CurMap, 50)
format(file, 255, "%s/%s/%s.cfg", configsdir,mod_dir_name, CurMap)
format(eorigin, 127, "%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(fh, buffer, 127)
parse(buffer, x, 7, y, 7, z, 7)
format(buffer, 127, "%i %i %i", str_to_num(x), str_to_num(y), str_to_num(z))
if(equal(buffer, eorigin))
{
format(buffer, 127, "")
write_file(file, buffer, counter)
}
counter++
}
fclose(fh)
}
}
remove_entity(ent)
}
Why it won't remove the origins data from file, when aiming, it removes only the entity :/
?
__________________