AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Faster Shooting on class (https://forums.alliedmods.net/showthread.php?t=204240)

F0RCE 12-28-2012 20:08

Faster Shooting on class
 
Hello, I have a problem with this plugin :

PHP Code:

/*================================================================================
    
    ----------------------------------
    -*- [ZP] Class: Human: FastShoot -*-
    ----------------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/


#include <amxmodx>
#include <zp50_class_human>
#include <zp50_core>
#include <fakemeta_util>

// Raptor Human Attributes
new const humanclass2_name[] = "Engineer"
new const humanclass2_info[] = "Shoot faster with every weapon"
new const humanclass2_models[][] = { "leet" }
const 
humanclass2_health 75
const Float:humanclass2_speed 1.0
const Float:humanclass2_gravity 1.2

new g_HumanClassID


public plugin_init()
{

    
register_event("CurWeapon","eventCurWeapon""b")
}

public 
eventCurWeapon(id)
{
        if(!
is_user_connected(id) && !is_user_alive(id)  && zp_core_is_zombie(id) &&  zp_class_human_get_current(id) != g_HumanClassID)
                return 
PLUGIN_CONTINUE
                
        
static Float:fSpeedMultiplier 0.8;
                
        new 
szWeaponName[64];
        
get_weaponname(read_data(2), szWeaponName63)
        
        new 
iEnt fm_find_ent_by_owner(-1szWeaponNameid)
        
        
set_pdata_floatiEnt46, ( get_pdata_float(iEnt464) * fSpeedMultiplier), );
        
set_pdata_floatiEnt47, ( get_pdata_float(iEnt474) * fSpeedMultiplier), );
        
        return 
PLUGIN_CONTINUE
}


public 
plugin_precache()
{
    
register_plugin("[ZP] Klasa Ludzi: Specjalista"ZP_VERSION_STRING"ZP Dev Team")
    
    
g_HumanClassID zp_class_human_register(humanclass2_name,  humanclass2_infohumanclass2_healthhumanclass2_speed,  humanclass2_gravity)
    new 
index
    
for (index 0index sizeof humanclass2_modelsindex++)
        
zp_class_human_register_model(g_HumanClassIDhumanclass2_models[index])


It throws errors all the time, and the server crash :

PHP Code:

L 12/26/2012 22:55:54Invalid weapon id 0
L 12
/26/2012 22:55:54: [AMXXDisplaying debug trace (plugin "zp_klasa_szybkostrzelny.amxx")
L 12/26/2012 22:55:54: [AMXXRun time error 10native error (native "get_weaponname")
L 12/26/2012 22:55:54: [AMXX]    [0zp_klasa_szybkostrzelny.sma::eventCurWeapon (line 50

I have created this human class myself, but can't fix it atm :P
Thanks for help.

LAMMPARD8_PRO 12-28-2012 20:31

Re: Faster Shooting on class
 
from amxmodx.inc the native get_weaponname return u error. go to plugins-zplague.ini and add debug after the plugin's name. (e.g zp_humanclass_enginer.amxx debug)
also your ?changing weapon? function is interasting maded o.o

LAMMPARD8_PRO 12-28-2012 20:38

Re: Faster Shooting on class
 
PHP Code:

get_weaponname(read_data(2), szWeaponName63)
//should be something like:
get_weaponname (CSW_AK47weaponidlen)
//the function get the weapon ak47 in that case and return u the copyed weapon lenght. 


F0RCE 12-29-2012 06:25

Re: Faster Shooting on class
 
Isn't there any easy way to set the speed of shooting with weapon?

LAMMPARD8_PRO 12-29-2012 06:55

Re: Faster Shooting on class
 
ohmmwell.. w/o the speed hack .... i gues sooo...
u can make script that adds speed for 1 of the existing weapons..

u can use something like:

PHP Code:

        new    Ent get_weapon_ent(idweapon)    
        new 
Float:Speed
        
if(Ent)
            {
            
Speed 1.1
            
new Float:Delay get_pdata_floatEnt464) * Speed    
            
if (Delay 0.0){
                
set_pdata_floatEnt46Delay4)
}




All times are GMT -4. The time now is 13:41.

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