Does anyone have any example code of how to fire a projectile? I can spawn the bradley cannonshell prefab which works fine, but I want to be able to fire any ammo type. I can do the stuff in BaseProjectile.CreateProjectileEffectClientside() to do the client side tracer and impact effects for any ammo type, but I haven't figured out how to actually fire the projectile on the server. I tried BasePlayer.NoteFiredProjectile(), but it didn't seem to do anything. It looks like I'll have to Instantiate a BaseProjectile and call CLProject with an RPC message? I'm also not sure how projectileID is generated on the client. I guess I can look at the client DLLs.
Firing projectiles via plugin?
So after looking at the code for a while I realized the short answer is you can't. It looks like the client actually simulates the player fired projectiles, checks for hits, and notifies the server if it hit something, then the server verifies if the projectile should have hit what the client said it did and does stuff, to prevent cheating. The long anwer is that there's nothing stopping you from sending the client effect, then simulating the projectile on the server yourself, checking for hits, and dealing damage etc. That turned out to not be so hard and worked really well.
The code I've been messing around with: https://github.com/a-downing/uModTestStuff/blob/master/Gunship.cs
https://www.youtube.com/watch?v=Hibw5WI0jpM
The code I've been messing around with: https://github.com/a-downing/uModTestStuff/blob/master/Gunship.cs
https://www.youtube.com/watch?v=Hibw5WI0jpM