(adsbygoogle = window.adsbygoogle || []).push({});
Ok so i know this may be common sense to some people, but i know that it definately is not for everyone. Also this can probably be found around the forums but im going to put it all together.
So this is useful for finding Entity Models and also finding Entity Numbers. So say you are making a gamemode that requires a little bit of extra space. Where like say you have this parking lot that you want to use, however, there are a bunch of cars in the way. This will let you delete all of those cars automatically from Init or where ever you want to call it from, rather than using a forge function to delete them manually.
TraceModel()
{
self endon("disconnect");
self endon("death");
for(;
{
if(self adsButtonPressed() && self actionslotonebuttonpressed())
{
trace = bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*1000000,true,self);
self iPrintln("Model: ^2" + trace["entity"].model);
self iPrintln("Number: ^5" + trace["entity"] getEntityNumber());
wait 0.2;
}
wait 0.05;
}
}
DeleteByModel(Model)
{
ents = getEntArray();
for ( index = 0; index < ents.size; index++ )
{
if(isSubStr(ents[index].model, Model))
ents[index] delete();
}
}
DeleteByNumber(Number)
{
ents = getEntArray();
for ( index = 0; index < ents.size; index++ )
{
if(ents[index] getEntityNumber() == Number)
ents[index] delete();
}
}
So first what you want to do is use the TraceModel function to get the entities Number and Model. Not all entities will have a model that will show up, but most will have a number. Once you go up to the car or whatever you want to remove, you press Ads and Dpad Up. This will print the Model and Number on screen. Then you can delete by your choice. If there are multiple ents with the same model you want to remove, you can use the DeleteByModel.
init()
{
level thread onPlayerConnect();
level thread DeleteByModel("ENTER MODEL NAME HERE");
}
This would them remove all the entities from the map with that Model Name
If you want to remove something where the model does not show up, or only a specific ent, you can use the DeleteByNumber.
init()
{
level thread onPlayerConnect();
level thread DeleteByNumber(ENTITY NUMBER HERE);
}
This is just a quicker and easier way for game mode makers and others to remove stuff from the map.
**NOTE**
Even after removing some cars/ents from the map, sometimes it will leave an invisible barrier, I am not sure how to remove that.
Also, You can use "trace["entity"].classname" for some things as well. This would return like "script_model" or "script_brushmodel", so you can figure out what you can do with that on your own.