Raised This Month: $12 Target: $400
 3% 

[CS:GO] Spawning weapons in maps


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
popey456963
Member
Join Date: Mar 2016
Old 05-04-2018 , 22:41   [CS:GO] Spawning weapons in maps
Reply With Quote #1

Hello, I'm currently trying to spawn guns at specified locations within the map. To do this, when the plugin is loaded I precache all weapon models I've found and then use a "SpawnGun()" function to try to spawn it when needed. The function definition is:

Code:
public Action SpawnGun(char[] entityName, char[] entityMode, float[3] pos) {
  float angle[3];
  angle[1] = GetRandomFloat(0.0, 360.0);

  int entIndex = CreateEntityByName(entityName);
  SetEntityModel(entIndex, entityMode);
  DispatchSpawn(entIndex);
  ActivateEntity(entIndex);
  TeleportEntity(entIndex, pos, angle, NULL_VECTOR);
}
This code works wonderfully well when called with something like `SpawnGun("prop_physics", "models/weapons/w_rif_ak47_dropped.mdl", some_pos);`. A weapon spawns with a random orientation. This being a physics prop though, cannot be picked up. Instead, I believe you're meant to use `weapon_ak47` to spawn, for instance, an AK47. When I run `SpawnGun("weapon_ak47", "models/weapons/w_rif_ak47_dropped.mdl", some_pos);` the server crashes (https://crash.limetech.org/OVOCKVAOTL2M).

The crash log appears to show that it's because I'm misconfiguring the entity, I'm wondering what I'm missing?

Last edited by popey456963; 05-04-2018 at 22:51.
popey456963 is offline
popey456963
Member
Join Date: Mar 2016
Old 05-06-2018 , 18:00   Re: [CS:GO] Spawning weapons in maps
Reply With Quote #2

It appears as if this is an issue relating to Linux / my server in particular, the exact same plugins & plugin configurations work on a Windows installation I made.
popey456963 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:01.


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