AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   drop weapon damage- crash to desktop (https://forums.alliedmods.net/showthread.php?t=19816)

noob cannon lol 10-26-2005 00:34

drop weapon damage- crash to desktop
 
Whenever I try to use this plugin I always crash to the desktop with no error log and no indication of what is wrong.

Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>

#define PLUGIN "ZP Weapon Drop Damage"
#define VERSION "1.0"
#define AUTHOR "noob cannon lol"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_clcmd("drop","handle_drop");
}

public handle_drop(id) {
        new targetid, body
        if (get_user_aiming(id, targetid, body) <= 100.0)
        {
                if(is_valid_ent(targetid) && is_user_connected(targetid))
                {
                        if(is_user_alive(targetid))
                        {
                                emit_sound(targetid, CHAN_WEAPON, "sound/punch.wav", 1.5, ATTN_NORM, 0, PITCH_NORM );
                                set_user_health(targetid, get_user_health(targetid) - 20)
                        }
                }
        }
        return PLUGIN_CONTINUE
}

Perhaps someone knows the error in this?

XxAvalanchexX 10-26-2005 01:30

Volume can't be less than 0.1 (0.0 maybe?) or more than 1.0

Hawk552 10-26-2005 07:23

He never precached the sound:

Code:
emit_sound(targetid, CHAN_WEAPON, "sound/punch.wav", 1.5, ATTN_NORM, 0, PITCH_NORM );

Add this function:

Code:
public plugin_precache() {     precache_sound("punch.wav") }

Also I think you should remove sound/ from emit_sound, I'm pretty sure it already assumes you're in the sound dir.

XxAvalanchexX 10-26-2005 15:14

What he said as well, but I'm pretty darn sure volume can't be over 1.0 and I needed to tell someone.

noob cannon lol 10-26-2005 21:05

Tried both and still doesn't work.

Charr 10-26-2005 22:46

What size is the sound file?

noob cannon lol 10-26-2005 23:02

11.4 kb

Charr 10-26-2005 23:04

I've had sound problems in the past, and Im pretty sure your file is too big.


All times are GMT -4. The time now is 23:36.

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