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

COD: HitMarkers v1.7 [Updated April 29th 2021]


Post New Thread Reply   
 
Thread Tools Display Modes
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-17-2020 , 10:15   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #11

cstrike_running() No idea why i should use this since i specify in my topic that this plugin is for counter-strike only.

Also, iDamage & iDamagebits aren't needed, i know that but i don't think it really matters.

whats wrong with (iAttacker == iInflictor)?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-17-2020 , 10:16   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #12

Well I could not get it to work with both cstrike and Half-life with that in there actively testing both. It was only a suggestion.
__________________
DJEarthQuake is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-17-2020 , 10:22   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #13

Quote:
Originally Posted by DJEarthQuake View Post
Well I could not get it to work with both cstrike and Half-life with that in there actively testing both. It was only a suggestion.
Thanks for the suggestion though. On what game were u testing it on? And were u testing your own code?

I mean i'm generaly creating plugins for CS 1.6, it's possible for some plugins to work on other gamemodes but that's not my purpose or my goal. All other goldsource games are basicly dead anyways.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-17-2020 , 10:27   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #14

Half-Life, Gearbox, CS 1.6. Your code. Anytime get_user_team is introduced without the cstrike_running() other mods are no longer compatible. Take 'get_user_team' out, they work. Put it back with cstrike_running() it bridges the gap. It then works on more than 1 mod.
__________________

Last edited by DJEarthQuake; 01-17-2020 at 10:29. Reason: damn keyboard is ......
DJEarthQuake is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-17-2020 , 10:31   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #15

Quote:
Originally Posted by DJEarthQuake View Post
Half-Life, Gearbox, CS 1.6. Your code. Anytime get_user_team is introduced without the cstrike_running() other mods are no longer compatible. Take 'get_user_team' out, they work. Put it back with cstrike_running() it bridges the gap. It then works on more than 1 mod.
Thanks, will add cstrike_running() in my code, thanks for making it clear for me.

EDIT: Had to use this in order for it to work properly. When i used your code, hitmarkers were shown when hitting teammates. updated line
PHP Code:
if(is_user_connected(iAttacker) && (get_pcvar_num(pPlugin)) && (cstrike_running()) && get_user_team(iVictim) != get_user_team(iAttacker)) 
__________________

Last edited by Napoleon_be; 01-17-2020 at 10:45.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 01-17-2020 , 13:15   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #16

Few suggestions:
- There is no point of saving 'xPos', 'yPos', 'Holdtime' cvars global when only using them in one function
- Same with 'symbol' variable


