Raised This Month: $32 Target: $400
 8% 

[CS:GO] Crash after giving weapon_healthshot


Post New Thread Reply   
 
Thread Tools Display Modes
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 06-17-2021 , 14:35   Re: [CS:GO] Crash after giving weapon_healthshot
Reply With Quote #11

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

public void OnClientPutInServer(int clientIndex)
{
    
SDKHook(clientIndexSDKHook_SpawnPostOnPlayerSpawnPost);
}

public 
void OnPlayerSpawnPost(int playerIndex)
{
    if (
IsPlayerAlive(playerIndex))
    {
        
// Will be launched 2 times at the first player spawn - don't care for this test
        
CreateTimer(5.0OnPlayerSpawnPost5SecondsGetClientSerial(playerIndex));
    }
}

public 
Action OnPlayerSpawnPost5Seconds(Handle timerint playerSerial)
{
    
int playerIndex GetClientFromSerial(playerSerial);
    
    
// Could be more secure - don't care for this test
    
if (<= playerIndex <= MaxClients)
    {
        
GivePlayerItem(playerIndex"weapon_healthshot");
    }
    
    return 
Plugin_Continue;

It works as expected, no crash (15 respawns done, with some time between them).
Server command: +game_type 0 +game_mode 0

If it doesn't work for you, there's maybe another plugin interfering with the one giving healthshots (Or the same one, depends of what it does more).
__________________

Last edited by micapat; 06-17-2021 at 14:36.
micapat is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 06-20-2021 , 13:19   Re: [CS:GO] Crash after giving weapon_healthshot
Reply With Quote #12

Thanks for your version, I checked it and the server still randomly crashes.

I created a plugin which sets all m_hMyWeapons slots with weapons which are about to be deleted to null. It doesn't solve serial number reusing problem, but at least the server doesn't crash anymore.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Reply


Thread Tools
Display Modes

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 06:49.


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