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

Make weapons not dropable


Post New Thread Reply   
 
Thread Tools Display Modes
Porcellian
Member
Join Date: Oct 2017
Old 09-06-2018 , 06:34   Re: Make weapons not dropable
Reply With Quote #11

Oh yes, I am sorry. It is the gamemode ”murderer”.

The problem is, that if someone drops the revolver on someone, and this ”someone” don’t automatically pickup the gun, then it is the murderer.

I can’t allow that.
Porcellian is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-08-2018 , 17:00   Re: Make weapons not dropable
Reply With Quote #12

Quote:
Originally Posted by Porcellian View Post
Oh yes, I am sorry. It is the gamemode ”murderer”.

The problem is, that if someone drops the revolver on someone, and this ”someone” don’t automatically pickup the gun, then it is the murderer.

I can’t allow that.
I think Garry's Mod? If GM even uses sourcemod... He is asking what game. Like Counter Strike Global Offensive, CS Source, Left 4 Dead 2 ( I already saw a game mode of murderer in L4D2 )
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 09-08-2018 at 17:01.
eyal282 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-09-2018 , 00:31   Re: Make weapons not dropable
Reply With Quote #13

Quote:
Originally Posted by eyal282 View Post
I think Garry's Mod? If GM even uses sourcemod... He is asking what game. Like Counter Strike Global Offensive, CS Source, Left 4 Dead 2 ( I already saw a game mode of murderer in L4D2 )
Exactly. Because, as I recall, the way to prevent it is different for each of CS:GO, CS:S, TF2, and L4D/L4D2.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Santi.
Member
Join Date: Oct 2010
Location: Cordoba(Argentina)
Old 09-10-2018 , 07:07   Re: Make weapons not dropable
Reply With Quote #14

I dont recommend you this:

Code:
public OnPluginStart()
{
for (new i= 1; i<= MaxClients; i++) 
{
if (IsClientInGame(i))
{
SDKHook(i, SDKHook_WeaponDrop, OnWeaponDrop);
}
}
}
Hook the event when the clients connects. And unhook it when clients disconnects.
Santi. is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 09-10-2018 , 10:00   Re: Make weapons not dropable
Reply With Quote #15

Quote:
Originally Posted by Santi. View Post
Hook the event when the clients connects. And unhook it when clients disconnects.
What's the sense in that?

EDIT:

@Ilusion9 showed a great example.

Last edited by mug1wara; 09-10-2018 at 10:00.
mug1wara is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 09-10-2018 , 13:32   Re: Make weapons not dropable
Reply With Quote #16

Quote:
Originally Posted by mug1wara View Post
What's the sense in that?

EDIT:

@Ilusion9 showed a great example.
The sense in doing that is you can hook the event for each client as they join. OnPluginStart() is only called when all the plugins have loaded or when the plugin itself loads late (reloaded/added late/etc.). The way that code has it, the event will only be hooked for the clients that are already connected and ingame, but not the ones who join later.

I usually hook any SDKHook event to clients on OnClientPostAdminCheck().
__________________

Last edited by Psyk0tik; 09-10-2018 at 13:39.
Psyk0tik is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 09-10-2018 , 13:34   Re: Make weapons not dropable
Reply With Quote #17

Quote:
Originally Posted by Santi. View Post
I dont recommend you this:

Code:
public OnPluginStart()
{
for (new i= 1; i<= MaxClients; i++) 
{
if (IsClientInGame(i))
{
SDKHook(i, SDKHook_WeaponDrop, OnWeaponDrop);
}
}
}
Hook the event when the clients connects. And unhook it when clients disconnects.
I was told by Headline (one of the moderators here) that when clients leave, it counts as their entity being deleted. Therefore, you don't need to unhook SDKHook events from them.
__________________
Psyk0tik is offline
Santi.
Member
Join Date: Oct 2010
Location: Cordoba(Argentina)
Old 09-10-2018 , 22:32   Re: Make weapons not dropable
Reply With Quote #18

Quote:
Originally Posted by Crasher_3637 View Post
I was told by Headline (one of the moderators here) that when clients leave, it counts as their entity being deleted. Therefore, you don't need to unhook SDKHook events from them.
Nice, thanks
Santi. is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-11-2018 , 00:14   Re: Make weapons not dropable
Reply With Quote #19

You should hook ingame clients when the plugin starts for late loading.

You should also hook clients as they connect.
__________________
Neuro Toxin is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 09-11-2018 , 02:24   Re: Make weapons not dropable
Reply With Quote #20

Here's an example of how you can hook SDKHook events to clients as they connect and when the plugin loads late.

PHP Code:
bool g_bLateLoad;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    
EngineVersion evEngine GetEngineVersion();
    if (
evEngine != Engine_Left4Dead && evEngine != Engine_Left4Dead2)
    {
        
strcopy(errorerr_max"Super Tanks++ only supports Left 4 Dead 1 & 2.");
        return 
APLRes_SilentFailure;
    }
    
g_bLateLoad late;
    return 
APLRes_Success;
}

public 
void OnMapStart() // You can use OnPluginStart() here if you wish... OnMapStart() is still called right after OnPluginStart() on late loads...
{
    if (
g_bLateLoad)
    {
        for (
int iPlayer 1iPlayer <= MaxClientsiPlayer++)
        {
            if (
bIsValidClient(iPlayer))
            {
                
SDKHook(iPlayerSDKHook_OnTakeDamageOnTakeDamage);
            }
        }
        
g_bLateLoad false;
    }
}

public 
void OnClientPostAdminCheck(int client// You can use OnClientPutInServer(int client) here if you wish...
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);

__________________
Psyk0tik 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 17:21.


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