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

Send Impulse 101 command to all players?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MultiplayerX
Junior Member
Join Date: Sep 2018
Location: USA
Old 09-16-2022 , 16:00   Send Impulse 101 command to all players?
Reply With Quote #1

I was wondering is there a way to admin command the impulse 101 cheat to all players SERVER SIDE? Example: We want to use ALL WEAPONS in HL2 and I can just TURN THEM ON from the admin side to server side? Has to be a way to do this because you can use other things like adjust time speed etc

Thanks!
MultiplayerX is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-18-2022 , 21:02   Re: Send Impulse 101 command to all players?
Reply With Quote #2

This is replica of impulse 101
- like in original, if this cheat is executed while player is dead, player spawn next with all weapons.

This give "all weapons" to all players
Code:
sm_impulse 101
PHP Code:
enum
{
    
AR2 1,
    
AR2AltFire,
    
Pistol,
    
SMG1,
    
_357,
    
XBowBolt,
    
Buckshot,
    
RPG_Round,
    
SMG1_Grenade,
    
Grenade,
    
slam
}

int pMaxCarry[] = {
    
0,
    
60,
    
3,
    
150,
    
225,
    
12,
    
10,
    
30,
    
3,
    
3,
    
5,
    
5
}

#include <sdktools>

StringMap lateweapons;

public 
void OnPluginStart()
{
    
lateweapons = new StringMap();

    
RegAdminCmd("sm_impulse"impulseADMFLAG_CHEATS);
    
HookEvent("player_spawn"player_spawn);
}

public 
void player_spawn(Event event, const char[] namebool dontBroadcast)
{
    
CreateTimer(0.5spawn_delayevent.GetInt("userid"), TIMER_FLAG_NO_MAPCHANGE);
}

public 
Action spawn_delay(Handle timerint userid)
{
    
int client GetClientOfUserId(userid);

    if(!
client || !IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Handled;

    
char key[30];
    
Format(keysizeof(key), "%i"GetClientUserId(client));

    
bool value false;

    if(
lateweapons.GetValue(keyvalue) && value)
    {
        
lateweapons.Remove(key);
        
GiveAllItems(client);
    }

    return 
Plugin_Handled;
}

public 
Action impulse(int clientint args)
{
    
//if(!client || !IsClientInGame(client) || !IsPlayerAlive(client))
    //    return Plugin_Handled;

    
char buffer[5];
    
GetCmdArgString(buffersizeof(buffer));

    
int num StringToInt(buffer);

    switch(
num)
    {
        case 
101:
        {
            
char key[30];

            for(
int i 1<= MaxClientsi++)
            {
                if(!
IsClientInGame(i))
                    continue;

                if(!
IsPlayerAlive(i))
                {
                    
Format(keysizeof(key), "%i"GetClientUserId(i));
                    
lateweapons.SetValue(keytruetrue);
                    continue;
                }

                
GiveAllItems(i);
            }
        }
    }
    return 
Plugin_Handled;
}

void GiveAllItems(int i)
{

    if(
HasEntProp(iProp_Send"m_bWearingSuit"))
        
SetEntProp(iProp_Send"m_bWearingSuit"true);

    
GiveAmmo(i255Pistol);
    
GiveAmmo(i255AR2);
    
GiveAmmo(i005AR2AltFire);
    
GiveAmmo(i255SMG1);
    
GiveAmmo(i255Buckshot);
    
GiveAmmo(i001SMG1_Grenade);
    
GiveAmmo(i003RPG_Round);
    
GiveAmmo(i005Grenade);
    
GiveAmmo(i032_357);
    
GiveAmmo(i002slam);

    
GivePlayerItem(i"weapon_crowbar" );
    
GivePlayerItem(i"weapon_stunstick" );
    
GivePlayerItem(i"weapon_pistol" );
    
GivePlayerItem(i"weapon_357" );
    
GivePlayerItem(i"weapon_smg1" );
    
GivePlayerItem(i"weapon_ar2" );
    
GivePlayerItem(i"weapon_shotgun" );
    
GivePlayerItem(i"weapon_frag" );
    
GivePlayerItem(i"weapon_crossbow" );
    
GivePlayerItem(i"weapon_rpg" );
    
GivePlayerItem(i"weapon_slam" );
    
GivePlayerItem(i"weapon_physcannon" );
}

void GiveAmmo(int clientint ammoint ammotype)
{
    
// skip cvars, max ammo
    
int ammoalready GetEntProp(clientProp_Send"m_iAmmo"_ammotype);

    if(
ammoalready ammo pMaxCarry[ammotype])
    {
        
SetEntProp(clientProp_Send"m_iAmmo"pMaxCarry[ammotype], _ammotype);
        return;
    }

    
SetEntProp(clientProp_Send"m_iAmmo"ammoalready ammo_ammotype);

__________________
Do not Private Message @me
Bacardi is offline
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 18:22.


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