Raised This Month: $51 Target: $400
 12% 

Make weapons not dropable


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-11-2018 , 03:04   Re: Make weapons not dropable
Reply With Quote #21

Thread completely derailed.

1. Just loop clients OnPluginStart. Clients will only be in game if the plugin late loaded. OnMapStart calls every map change and the connect/disconnect events are called around it, so OnMapStart is not the right choice.

2. Hook clients in OnClientPutInServer. Before OnClientPutInServer is called IsClientInGame returns false. IsClientInGame returns true during and after OnClientPutInServer. Hooking OnClientPostAdminCheck has a delay from OnClientPutInServer, therefore you might have unexpected results between OnClientPutInServer and OnClientPostAdminCheck when not hooking at OnClientPutInServer.

So during OnPluginStart if IsClientInGame they are already hooked. If !IsClientInGame call OnClientPutInServer yourself so you call the same code.

Example.

Code:
public void OnPluginStart()
{
	for (int client = 1; client <= MaxClients; client++)
	{
		if (!IsClientInGame(client))
			continue;

		OnClientPutInServer(client);
	}
}

public void OnClientPutInServer(int client)
{
	SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamage);
}

public void OnClientDisconnect(int client)
{
	SDKUnhook(client, SDKHook_OnTakeDamageAlive, OnTakeDamage);
}
__________________

Last edited by Neuro Toxin; 09-11-2018 at 03:05.
Neuro Toxin is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 09-11-2018 , 03:23   Re: Make weapons not dropable
Reply With Quote #22

Yeah let's stop the derailment here. Great input though!
__________________
Psyk0tik is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-11-2018 , 12:49   Re: Make weapons not dropable
Reply With Quote #23

Quote:
Originally Posted by Porcellian View Post
Sorry, I don't know how to do all this. I am new to this. Can someone help me a bit with the piece of code?
This is the Scripting category, not Plugin Requests.
make a thread here https://forums.alliedmods.net/forumdisplay.php?f=60
Ilusion9 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 23:07.


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