Raised This Month: $32 Target: $400
 8% 

Solved [HELP] Bug scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ms.itry
Member
Join Date: Apr 2018
Old 04-21-2018 , 16:02   [HELP] Bug scripting
Reply With Quote #1

i want to fix that scripting please if enyone know how help me please
this scripting for last human has (2jump,ultimate,hp,speed)
bug is repete every kill
scripting
PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <Colorchat>

#pragma tabsize 0

new szName[33],g_speed[33]

new 
jumpnum[33] = 0;
new 
bool:dojump[33] = false;
new 
g_multijumps[33] = 0;


#if cellbits == 32
const OFFSET_CLIPAMMO 51
#else
const OFFSET_CLIPAMMO 65
#endif
const OFFSET_LINUX_WEAPONS 4

// Max Clip for weapons
new const MAXCLIP[] = { -113, -11017, -1303013020253035251220,
            
10301008303020273030, -150 }

new 
g_has_unlimited_clip[33]
/*------------------------- plugin_init ----------------------------*/

public plugin_init( )
{
         
register_plugin"Last Survivor""1.0""EaGle" )
         
register_event"DeathMsg""EventDeath""a" )
    
    
register_forward(FM_PlayerPreThink"FW_PlayerPreThinkz")
    
register_forward(FM_PlayerPostThink"FW_PlayerPostThinkz")
        
    
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
register_event("CurWeapon""change_weapon""be""1=1")
    
RegisterHam(Ham_Spawn"player""spawn_off"1)

}

/*------------------------- Last Survivor ----------------------------*/

public EventDeath( )
{
new 
Players32 ]
new 
iNum

get_players
PlayersiNum"ae""CT" )

if( 
iNum == )
{
for (new 
0iNumi++)
{
get_user_name(Players[i], szName32)
    
set_user_health(Players[i], 500)
set_user_maxspeed(Players[i], get_user_maxspeed(Players[i]) + 450)
    
g_multijumps[Players[i]] = true
g_has_unlimited_clip
[Players[i]] = true
g_speed
[Players[i]] = true

ColorChat
(0GREEN"^4[ BaseBiulder ] ^1Player ^4%s ^1Is The Last Survivor With Unlimited Clip ^4!",szName)
}
}
}

/*--------------------------------------------------------------*/

public spawn_off(id)
{
    for (new 
idid <= 32id++) g_multijumps[id] = false;
    for (new 
idid <= 32id++) g_has_unlimited_clip[id] = false;
}

public 
change_weapon(id)
{
if(
g_speed[id]) set_user_maxspeed(idget_user_maxspeed(id) + 450)
}
/*------------------------- 2 Jump ----------------------------*/

