ExtraCommands: Fix GivePlayerItem on CS:GO.
Giving certain weapons that used to exist on CS:S to players on CS:GO, causes the server to crash. Good shit volvo :^)
This commit is contained in:
parent
d1395ffd42
commit
a7e88cdeab
@ -412,7 +412,7 @@ public Action Command_Weapon(int client, int argc)
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < iTargetCount; i++)
|
for(int i = 0; i < iTargetCount; i++)
|
||||||
{
|
{
|
||||||
int ent = GivePlayerItem(iTargets[i], sWeapon);
|
int ent = GivePlayerItemFixed(iTargets[i], sWeapon);
|
||||||
|
|
||||||
if(ent == -1) {
|
if(ent == -1) {
|
||||||
ReplyToCommand(client, "[SM] Invalid Weapon");
|
ReplyToCommand(client, "[SM] Invalid Weapon");
|
||||||
@ -1348,3 +1348,30 @@ stock any clamp(any input, any min, any max)
|
|||||||
|
|
||||||
return retval > max ? max : retval;
|
return retval > max ? max : retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock int GivePlayerItemFixed(int client, const char[] item)
|
||||||
|
{
|
||||||
|
static bool bEngineVersionIsCSGO;
|
||||||
|
|
||||||
|
// These weapons 'exist' on csgo, but attempting to give them causes a crash.
|
||||||
|
if (bEngineVersionIsCSGO || GetEngineVersion() == Engine_CSGO)
|
||||||
|
{
|
||||||
|
bEngineVersionIsCSGO = true;
|
||||||
|
|
||||||
|
if (StrEqual(item, "weapon_galil", false) ||
|
||||||
|
StrEqual(item, "weapon_m3", false) ||
|
||||||
|
StrEqual(item, "weapon_mp5navy", false) ||
|
||||||
|
StrEqual(item, "weapon_p228", false) ||
|
||||||
|
StrEqual(item, "weapon_scout", false) ||
|
||||||
|
StrEqual(item, "weapon_sg550", false) ||
|
||||||
|
StrEqual(item, "weapon_sg552", false) ||
|
||||||
|
StrEqual(item, "weapon_tmp", false) ||
|
||||||
|
StrEqual(item, "weapon_usp", false))
|
||||||
|
{
|
||||||
|
LogError("Prevented giving ent: %s", item);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GivePlayerItem(client, item);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user