• How to tell who spawned a prop
    8 replies, posted
I'm making an an AntiSpam addon and I'm implementing a feature that shows who spawned a prop. I was wondering how I can get what player spawned the prop the admin/other player is looking at?
Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnedProp]SANDBOX/PlayerSpawnedProp[/url] to get the player. And [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetEyeTrace]Player:GetEyeTrace[/url] to get what the player is looking at.
[QUOTE=Kevlon;49430152]Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnedProp]SANDBOX/PlayerSpawnedProp[/url] to get the player. And [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetEyeTrace]Player:GetEyeTrace[/url] to get what the player is looking at.[/QUOTE] I'm pretty sure that's only for sandbox, I need a solution for any gamemode that allows prop spawning.
[QUOTE=MexicanR;49430240]I'm pretty sure that's only for sandbox, I need a solution for any gamemode that allows prop spawning.[/QUOTE] Just because it's a SANDBOX hook doesn't mean It's only on sandbox. If the gamemode has a spawnmenu (or uses gm_spawn) it will call that hook.
[QUOTE=Kevlon;49430292]Just because it's a SANDBOX hook doesn't mean It's only on sandbox. If the gamemode has a spawnmenu (or uses gm_spawn) it will call that hook.[/QUOTE] The hook is only available in Sandbox or Sandbox derived gamemodes. Most gamemodes have a variable set on props that store the owner, if yours doesn't then you'll have to find the spawn code for props in your gamemode and add in your own system to store it.
[QUOTE=MexicanR;49430141]I'm making an an AntiSpam addon and I'm implementing a feature that shows who spawned a prop. I was wondering how I can get what player spawned the prop the admin/other player is looking at?[/QUOTE] [IMG]http://i.imgur.com/fWpIfDE.jpg?1[/IMG]
[QUOTE=bigdogmat;49431152]The hook is only available in Sandbox or Sandbox derived gamemodes. Most gamemodes have a variable set on props that store the owner, if yours doesn't then you'll have to find the spawn code for props in your gamemode and add in your own system to store it.[/QUOTE] How do I grab that variable? Let's say I'm in DarkRP
[QUOTE=MexicanR;49431502]How do I grab that variable? Let's say I'm in DarkRP[/QUOTE] DarkRP uses Falco Prop Protection and I believe the function for that is CPPIGetOwner [QUOTE=bigdogmat;49431152]The hook is only available in Sandbox or Sandbox derived gamemodes. Most gamemodes have a variable set on props that store the owner, if yours doesn't then you'll have to find the spawn code for props in your gamemode and add in your own system to store it.[/QUOTE] DarkRP is Sandbox derived... Those functions work fine in DarkRP
[QUOTE=TheTechPony;49431535]DarkRP uses Falco Prop Protection and I believe the function for that is CPPIGetOwner DarkRP is Sandbox derived... Those functions work fine in DarkRP[/QUOTE] Thanks for your help.
Sorry, you need to Log In to post a reply to this thread.