Raised This Month: $51 Target: $400
 12% 

lasermine edit


Post New Thread Reply   
 
Thread Tools Display Modes
tedaimlocks
Member
Join Date: Jan 2024
Old 03-01-2024 , 07:29   Re: lasermine edit
Reply With Quote #11

Quote:
Originally Posted by tedaimlocks View Post
I actually didn't test the owner and the health , i only tested the pvip_lasermine command and that wasnt working

I will test health and owner when i get home
Its working, but i still need the flags for that command
tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-01-2024 , 08:50   Re: lasermine edit
Reply With Quote #12

Quote:
Originally Posted by tedaimlocks View Post
Its working, but i still need the flags for that command
Change
PHP Code:
public BuyLasermine(id)
{
    if(!
CanCheck(id,1)) return PLUGIN_CONTINUE

    zp_set_user_ammo_packs
(id,zp_get_user_ammo_packs(id) - get_pcvar_num(g_LCOST))
    
g_havemine[id]++;

    
client_print(idprint_chat"%L %L"id"CHATTAG",id"STR_BOUGHT")

    
emit_sound(idCHAN_ITEMENT_SOUND5VOL_NORMATTN_NORM0PITCH_NORM)
    
ShowAmmo(id)
    return 
PLUGIN_HANDLED

To
PHP Code:
public BuyLasermine(id)
{
    if(!(
get_user_flags(id) & ADMIN_BAN))
    {
        
client_print(idprint_chat"You are not an admin");
        return 
PLUGIN_HANDLED;
    }
    
    if(!
CanCheck(id,1)) return PLUGIN_CONTINUE;

    
zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id) - get_pcvar_num(g_LCOST));
    
g_havemine[id]++;

    
client_print(idprint_chat"%L %L"id"CHATTAG",id"STR_BOUGHT");

    
emit_sound(idCHAN_ITEMENT_SOUND5VOL_NORMATTN_NORM0PITCH_NORM);
    
ShowAmmo(id);
    return 
PLUGIN_HANDLED;

Uzviseni Bog is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-01-2024 , 09:21   Re: lasermine edit
Reply With Quote #13

Working thank you
tedaimlocks is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-01-2024 , 10:28   Re: lasermine edit
Reply With Quote #14

Uh , i kinda found a glitch randomly, https://imgur.com/a/Vh1SuQG Whenever i hit a block that breaks it shows the health of it
tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-03-2024 , 16:05   Re: lasermine edit
Reply With Quote #15

Quote:
Originally Posted by tedaimlocks View Post
Uh , i kinda found a glitch randomly, https://imgur.com/a/Vh1SuQG Whenever i hit a block that breaks it shows the health of it
Fixed
PHP Code:
public Laser_TakeDamage(victiminflictorattackerFloat:f_Damagebit_Damage)
{
    if(
get_pcvar_num(g_LBEO))
    {
        new 
i_Owner;

        
// Obtain the ID of the player who put mine
        
i_Owner pev(victimLASERMINE_OWNER);

        
// Check team and owner conditions
        
if(CsTeams:pev(victimLASERMINE_TEAM) == cs_get_user_team(attacker) && i_Owner != attacker)
            return 
HAM_SUPERCEDE;

        
// Display health and owner name
        
new ownerName[32], message[128];
        
get_user_name(i_OwnerownerNamesizeof(ownerName)); // Get owner name
        
new Float:currentHealth pev(victimpev_health) - f_Damage// Calculate new health after damage

        // Format and display the message
        
format(messagesizeof(message), "Health: %.0f - Owner: %s"currentHealthownerName);
        
        
// Display the message at the center of the screen
        
client_print(attackerprint_centermessage);

        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_CONTINUE;

To
PHP Code:
public Laser_TakeDamage(victiminflictorattackerFloat:f_Damagebit_Damage)
{
    new 
victimClassname[32];
    
pev(victimpev_classnamevictimClassnamesizeof(victimClassname));
    if(!
equal(victimClassnameENT_CLASS_NAME))
        return 
PLUGIN_CONTINUE;
    
    if(
get_pcvar_num(g_LBEO))
    {
        new 
i_Owner;

        
// Obtain the ID of the player who put mine
        
i_Owner pev(victimLASERMINE_OWNER);

        
// Check team and owner conditions
        
if(CsTeams:pev(victimLASERMINE_TEAM) == cs_get_user_team(attacker) && i_Owner != attacker)
            return 
HAM_SUPERCEDE;

        
// Display health and owner name
        
new ownerName[32], message[128];
        
get_user_name(i_OwnerownerNamesizeof(ownerName)); // Get owner name
        
new Float:currentHealth pev(victimpev_health) - f_Damage// Calculate new health after damage

        // Format and display the message
        
format(messagesizeof(message), "Health: %.0f - Owner: %s"currentHealthownerName);
        
        
// Display the message at the center of the screen
        
client_print(attackerprint_centermessage);

        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_CONTINUE;

Uzviseni Bog 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 00:09.


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