Raised This Month: $ Target: $400
 0% 

Solved Spawn with 25 HP


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
SoulWeaver16
Senior Member
Join Date: May 2021
Location: Uruguay
Old 04-13-2023 , 17:49   Re: Spawn with 25 HP
Reply With Quote #6

Quote:
Originally Posted by lexzor View Post
thank celena

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

#define IsValid(%0) (0 < %0 < 33)

new cvar_hp
new g_hambots// This variable will check if the hams have been recorded
new cvar_botquota// This variable will check if there is bots in the game

public plugin_init()
{
    
register_plugin("Low HP""alliedmods""0.1")

    
RegisterHam(Ham_Spawn"player""fwPlayerSpawn"1)

    
cvar_hp register_cvar("spawn_hp_amount""25")
}

// Spawn event hook for bots: https://forums.alliedmods.net/showthread.php?t=294861
public client_putinserver(id)
{
    
// If the ID dont is bot
    
if (!is_user_bot(id))
        return;
        
    
// If the ham already registered
    
if (g_hambots)
        return;
        
    
// If dont have any bot in game
    
if (!cvar_botquota)
        return;
        
    
// Set a register ham bots task into bot id
    
set_task(0.1"fw_RegisterHamBots"id);
}

public 
fw_RegisterHamBots(id)
{
    
// Ham Forwards
    
RegisterHamFromEntity(Ham_Spawnid"fwPlayerSpawn"); // In this case, Ham_TakeDamage

    // Here you add any Ham you need
    
    // Register complete
    
g_hambots true;
}

public 
fwPlayerSpawn(id)
{
    if(
is_user_alive(id) && IsValid(id))
    {
        
set_user_health(idget_pcvar_num(cvar_hp))
    }

Attached Thumbnails
Click image for larger version

Name:	de_dust2_cz0005.jpg
Views:	42
Size:	87.2 KB
ID:	200240  
__________________
Extended Arm Weapon Skin v2.1 {16/Apr/23}
(Detect which class is and associate it with the corresponding arms)
SideWeapons v0.2 {01/Sep/22}
(New version of Back Weapons v1.87)

SoulWeaver16 is offline
 



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 07:45.


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