Hiya,
I'm looking for the entity name for the chinook for use in OnEntitySpawned:
Anyone know?Code:if (entity is BaseHelicopter) { string serverEvent = "huey";} else if (entity is BradleyAPC) { string serverEvent = "bradley";}
Thanks in advance.
Event entity names...?
Discussion in 'Rust Development' started by Rebajas, Jun 7, 2018.
-
You can check by partical name
Ex:
Code:if (entity.shirtname.Contains"ch.47") // AFK, code can be wrong { bla bla bla }
Code:if (entity is BaseHelicopter) { string serverEvent = "huey";} else if (entity is BradleyAPC) { string serverEvent = "bradley";}
Code:if (entity is BaseHelicopter) { //Magic return; }if (entity is BradleyAPC) { //Magic return; }if (entity is <chinook class?>) { //Magic return; }
But i think switch on shortnames will be better?Last edited by a moderator: Jun 7, 2018 -
Code:
void OnEntitySpawned(BaseEntity entity) { if (entity is BaseHelicopterVehicle) Puts("Gets called once"); if (entity is CH47Helicopter) Puts("Gets called once"); if (entity.name.Contains("ch47.entity")) Puts("Gets called once"); if (entity.name.Contains("ch47")) Puts("Gets called twice"); }
-
Thanks, I'll play about with what's here and see if I can get my code working
-
-