mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-05 22:43:21 +00:00
Possibly fix weapon spawn crash
This commit is contained in:
parent
a97e151816
commit
3103cf8921
2 changed files with 5 additions and 2 deletions
Binary file not shown.
|
@ -412,7 +412,6 @@ enum struct WallBuilderData {
|
|||
}
|
||||
|
||||
bool PreviewWeapon(const char[] classname) {
|
||||
return false;
|
||||
int entity;
|
||||
// Melee weapons don't have weapon_ prefix
|
||||
this.Reset();
|
||||
|
@ -435,6 +434,7 @@ enum struct WallBuilderData {
|
|||
DispatchKeyValue(entity, "rendercolor", "255 128 255");
|
||||
DispatchKeyValue(entity, "renderamt", "200");
|
||||
DispatchKeyValue(entity, "rendermode", "1");
|
||||
TeleportEntity(entity, this.origin, NULL_VECTOR, NULL_VECTOR);
|
||||
if(!DispatchSpawn(entity)) {
|
||||
PrintToServer("Failed to spawn");
|
||||
return false;
|
||||
|
@ -446,8 +446,10 @@ enum struct WallBuilderData {
|
|||
return IsValidEntity(entity);
|
||||
}
|
||||
|
||||
bool PreviewModel(const char[] model, const char[] classname = "") {
|
||||
bool PreviewModel(int client, const char[] model, const char[] classname = "") {
|
||||
// Check for an invalid model
|
||||
// this.origin is not cleared by this.Reset();
|
||||
GetClientAbsOrigin(client, this.origin);
|
||||
if(StrEqual(classname, "_weapon") || StrEqual(classname, "_melee")) {
|
||||
return this.PreviewWeapon(model);
|
||||
}
|
||||
|
@ -473,6 +475,7 @@ enum struct WallBuilderData {
|
|||
DispatchKeyValue(entity, "rendercolor", "255 128 255");
|
||||
DispatchKeyValue(entity, "renderamt", "200");
|
||||
DispatchKeyValue(entity, "rendermode", "1");
|
||||
TeleportEntity(entity, this.origin, NULL_VECTOR, NULL_VECTOR);
|
||||
if(!DispatchSpawn(entity)) {
|
||||
PrintToServer("Failed to spawn");
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue