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

Plugin not compile [ZPS]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ORdli
Member
Join Date: Nov 2021
Old 01-21-2024 , 18:36   Plugin not compile [ZPS]
Reply With Quote #1

PHP Code:
#include <sourcemod>

public void OnMapStart()
{
    
CreateTimer(1.0Timer_DisplayHealthTIMER_REPEAT);
}

public 
Action Timer_DisplayHealth(Handle:timer)
{
    for (
int entity 1entity <= MaxClientsentity++)
    {
        if (!
IsValidEntity(entity))
            continue;

        if (
GetClassname(entity) == "func_breakable")
        {
            
int health GetEntProp(entityProp_Data"m_iHealth"00);
            
int maxHealth GetEntProp(entityProp_Data"m_iMaxHealth"00);
            if (
health >= && maxHealth >= 0)
            {
                
ShowHealthInfoToClient(entityhealthmaxHealth);
            }
        }
    }
    return 
Plugin_Continue;
}

public 
Action ShowHealthInfoToClient(int clientint healthint maxHealth)
{
    
PrintToChat(client"Prop health: %d / %d"healthmaxHealth);
    return 
Plugin_Continue;


The plugin displayed the amount of HP for breaking objects in the game such as doors and barricades, but on the new version 3.2.7 it no longer works, what’s wrong and what’s the matter?
the plugin displayed the amount of remaining HP for objects in the game like func_breakable and physical props, something like show damage only for collapsing obje.

Last edited by DarkDeviL; 01-21-2024 at 23:34. Reason: Added CODE tag
ORdli is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-22-2024 , 08:28   Re: Plugin not compile [ZPS]
Reply With Quote #2

Can you tell us, where you got that code ?
And what update you saw ?

That code not make sense. It check player indexs, unless "GetClassname()" has own magic in it.

*edit
still not make sense to look health from player itsel.
__________________
Do not Private Message @me

Last edited by Bacardi; 01-22-2024 at 08:29.
Bacardi is offline
ORdli
Member
Join Date: Nov 2021
Old 01-22-2024 , 16:15   Re: Plugin not compile [ZPS]
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
Can you tell us, where you got that code ?
And what update you saw ?

That code not make sense. It check player indexs, unless "GetClassname()" has own magic in it.

*edit
still not make sense to look health from player itsel.


as far as I know it worked on older versions of the game, I found it from old builds for creating unofficial ready-made servers for zombie panic on github.
ORdli is offline
101
Member
Join Date: Nov 2023
Old 01-23-2024 , 00:09   Re: Plugin not compile [ZPS]
Reply With Quote #4

Quote:
Originally Posted by ORdli View Post
as far as I know it worked on older versions of the game, I found it from old builds for creating unofficial ready-made servers for zombie panic on github.
Noway ,everything here is wrong , the code , the logic , the sense and also ur answers .
If i were u , I would request some help like this :
My Game is :X . my goal with - exact manner - is :N , and here is my "full" code :S ,but the problem i have faced is :Z ,
and here some report :P
Quote:
Reports :
C:\game\X\addons\R\Y\*.smx : error 100: function F does not make sense
C:\game\X\addons\R\Y\*.smx : error 101: You can't use MaxClients that has a limit range [32-100] While You Are Searching For a Non-Human Stuff that index might be 1000 , Use GetMaxEntities() Instead .
C:\game\X\addons\R\Y\*.smx : error 102: GetClassName() is undefined , Note : ClassNames of clients seats that refers to "MaxClients" will never match string "func_breakable".
...
...
ATM , i have to guess a solution for a random game "Zombie Panic! Source" like this , but i still don't understand the main purpose :
PHP Code:
#include <sdktools_functions>

#define Timer_Refresh    1.0

new Handle:h_timer[MAXPLAYERS+1];

public 
OnPluginStart() 
{
    
HookEvent("player_spawn",E_P_S);
}

public 
E_P_S(Handle:event, const String:name[], bool:Broadcast
{
    new 
GetEventInt(event,"entindex");
    if ( !
IsFakeClient(P) &&  h_timer[P] ==null )
    {
        
h_timer[P]=CreateTimer(Timer_Refresh ,Timer_DisplayHealthTIMER_REPEAT);
    }
}

public 
Action Timer_DisplayHealth(Handle Timer,any P)
{
    
int Eye_Target GetClientAimTarget(Pfalse);
    
    switch ( 
Eye_Target)
    {
        case -
: return Plugin_Continue;
        case -
SetFailState("This Function Is Not Supported");
    }
    
    
char className[32];
    
GetEdictClassname(Eye_TargetclassName32);
    
    if (
StrContains(className"func_break" ,false) != -1)
    {
        
int Health GetEntProp(Eye_TargetProp_Data"m_iHealth"00);
        
int MHealth GetEntProp(Eye_TargetProp_Data"m_iMaxHealth"00);
        
PrintHintText("Health[ %d / %d ]" Health MHealth );
    }
    return 
Plugin_Continue;
}

public 
OnClientDisconnect(P)
{
    if (
h_timer[P]!=null)
        
delete h_timer[P];

This will print a hint message when a human aims at a breakable entity (I guess So) .

Last edited by 101; 01-23-2024 at 00:14.
101 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-23-2024 , 03:41   Re: Plugin not compile [ZPS]
Reply With Quote #5

Good work 101, I have not tested tough
Bacardi is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-23-2024 , 12:09   Re: Plugin not compile [ZPS]
Reply With Quote #6

Quote:
Originally Posted by ORdli View Post
The plugin displayed the amount of HP for breaking objects in the game such as doors and barricades, but on the new version 3.2.7 it no longer works, what’s wrong and what’s the matter?
ChatGPT is still very bad at writing plugins on SourcePawn
__________________
Grey83 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-23-2024 , 12:29   Re: Plugin not compile [ZPS]
Reply With Quote #7

Quote:
Originally Posted by 101 View Post
This will print a hint message when a human aims at a breakable entity (I guess So).
I think this would be a better option
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdktools_functions>

bool bShow;

public 
void OnMapStart()
{
    
CreateTimer(1.0Timer_HP_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);

    
HookEvent("round_start"Event_RoundEventHookMode_PostNoCopy);
    
HookEvent("round_end"Event_RoundEventHookMode_PostNoCopy);
}

public 
void Event_Round(Event event, const char[] namebool dontBroadcast)
{
    
bShow name[6] == 's';
}

public 
Action Timer_HP(Handle timer)
{
    if(!
bShow)
        return 
Plugin_Continue;

    static 
char cls[16];
    for(
int i 1aim<= MaxClientsi++)
        if(
IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i) && (aim GetClientAimTarget(ifalse)) > MaxClients
        
&& GetEntityClassname(aimclssizeof(cls)) && !strncmp(cls"func_breakable"14false))
            
PrintHintText("Health [ %d / %d ]"GetEntProp(aimProp_Data"m_iHealth"), GetEntProp(aimProp_Data"m_iMaxHealth"));

    return 
Plugin_Continue;

__________________
Grey83 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-23-2024 , 12:42   Re: Plugin not compile [ZPS]
Reply With Quote #8

For info, we talk about Zombie Panic Source, game what have own unique events made.

I maybe wrong but I don't think those "round_start" and "round_end" event exist on that game.

I found these tough but do those get fired, I have not tested.
Code:
	"round_begins"		// Round has begun
	{
	}

	"round_win"			// Round has ended
	{
		"mapname"		"string"
		"humanwin"		"bool"
	}
I would use OnMapStart or else instead.
That mod have a lot difference
__________________
Do not Private Message @me
Bacardi is offline
ORdli
Member
Join Date: Nov 2021
Old 01-23-2024 , 13:10   Re: Plugin not compile [ZPS]
Reply With Quote #9

I tested both plugins, the first from 101 works, but the amount of HP is not shown correctly, and not on all objects, it skips prop_physic, the second plugin compiled and works but it does not show anything, the essence of the plugin was that it showed how much HP remains of an object being destroyed when damage is dealt, for example, there is a barricade on the map that has 2000 HP; when damage is dealt, information is shown in the center of the screen about how much HP is left for the barricade to break it or for any physical object in the game that can be broken, be it is this a door or a drawer!
ORdli is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-23-2024 , 15:20   Re: Plugin not compile [ZPS]
Reply With Quote #10

Quote:
Originally Posted by Bacardi View Post
I maybe wrong but I don't think those "round_start" and "round_end" event exist on that game.

I found these tough but do those get fired, I have not tested.
Quote:
Originally Posted by ORdli View Post
prop_physic
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdktools_functions>

bool bShow;

public 
void OnMapStart()
{
    
CreateTimer(1.0Timer_HP_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);

    
HookEvent("round_begins"Event_RoundEventHookMode_PostNoCopy);
    
HookEvent("round_win"Event_RoundEventHookMode_PostNoCopy);
}

public 
void Event_Round(Event event, const char[] namebool dontBroadcast)
{
    
bShow name[6] == 'b';
}

public 
Action Timer_HP(Handle timer)
{
    if(!
bShow)
        return 
Plugin_Continue;

    static 
char cls[16];
    for(
int i 1aim<= MaxClientsi++)
        if(
IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i)
        && (
aim GetClientAimTarget(ifalse)) > MaxClients && GetEntityClassname(aimclssizeof(cls))
        && (!
strncmp(cls"func_breakable"14false) || (!strncmp(cls"prop_physics"12false))))
            
PrintHintText("Health [ %d / %d ]"GetEntProp(aimProp_Data"m_iHealth"), GetEntProp(aimProp_Data"m_iMaxHealth"));

    return 
Plugin_Continue;

__________________

Last edited by Grey83; 01-24-2024 at 07:09. Reason: Fixed compiling error: expected token: ")", but found "-identifier-"
Grey83 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 08:45.


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