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
Code:
#include <sdktools>
public OnPluginStart()
{
LoadTranslations("common.phrases");
RegConsoleCmd("sm_weaponstrip", weaponstrip);
}
public Action:weaponstrip(client, args)
{
new String:arg[MAX_NAME_LENGTH];
GetCmdArg(1, arg, sizeof(arg));
new targets[MaxClients];
new bool:tn_is_ml;
new numtargets = ProcessTargetString(arg, client, targets, MaxClients, 0, arg, sizeof(arg), tn_is_ml);
if(numtargets <= COMMAND_TARGET_NONE)
{
ReplyToTargetError(client, COMMAND_TARGET_NONE);
return Plugin_Handled;
}
perform_weaponstrip(client, targets, numtargets);
return Plugin_Handled;
}
PHP Code:
perform_weaponstrip(client, targets[], 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 i = 0; i < numtargets; i++) { 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
+ Let's say, less gamedata file and offsets finding