Raised This Month: $62 Target: $400
 15% 

Solved Help with removing items


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Laurens
Junior Member
Join Date: Apr 2018
Old 01-11-2019 , 17:04   Help with removing items
Reply With Quote #1

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.

Last edited by Laurens; 01-11-2019 at 17:23.
Laurens is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 01-11-2019 , 17:13   Re: Help with removing items
Reply With Quote #2

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);

__________________
Maxximou5 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-11-2019 , 17:14   Re: Help with removing items
Reply With Quote #3

Weapon loadouts are applied after players respawn. Try hooking post_inventory_application instead.
__________________
Am I back? Well, we'll see.
Powerlord is offline
Laurens
Junior Member
Join Date: Apr 2018
Old 01-11-2019 , 17:22   Re: Help with removing items
Reply With Quote #4

Thank you guys so much for your help!
It works now!
Laurens is offline
Laurens
Junior Member
Join Date: Apr 2018
Old 01-11-2019 , 17:25   Re: Help with removing items
Reply With Quote #5

How can you add a melee weapon to a client?
Laurens is offline
Laurens
Junior Member
Join Date: Apr 2018
Old 01-11-2019 , 18:06   Re: Help with removing items
Reply With Quote #6

Quote:
Originally Posted by Laurens View Post
How can you add a melee weapon to a client?
Nevermind, I've already figured it out.
Laurens is offline
Reply


Thread Tools
Display Modes

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 06:39.


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