Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PlayerSetup(tParams)
- {
- local hPlayer = GetPlayerByUserId(tParams.userid);
- // we assign a think function on the player
- hPlayer.GetOrCreatePrivateScriptScope().Think <- function()
- {
- // get ground entity from netprops
- local hEnt = NetProps.GetPropEntity(self,"m_hGroundEntity");
- // if ground entity is a valid npc
- if (hEnt && hEnt.IsNPC() && hEnt.IsAlive())
- {
- // kill npc
- local dmgInfo = CreateDamageInfo(
- self, null, self.GetOrigin(), self.GetOrigin(), 1e10, DMG_CRUSH);
- hEnt.TakeDamage(dmgInfo);
- DestroyDamageInfo(dmgInfo);
- }
- };
- // run think function
- hPlayer.SetThinkFunction("Think", 0.1);
- }
- // create a event that triggers when a players joins
- ListenToGameEvent("player_join_game", PlayerSetup, "YourContext");
Advertisement
Add Comment
Please, Sign In to add comment