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

After 3 spawns i get hp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pokas
Junior Member
Join Date: Dec 2020
Old 12-12-2020 , 18:16   After 3 spawns i get hp
Reply With Quote #1

After 3 spawns my health set 150 how i can do this?
1 person = after 3 spawns your health is 150
1 person = after 2 spawn get NOTHING
how i can do this pls i need help
Pokas is offline
Grafitosky
Member
Join Date: Jul 2020
Old 12-13-2020 , 16:23   Re: After 3 spawns i get hp
Reply With Quote #2

Quote:
Originally Posted by Pokas View Post
After 3 spawns my health set 150 how i can do this?
1 person = after 3 spawns your health is 150
1 person = after 2 spawn get NOTHING
how i can do this pls i need help

I need help too, but with a slightly different thing
Grafitosky is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 12-14-2020 , 06:08   Re: After 3 spawns i get hp
Reply With Quote #3

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <cstrike>
#pragma newdecls required

int g_Spawns[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
    for (
int i 1<= MaxClientsi++)
    {
        
OnClientConnected(i);
    }
}

public 
void OnClientConnected(int client)
{
    
g_Spawns[client] = 0;
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast
{
    
// team validation
    
int clientTeam event.GetInt("teamnum");
    if (
clientTeam CS_TEAM_T)
    {
        return;
    }
    
    
int userId event.GetInt("userid");
    
int client GetClientOfUserId(userId);
    
    
// client validation
    
if (!client || !IsClientInGame(client))
    {
        return;
    }
    
    
g_Spawns[client]++;
    if (
g_Spawns[client] >= 3)
    {
        
g_Spawns[client] = 0;
        
RequestFrame(Frame_GiveHealthuserId);
    }
}

public 
void Frame_GiveHealth(int userId)
{
    
int client GetClientOfUserId(userId);
    if (!
client || !IsClientInGame(client) || !IsPlayerAlive(client))
    {
        return;
    }
    
    
SetEntityHealth(client150);

__________________
Ilusion9 is offline
Pokas
Junior Member
Join Date: Dec 2020
Old 12-14-2020 , 06:18   Re: After 3 spawns i get hp
Reply With Quote #4

Quote:
Originally Posted by Ilusion9 View Post
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <cstrike>
#pragma newdecls required

int g_Spawns[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
    for (
int i 1<= MaxClientsi++)
    {
        
OnClientConnected(i);
    }
}

public 
void OnClientConnected(int client)
{
    
g_Spawns[client] = 0;
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast
{
    
// team validation
    
int clientTeam event.GetInt("teamnum");
    if (
clientTeam CS_TEAM_T)
    {
        return;
    }
    
    
int userId event.GetInt("userid");
    
int client GetClientOfUserId(userId);
    
    
// client validation
    
if (!client || !IsClientInGame(client))
    {
        return;
    }
    
    
g_Spawns[client]++;
    if (
g_Spawns[client] >= 3)
    {
        
g_Spawns[client] = 0;
        
RequestFrame(Frame_GiveHealthuserId);
    }
}

public 
void Frame_GiveHealth(int userId)
{
    
int client GetClientOfUserId(userId);
    if (!
client || !IsClientInGame(client) || !IsPlayerAlive(client))
    {
        return;
    }
    
    
SetEntityHealth(client150);

Thank you!
Pokas 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 17:36.


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