PHP Code:
public PostTakeDamage(iVictimiInflictoriAttackerFloat:iDamageiDamagebits)
{
    if(
is_user_connected(iAttacker)
        && 
get_pcvar_num(pPlugin)
        && (
get_user_team(iVictim) != get_user_team(iAttacker)))
    {
        new const 
hud_symbols[][] = { "x""-""\", "|", "/", "*", "+" };

        static bool:hud_rainbowffect
        hud_rainbowffect = bool:get_pcvar_num(pRainbow)

        set_hudmessage
        (
            .red = hud_rainbowffect ? iRainbow : get_pcvar_num(pColorRed),
            .green = hud_rainbowffect ? iRainbow : get_pcvar_num(pColorGreen),
            .blue = hud_rainbowffect ? iRainbow : get_pcvar_num(pColorBlue),
            .x = get_pcvar_float(pXPosition),
            .y = get_pcvar_float(pYPosition),
            .fxtime = 2.0,
            .holdtime = get_pcvar_float(pHoldTime),
            .fadeintime = 0.0,
            .fadeouttime = 0.0
        );
        show_hudmessage(iAttacker, "
%s", hud_symbols[ (get_pcvar_num(pRandomHitmarkers) ? random_num(0, 6) : 0) ] );
    }

__________________
Retired.

Last edited by Xalus; 01-17-2020 at 13:16.
Xalus is offline
Old 01-17-2020, 16:31
Napoleon_be
This message has been deleted by Napoleon_be.
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-18-2020 , 02:56   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #17

He can use static variable to hold the value which will more optimized but the cvar change won't be set immediately. Need to change the map.

PHP Code:

public PostTakeDamage(iVictimiInflictoriAttackerFloat:iDamageiDamagebits)
{
    static 
Float:fHoldValue 0.0;
    if(
fHoldValue == 0.0fHoldValue get_pcvar_float(pHoldTime); 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-18-2020 at 03:06.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-18-2020 , 04:31   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #18

@Napoleon_be, we both had cstrike_running() askew. @Xalus nice sanitization.

What I envisioned was this 'spinner script' in the crosshairs.

Code:
#!/bin/sh

i=0
while [ $i -le 60 ]; do
  for s in / - \\ \|; do
    printf "\r$s"
    sleep .1
  done
  i=$((i+1))
done
This example uses the damage variable and cstrike_running properly. Works on multiple mods, but not on friendlies.
Code:
public PostTakeDamage(iVictim, iInflictor, iAttacker, Float:iDamage, iDamagebits) {     if (get_pcvar_num(pPlugin)) {     if (is_user_connected(iAttacker)) {     if( cstrike_running() && get_user_team(iVictim) != get_user_team(iAttacker) || !cstrike_running() )     {         new const hud_symbols[][] = { "x", "-", "\", "|", "/", "*", "+" };         static bool:hud_rainbowffect         hud_rainbowffect = bool:get_pcvar_num(pRainbow)         set_hudmessage         (             .red = hud_rainbowffect ? iRainbow : get_pcvar_num(pColorRed),             .green = hud_rainbowffect ? iRainbow : get_pcvar_num(pColorGreen),             .blue = hud_rainbowffect ? iRainbow : get_pcvar_num(pColorBlue),             .x = get_pcvar_float(pXPosition),             .y = get_pcvar_float(pYPosition),             .fxtime = 2.0,             .holdtime = get_pcvar_float(pHoldTime),             .fadeintime = 0.0,             .fadeouttime = 0.0         );         show_hudmessage(iAttacker, "%s", hud_symbols[ (get_pcvar_num(pRandomHitmarkers) ? random_num(0, 6) : 0) ] );         if( iDamage > 150.0) {         @FnWow(iAttacker, iDamage, iVictim);         }       }     }   } } @FnWow(iAttacker, Float:iDamage, iVictim) {     client_print(0,print_console,"%n obliterated %n doing %i damage!",iAttacker,iVictim,floatround(iDamage))     set_hudmessage(iRainbow,iRainbow,iRainbow, -1.0, 0.55, 1, 2.0, 3.0, 0.7, 0.8, 3);     show_hudmessage(0, "%n obliterated %n doing %i damage!",iAttacker,iVictim,floatround(iDamage)) }

Thanks for the credit!

Quote:
SPiNX obliterated Maxjk0 doing 448 damage!
*** SPiNX killed Maxjk0 with a headshot from awp ***
__________________

Last edited by DJEarthQuake; 01-18-2020 at 10:19. Reason: grammar
DJEarthQuake is offline
thEsp
BANNED
Join Date: Aug 2017
Old 01-18-2020 , 07:07   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #19

Pretty pointless in my opinion, I'd better use ABD instead.

Last edited by thEsp; 01-18-2020 at 07:07.
thEsp is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-18-2020 , 09:17   Re: COD: HitMarkers [First release: 16/01/2020]
Reply With Quote #20

cvars are there to be changed immediatly, i won't be changing my code which will lead the plugin to require a map change in order for the cvars to change, even though that would optimize my code.

Also, i won't be displaying any messages that show how much damage has been done, abd is there to do that. This is just simply a remake of the COD Hitmarker, this plugin has no other purpose. If i implent all that, i would just be recreating an already existing plugin, which isn't my goal.
__________________

Last edited by Napoleon_be; 01-18-2020 at 09:17.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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:06.


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