AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Using player_weaponstrip entity for disarm players (https://forums.alliedmods.net/showthread.php?t=231625)

Bacardi 12-17-2013 09:17

Using player_weaponstrip entity for disarm players
 
!topic Using player_speedmod entity to players
-----------------------------------------


:bee:
player_weaponstrip
cmds:
Strip
StripWeaponsAndSuit


Quick example:
- Creates temporary entity = player_weaponstrip
- Targetname !caller in entity ouput "OnUser1", are targets who fire that input "FireUser1"
- Using client indexs to fire entity input "FireUser1"

- Not necessary need add activators in others AcceptEntityInput... just into firing input.

rest of plugin codes

PHP Code:

perform_weaponstrip(clienttargets[], numtargets)
{
    new 
player_weaponstrip CreateEntityByName("player_weaponstrip");

    if(
player_weaponstrip MaxClients)
    {
        
// In this enity output "OnUser1",
        // a !caller is entity which fire this entity input "FireUser1"
        
SetVariantString("OnUser1 !caller,Strip,,0.1,-1");
        
AcceptEntityInput(player_weaponstrip"AddOutput"player_weaponstrip);

        
// Entity kill itself in under second
        
SetVariantString("OnUser2 !self,Kill,,0.2,-1");
        
AcceptEntityInput(player_weaponstrip"AddOutput"player_weaponstrip);
        
AcceptEntityInput(player_weaponstrip"FireUser2"player_weaponstrip);

        
// In this loop,
        // I fire entity player_weaponstrip input "FireUser1",
        // using my targets as a !caller.
        
for(new 0numtargetsi++)
        {
            
AcceptEntityInput(player_weaponstrip"FireUser1"targets[i], client);
        }
    }


- Have tested in Counter Strike:Source,
maybe works in other games what support this entity.
You can test by open the game, set sv_cheats 1 and load map, type in console input:
ent_info player_weaponstrip
you should get output list in your console.

+ Using this you avoid gamedata files + searching rigth offsets, you know what I mean :wink:
+ Let's say, less gamedata file and offsets finding :P

pride95 03-07-2018 17:08

Re: Using player_weaponstrip entity for disarm players
 
PHP Code:


stock void RemoveWeapons
()
{
    
int Strip CreateEntityByName("player_weaponstrip");
    
    for(
int Client 1Client <= MaxClientsClient++)
    {
        if(
IsClientInGame(Client))
        {    
            if(
GetClientTeam(Client) > CS_TEAM_SPECTATOR)
            {
                
AcceptEntityInput(Strip"strip"Client);
            }
        }
    }
    
    
AcceptEntityInput(Strip"kill");


tested in CS:GO. This removes all weapons from all players.

Mitchell 03-07-2018 17:10

Re: Using player_weaponstrip entity for disarm players
 
player_weaponstrip has been obsolete for several years now... especially in cs:go use game_player_equip

pride95 03-07-2018 17:50

Re: Using player_weaponstrip entity for disarm players
 
Quote:

Originally Posted by Mitchell (Post 2581853)
player_weaponstrip has been obsolete for several years now... especially in cs:go use game_player_equip

PHP Code:

    int Strip CreateEntityByName("game_player_equip");
    
DispatchKeyValue(Strip"spawnflags""2");
    
AcceptEntityInput(Strip"TriggerForAllPlayers");
    
AcceptEntityInput(Strip"kill"); 

done.


All times are GMT -4. The time now is 14:27.

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