mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 05:03: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) {
|
bool PreviewWeapon(const char[] classname) {
|
||||||
return false;
|
|
||||||
int entity;
|
int entity;
|
||||||
// Melee weapons don't have weapon_ prefix
|
// Melee weapons don't have weapon_ prefix
|
||||||
this.Reset();
|
this.Reset();
|
||||||
|
@ -435,6 +434,7 @@ enum struct WallBuilderData {
|
||||||
DispatchKeyValue(entity, "rendercolor", "255 128 255");
|
DispatchKeyValue(entity, "rendercolor", "255 128 255");
|
||||||
DispatchKeyValue(entity, "renderamt", "200");
|
DispatchKeyValue(entity, "renderamt", "200");
|
||||||
DispatchKeyValue(entity, "rendermode", "1");
|
DispatchKeyValue(entity, "rendermode", "1");
|
||||||
|
TeleportEntity(entity, this.origin, NULL_VECTOR, NULL_VECTOR);
|
||||||
if(!DispatchSpawn(entity)) {
|
if(!DispatchSpawn(entity)) {
|
||||||
PrintToServer("Failed to spawn");
|
PrintToServer("Failed to spawn");
|
||||||
return false;
|
return false;
|
||||||
|
@ -446,8 +446,10 @@ enum struct WallBuilderData {
|
||||||
return IsValidEntity(entity);
|
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
|
// Check for an invalid model
|
||||||
|
// this.origin is not cleared by this.Reset();
|
||||||
|
GetClientAbsOrigin(client, this.origin);
|
||||||
if(StrEqual(classname, "_weapon") || StrEqual(classname, "_melee")) {
|
if(StrEqual(classname, "_weapon") || StrEqual(classname, "_melee")) {
|
||||||
return this.PreviewWeapon(model);
|
return this.PreviewWeapon(model);
|
||||||
}
|
}
|
||||||
|
@ -473,6 +475,7 @@ enum struct WallBuilderData {
|
||||||
DispatchKeyValue(entity, "rendercolor", "255 128 255");
|
DispatchKeyValue(entity, "rendercolor", "255 128 255");
|
||||||
DispatchKeyValue(entity, "renderamt", "200");
|
DispatchKeyValue(entity, "renderamt", "200");
|
||||||
DispatchKeyValue(entity, "rendermode", "1");
|
DispatchKeyValue(entity, "rendermode", "1");
|
||||||
|
TeleportEntity(entity, this.origin, NULL_VECTOR, NULL_VECTOR);
|
||||||
if(!DispatchSpawn(entity)) {
|
if(!DispatchSpawn(entity)) {
|
||||||
PrintToServer("Failed to spawn");
|
PrintToServer("Failed to spawn");
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue