AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   How do I server command every time a player respawns?? (https://forums.alliedmods.net/showthread.php?t=318758)

walabulu4 09-18-2019 18:19

How do I server command every time a player respawns??
 
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

8guawong 09-18-2019 20:51

Re: How do I server command every time a player respawns??
 
Quote:

Originally Posted by walabulu4 (Post 2667497)
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

walabulu4 09-18-2019 21:47

Re: How do I server command every time a player respawns??
 
Quote:

Originally Posted by 8guawong (Post 2667505)

So I can put something like

PHP Code:

    HookEvent ("player_spawn",myFunction()); 

in my OnPluginStart? myFunction() would run the serverCommand function.

walabulu4 09-19-2019 01:28

Re: How do I server command every time a player respawns??
 
Never mind I got it! thank you very much!!!

Powerlord 09-19-2019 17:04

Re: How do I server command every time a player respawns??
 
You may want to look into the post_inventory_application event, which is fired every time the game refreshes a player's loadout.

walabulu4 09-19-2019 17:17

Re: How do I server command every time a player respawns??
 
Quote:

Originally Posted by Powerlord (Post 2667622)
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!


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

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