More efficient :
PHP Code:
#include <amxmodx>
#include <engine>
#define PLUGIN "Start With MP5"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"
new Trie:g_tPreventEntityKeyvalue;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
}
public plugin_precache()
{
new iEnt;
g_tPreventEntityKeyvalue = TrieCreate();
TrieSetCell(g_tPreventEntityKeyvalue, "player_weaponstrip", 1);
TrieSetCell(g_tPreventEntityKeyvalue, "game_player_equip", 1);
TrieSetCell(g_tPreventEntityKeyvalue, "info_map_parameters", 1);
iEnt = create_entity("player_weaponstrip");
DispatchKeyValue(iEnt, "origin", "99999 99999 99999");
DispatchKeyValue(iEnt, "targetname", "weaponstrip");
DispatchSpawn(iEnt);
iEnt = create_entity("game_player_equip");
DispatchKeyValue(iEnt, "targetname", "player_equip");
DispatchKeyValue(iEnt, "weapon_mp5navy", "1");
DispatchKeyValue(iEnt, "ammo_9mm", "4");
DispatchSpawn(iEnt);
iEnt = create_entity("multi_manager");
DispatchKeyValue(iEnt, "weaponstrip", "0");
DispatchKeyValue(iEnt, "player_equip", "1");
DispatchKeyValue(iEnt, "targetname", "game_playerspawn");
DispatchKeyValue(iEnt, "spawnflags", "1");
DispatchSpawn(iEnt);
iEnt = create_entity("info_map_parameters");
DispatchKeyValue(iEnt, "buying", "3");
DispatchSpawn(iEnt);
}
public pfn_keyvalue( iEnt )
{
new szClassName[32], szCrap[2];
copy_keyvalue(szClassName, charsmax(szClassName), szCrap, charsmax(szCrap), szCrap, charsmax(szCrap));
if( TrieKeyExists(g_tPreventEntityKeyvalue, szClassName) )
{
remove_entity(iEnt);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public plugin_cfg()
{
TrieDestroy(g_tPreventEntityKeyvalue);
set_cvar_float("sv_restart", 1.0);
}
__________________