Raised This Month: $32 Target: $400
 8% 

How do I server command every time a player respawns??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
walabulu4
Junior Member
Join Date: Sep 2019
Old 09-18-2019 , 18:19   How do I server command every time a player respawns??
Reply With Quote #1

I am making a team fortress 2 server with custom weapons. I want to give every player that respawns the new weapon by running the server command for giveitem on them. I was wondering if there was a way to go about doing this? I know a liiitle bit of sourcepawn (I did the tutorial) so thats an option for me if it is necisarry

Last edited by walabulu4; 09-18-2019 at 19:29.
walabulu4 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 09-18-2019 , 20:51   Re: How do I server command every time a player respawns??
Reply With Quote #2

Quote:
Originally Posted by walabulu4 View Post
I am making a team fortress 2 server with custom weapons. I want to give every player that respawns the new weapon by running the server command for giveitem on them. I was wondering if there was a way to go about doing this? I know a liiitle bit of sourcepawn (I did the tutorial) so thats an option for me if it is necisarry
use https://sm.alliedmods.net/new-api/events/HookEvent on player_spawn (does this exist in tf2?)
then use https://sm.alliedmods.net/new-api/console/ServerCommand in callback
__________________
8guawong is offline
walabulu4
Junior Member
Join Date: Sep 2019
Old 09-18-2019 , 21:47   Re: How do I server command every time a player respawns??
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
So I can put something like

PHP Code:
    HookEvent ("player_spawn",myFunction()); 
in my OnPluginStart? myFunction() would run the serverCommand function.

Last edited by walabulu4; 09-18-2019 at 21:48.
walabulu4 is offline
walabulu4
Junior Member
Join Date: Sep 2019
Old 09-19-2019 , 01:28   Re: How do I server command every time a player respawns??
Reply With Quote #4

Never mind I got it! thank you very much!!!
walabulu4 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-19-2019 , 17:04   Re: How do I server command every time a player respawns??
Reply With Quote #5

You may want to look into the post_inventory_application event, which is fired every time the game refreshes a player's loadout.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-19-2019 at 17:04.
Powerlord is offline
walabulu4
Junior Member
Join Date: Sep 2019
Old 09-19-2019 , 17:17   Re: How do I server command every time a player respawns??
Reply With Quote #6

Quote:
Originally Posted by Powerlord View Post
You may want to look into the post_inventory_application event, which is fired every time the game refreshes a player's loadout.
Oh wow thats perfect, I didn't know that page existed. Gonna play with sourcemod more. Thank you!
walabulu4 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:44.


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