AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] CurrentWep Drop...crashes server. (https://forums.alliedmods.net/showthread.php?t=55707)

bwgrubbs1 05-28-2007 03:31

[SOLVED] CurrentWep Drop...crashes server.
 
OK...I made this plugin, and for some reason my server keeps crashing...

I am new to coding and just learning this stuff......SOOOO

go easy on me...lol :)

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "GunGlitch"
#define VERSION "1.0"
#define AUTHOR "bwgrubbs1"

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("CurWeapon","DROP_IT","b","1=1")
}

public DROP_IT(id)
{
    new wclip, wammo
    new team = get_user_team(id)
    new weapon = get_user_weapon(id, wclip, wammo)
    {
        if(weapon == CSW_USP || weapon == CSW_GLOCK18)
        {
            client_cmd(id, "drop")
            client_print(id, print_chat, "[ Weapons ] You were FORCED to drop your Pistol !")
        }
        if(team == 1 && weapon == CSW_KNIFE)
        {
            strip_user_weapons(id)
            client_print(id, print_chat, "[ Weapons ] You were FORCED to drop your Knife !")
        }
    }
}

The main idea of this plugin is so that if anyone joins the server late...after a few things have already taken place...this is to prevent a glitch with the gun.

Those of you familiar with Hide N Seek know what I am talking about.

Anyone ?

bwgrubbs1 05-28-2007 14:01

Re: CurrentWep Drop...crashes server.
 
Anyone have any ideas ? PLZ

Cheap_Suit 05-28-2007 14:05

Re: CurrentWep Drop...crashes server.
 
Try adding the flag e to make sure the player is alive.
PHP Code:

register_event("CurWeapon","DROP_IT","be","1=1"

Or do a set_task in client_putinserver.

PHP Code:

public client_putintserver(id)
{
  
set_task(20.0"DROP_IT"id)



bwgrubbs1 05-28-2007 14:28

Re: CurrentWep Drop...crashes server.
 
ok, i will test this

bwgrubbs1 05-28-2007 14:37

Re: CurrentWep Drop...crashes server.
 
ok i tried both different ideas and each of them together and all three ways seem to crash the server on end of round.

regalis 05-28-2007 14:52

Re: CurrentWep Drop...crashes server.
 
Are you sure that this script is crashing the server?
Because it looks correct...
Maybe try to hook playerspawn(http://forums.alliedmods.net/showthread.php?t=42159)
and strip the weapons when the player spawns...with a little delay (set_task)!?

greetz regalis

bwgrubbs1 05-28-2007 18:26

Re: CurrentWep Drop...crashes server.
 
I like the fact that you say my code looks correct, it makes me feel all warm and fuzzy inside...lol :) I will check other plugins. Thank you.

Cheap_Suit 05-29-2007 11:08

Re: CurrentWep Drop...crashes server.
 
1 Attachment(s)
try this one

bwgrubbs1 05-29-2007 14:56

Re: CurrentWep Drop...crashes server.
 
Perfect man, simply perfect !


All times are GMT -4. The time now is 10:42.

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