public FW_PlayerPreThinkz(id)
{
    if(!
g_multijumps[id]) return PLUGIN_CONTINUE
    
new nbut pev(id,pev_button);
    new 
obut pev(id,pev_oldbuttons);
    if((
nbut IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut IN_JUMP))
    {
        if(
jumpnum[id] < 1)
        {
            
dojump[id] = true;
            
jumpnum[id]++;
            return 
PLUGIN_CONTINUE
        
}
    }
    if((
nbut IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
    {
        
jumpnum[id] = 0;
        return 
PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
FW_PlayerPostThinkz(id)
{
    if(!
g_multijumps[id]) return PLUGIN_CONTINUE
    
if(dojump[id] == true)
    {
        new 
Float:velocity[3];
        
pev(id,pev_velocity,velocity);
        
velocity[2] = random_float(265.0,285.0);
        
set_pev(id,pev_velocity,velocity)
        
dojump[id] = false
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}    

/*------------------------- Unlimited clip ----------------------------*/

public message_cur_weapon(msg_idmsg_destmsg_entity)
{

    if (!
g_has_unlimited_clip[msg_entity])
        return;
    

    if (!
is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static 
weaponclip
    weapon 
get_msg_arg_int(2
    
clip get_msg_arg_int(3
    

    if (
MAXCLIP[weapon] > 2
    {
        
set_msg_arg_int(3get_msg_argtype(3), MAXCLIP[weapon]) 
        
        if (
clip 2
        {
            
            static 
wname[32], weapon_ent
            get_weaponname
(weaponwnamesizeof wname 1)
            
weapon_ent fm_find_ent_by_owners(-1wnamemsg_entity)
            
            
            
fm_set_weapon_ammos(weapon_entMAXCLIP[weapon])
        }
    }
}


stock fm_find_ent_by_owners(entity, const classname[], owner)
{
    
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) {}
    
    return 
entity;
}


stock fm_set_weapon_ammos(entityamount)
{
    
set_pdata_int(entityOFFSET_CLIPAMMOamountOFFSET_LINUX_WEAPONS);

image


please if eny one know how to help me please

Last edited by ms.itry; 04-22-2018 at 10:08.
ms.itry is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-22-2018 , 07:19   Re: [HELP] Bug scripting
Reply With Quote #2

ColorChat(0, ...) -> ColorChat(Players[i], ...)
__________________
HamletEagle is offline
ms.itry
Member
Join Date: Apr 2018
Old 04-22-2018 , 08:58   Re: [HELP] Bug scripting
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
ColorChat(0, ...) -> ColorChat(Players[i], ...)
i did what you said but stay repeat message for the "ColorChat" to last ct
and last ct has hp 500 for every zombie die
thank u man but this not what i need please if you can make (2jump, ultimate, hp, speed) and message showing just Once

Last edited by ms.itry; 04-22-2018 at 09:00.
ms.itry is offline
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 04-22-2018 , 09:58   Re: [HELP] Bug scripting
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <Colorchat>

#pragma tabsize 0

new szName[33],g_speed[33]

new 
jumpnum[33] = 0;
new 
bool:dojump[33] = false;
new 
g_multijumps[33] = 0;


#if cellbits == 32
const OFFSET_CLIPAMMO 51
#else
const OFFSET_CLIPAMMO 65
#endif
const OFFSET_LINUX_WEAPONS 4

// Max Clip for weapons
new const MAXCLIP[] = { -113, -11017, -1303013020253035251220,
            
10301008303020273030, -150 }

new 
g_has_unlimited_clip[33]

new 
bool:g_bMessage false;
/*------------------------- plugin_init ----------------------------*/

public plugin_init( )
{
    
register_plugin"Last Survivor""1.0""EaGle" )
    
register_event"DeathMsg""EventDeath""a" )
    
    
register_forward(FM_PlayerPreThink"FW_PlayerPreThinkz")
    
register_forward(FM_PlayerPostThink"FW_PlayerPostThinkz")
        
    
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    
register_event("CurWeapon""change_weapon""be""1=1")
    
    
register_logevent("OnRoundEnd"2"1=Round_End")  
    
    
RegisterHam(Ham_Spawn"player""spawn_off"1)

}

/*------------------------- Last Survivor ----------------------------*/

public EventDeath( )
{
    new 
Players32 ]
    new 
iNum

    get_players
PlayersiNum"ae""CT" )
    
    if( 
iNum == && !g_bMessage )
    {
        for (new 
0iNumi++)
        {
            
get_user_name(Players[i], szName32)
                
            
set_user_health(Players[i], 500)
            
set_user_maxspeed(Players[i], get_user_maxspeed(Players[i]) + 450)
                
            
g_multijumps[Players[i]] = true
            g_has_unlimited_clip
[Players[i]] = true
            g_speed
[Players[i]] = true
            
            ColorChat
(0GREEN"^4[ BaseBuilder ] ^1Player ^4%s ^1Is The Last Survivor With Unlimited Clip ^4!",szName)
            
            
g_bMessage true;
        }
    }
}

public 
OnRoundEnd( )
{
    
g_bMessage false;
}

/*--------------------------------------------------------------*/

public spawn_off(id)
{
    for (new 
idid <= 32id++) g_multijumps[id] = false;
    for (new 
idid <= 32id++) g_has_unlimited_clip[id] = false;
}

public 
change_weapon(id)
{
if(
g_speed[id]) set_user_maxspeed(idget_user_maxspeed(id) + 450)
}
/*------------------------- 2 Jump ----------------------------*/

public FW_PlayerPreThinkz(id)
{
    if(!
g_multijumps[id]) return PLUGIN_CONTINUE
    
new nbut pev(id,pev_button);
    new 
obut pev(id,pev_oldbuttons);
    if((
nbut IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut IN_JUMP))
    {
        if(
jumpnum[id] < 1)
        {
            
dojump[id] = true;
            
jumpnum[id]++;
            return 
PLUGIN_CONTINUE
        
}
    }
    if((
nbut IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
    {
        
jumpnum[id] = 0;
        return 
PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
FW_PlayerPostThinkz(id)
{
    if(!
g_multijumps[id]) return PLUGIN_CONTINUE
    
if(dojump[id] == true)
    {
        new 
Float:velocity[3];
        
pev(id,pev_velocity,velocity);
        
velocity[2] = random_float(265.0,285.0);
        
set_pev(id,pev_velocity,velocity)
        
dojump[id] = false
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}    

/*------------------------- Unlimited clip ----------------------------*/

public message_cur_weapon(msg_idmsg_destmsg_entity)
{

    if (!
g_has_unlimited_clip[msg_entity])
        return;
    

    if (!
is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
        return;
    
    static 
weaponclip
    weapon 
get_msg_arg_int(2
    
clip get_msg_arg_int(3
    

    if (
MAXCLIP[weapon] > 2
    {
        
set_msg_arg_int(3get_msg_argtype(3), MAXCLIP[weapon]) 
        
        if (
clip 2
        {
            
            static 
wname[32], weapon_ent
            get_weaponname
(weaponwnamesizeof wname 1)
            
weapon_ent fm_find_ent_by_owners(-1wnamemsg_entity)
            
            
            
fm_set_weapon_ammos(weapon_entMAXCLIP[weapon])
        }
    }
}


stock fm_find_ent_by_owners(entity, const classname[], owner)
{
    
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) {}
    
    return 
entity;
}


stock fm_set_weapon_ammos(entityamount)
{
    
set_pdata_int(entityOFFSET_CLIPAMMOamountOFFSET_LINUX_WEAPONS);

__________________
marcelowzd is offline
ms.itry
Member
Join Date: Apr 2018
Old 04-22-2018 , 10:09   Re: [HELP] Bug scripting
Reply With Quote #5

thank you man you are the best
ms.itry 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 13:27.


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