AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Help with removing items (https://forums.alliedmods.net/showthread.php?t=313494)

Laurens 01-11-2019 17:04

Help with removing items
 
Hello, this is my code:
PHP Code:

public void OnPluginStart() 
{
  
    
HookEvent("player_spawn"Event_PlayerSpawn); 

}
public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast){
    
    
int id event.GetInt("userid");
    
TF2_RemoveAllWeapons(id);
    


But when I join the game it does nothing.

Maxximou5 01-11-2019 17:13

Re: Help with removing items
 
You're missing the includes and you're not getting the index after the userid.

PHP Code:

#include <sourcemod>
#include <sdkhooks>
#include <tf2_stocks>

public void OnPluginStart() 
{
    
HookEvent("player_spawn"Event_PlayerSpawn); 
}
public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
TF2_RemoveAllWeapons(client);



Powerlord 01-11-2019 17:14

Re: Help with removing items
 
Weapon loadouts are applied after players respawn. Try hooking post_inventory_application instead.

Laurens 01-11-2019 17:22

Re: Help with removing items
 
Thank you guys so much for your help!
It works now!

Laurens 01-11-2019 17:25

Re: Help with removing items
 
How can you add a melee weapon to a client?

Laurens 01-11-2019 18:06

Re: Help with removing items
 
Quote:

Originally Posted by Laurens (Post 2634219)
How can you add a melee weapon to a client?

Nevermind, I've already figured it out.


All times are GMT -4. The time now is 12:20.

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