Raised This Month: $ Target: $400
 0% 

HELP! Drop Weapon and PickUp Weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
McD0n3ld
Junior Member
Join Date: Feb 2011
Old 02-11-2011 , 09:49   HELP! Drop Weapon and PickUp Weapon
Reply With Quote #1

Hello everyone,
I am new here, I do not have any idea of scripting, but I have been modyfing plugins (so I know very few things).

My problem is when doing a plugin that requires the following:

When I drop my c4, it explodes and it has to dissapear. Any idea?

I've been looking for it in this forum but with no success. If you could please help me...

Thanks and sorry for my bad english ;)
McD0n3ld is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-11-2011 , 11:03   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #2

This must be a really popular request... yes, I've made this already. So has at least one other server. Expect something released soon.

As far as scripting it, you just need to use the sdk hooks and look for when a player drops a weapon.
__________________
databomb is offline
McD0n3ld
Junior Member
Join Date: Feb 2011
Old 02-11-2011 , 11:22   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #3

Thanks.

Now, how do I compile it?
at http://www.sourcemod.net/compiler.php gives me this error:

fatal error 120: cannot read from file: "sdkhooks"
McD0n3ld is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-11-2011 , 12:15   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #4

Look at the SM Hosties plugin and search for SDKHook, I believe dataviruset already has the code for doing something like that published.
__________________
databomb is offline
McD0n3ld
Junior Member
Join Date: Feb 2011
Old 02-11-2011 , 12:41   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #5

Yes, It's done, but for a deagle, not for a C4. I should modify it and recompile it, but we still have the same problem
McD0n3ld is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-11-2011 , 12:45   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #6

post your code; it'd be helpful to see what it's getting stuck on.
__________________
databomb is offline
McD0n3ld
Junior Member
Join Date: Feb 2011
Old 02-11-2011 , 13:01   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #7

I've got a piece of code of sm_hosties:
Code:
public Action:OnWeaponDrop(client, weapon)
{
    PrintToChat(client, "\x04 [HellsAngels] %T", "Expensive", client, 2);
    if (AllowWeaponDrop == false)
        return Plugin_Handled;

    if (player_drop[client] == 1)
    {
        decl String:weapon_name[32];
        GetEdictClassname(weapon, weapon_name, sizeof(weapon_name));
        if (StrEqual(weapon_name, "weapon_c4"))
        {
                PrintToChat(client, "\x04 [HellsAngels] %T", "Expensive", client, 2);
                return Plugin_Handled;
        }
    }

    return Plugin_Continue;
}
Libraries incuded:
Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
As I told, I do not know how this work, so since I copied it, I think it should work. The only problem is when compiling, that sourcemod's website compiler doesn't recognize sdkhooks library.

Thanks for help,
McD0n3ld
McD0n3ld is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 02-11-2011 , 13:24   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #8

Compile it locally, look for spcomp.exe in scripting dir.
__________________
FaTony is offline
McD0n3ld
Junior Member
Join Date: Feb 2011
Old 02-11-2011 , 13:48   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #9

Quote:
Originally Posted by FaTony View Post
Compile it locally, look for spcomp.exe in scripting dir.
Thanks!

now the problem is right in SDKHook. Should I install anything? more libraries..?
Code:
public OnClientPutInServer(client)
{
    SDKHook(client, SDKHook_WeaponDrop, OnWeaponDrop); //<---
    player_bomb_type[client] = 0;
    player_bomb_time_left[client] = -1;
}
McD0n3ld is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 02-11-2011 , 13:56   Re: HELP! Drop Weapon and PickUp Weapon
Reply With Quote #10

Nope, should be good with includes now.

Try starting from here again:
Code:
public Action:OnWeaponDrop(client, weapon)
{
        decl String:weapon_name[32];
        GetEdictClassname(weapon, weapon_name, sizeof(weapon_name));
        if (StrEqual(weapon_name, "weapon_c4"))
        {

        }

    return Plugin_Continue;
}
From there you can explode right there or do some more checks. Look at NatalyaAF's Suicide Bomb script for a good explode stock example.
__________________
databomb 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 08:20.


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