Raised This Month: $ Target: $400
 0% 

[Suggestion] Amxmodx: New functions for cstrike module.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-07-2015 , 12:36   [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #1

Hi amxmodx developers.. i would like to see these 3 natives in cstrike module since it use too often in certain mod.

- cs_give_player_item(id, "item_name") -- Same as fun module.
- cs_strip_user_weapons(id) -- Same as fun module.
- cs_strip_user_weapon(id, iCswId, iSlot = 0, bool:bSwitchIfActive = true) -- From here https://forums.alliedmods.net/showpo...7&postcount=42

Why need to use fun module just for these 2 natives?
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2015 , 20:25   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #2

If it already exists then it doesn't need to be recreated unless there is additional functionality that is specific to Counter-Strike.
__________________
fysiks is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-08-2015 , 03:04   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #3

if we are in the suggestions area i would like to metion the following suggestions

1. new native is_valid_player -> returns if is player connected + alive + 1<= id <= max players
2. find entity in a square/rectangle with definable x,y,z vector values

we should also have a sticky topic for suggestions

Last edited by Depresie; 10-08-2015 at 03:05.
Depresie is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-08-2015 , 03:47   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #4

Quote:
Originally Posted by Depresie View Post
if we are in the suggestions area i would like to metion the following suggestions

1. new native is_valid_player -> returns if is player connected + alive + 1<= id <= max players
2. find entity in a square/rectangle with definable x,y,z vector values

we should also have a sticky topic for suggestions
1. is_user_alive(id) already checked player is valid+connected+alive.
2. Never heard about this yet.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 10-08-2015 at 03:48.
yokomo is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-08-2015 , 04:07   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #5

@1

I dont know, but it seems like i have to check if 1<= attacker <=32 all the time in Ham_TakeDamage if i want to set damage higher or something for a player, else i will get run time errors, or worse, random crashes without any errors in the logs

I remember i had an run time error about it some time ago, and bugsy told me about that check, never got that error again in the logs again
After i did that check to all the fw_TakeDamage calls, the random server crashes have been reduced from 1-2 per day, to 1 every 3-4 days

Last edited by Depresie; 10-08-2015 at 04:11.
Depresie is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-08-2015 , 04:23   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #6

Quote:
Originally Posted by Depresie View Post
@1

I dont know, but it seems like i have to check if 1<= attacker <=32 all the time in Ham_TakeDamage if i want to set damage higher or something for a player, else i will get run time errors, or worse, random crashes without any errors in the logs

I remember i had an run time error about it some time ago, and bugsy told me about that check, never got that error again in the logs again
After i did that check to all the fw_TakeDamage calls, the random server crashes have been reduced from 1-2 per day, to 1 every 3-4 days
Of course you need to check whether attacker is player or non-player. 1~32 is player.

So if you wanna multiplier attacker's damage then just check is_user_alive(attacker).

is_user_alive(index) native:
PHP Code:
static cell AMX_NATIVE_CALL is_user_alive(AMX *amxcell *params/* 1 param */
{
    
int index params[1];
    
    if (
index || index gpGlobals->maxClients)
    {
        return 
0;
    }
    
    
CPlayerpPlayer GET_PLAYER_POINTER_I(index);

    if (
g_bmod_tfc)
    {
        
edict_t *pPlayer->pEdict;
        if (
e->v.flags FL_SPECTATOR || 
            (!
e->v.team || !e->v.playerclass))
        {
            return 
0;
        }
    }
    
    return ((
pPlayer->ingame && pPlayer->IsAlive()) ? 0);

__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-08-2015 , 04:30   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #7

well, i did check if the attacker is alive, but it was still needed to be checked if 1<=attacker<=32

Later Edit:

I just reviewed the old code, i didnt have any is_user_alive(attacker) in it... my bad, sorry

btw, quick question

is it needed to check if the victim is alive aswell?

Last edited by Depresie; 10-08-2015 at 04:44.
Depresie is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-08-2015 , 04:39   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #8

Quote:
Originally Posted by Depresie View Post
and as you can see, is_user_alive doesn't check if the attacker is a player or a non player, so i got to use 1<= id <=32 all the time
Yes it does:
PHP Code:
    if (index || index gpGlobals->maxClients)
    {
        return 
0;
    } 
Quote:
is it needed to check if the victim is alive or a player/non player entity aswell?
Since you already hook for "player" classname then there is no need to check whether it player/non-player. About alive check i'm not sure about it, but for me no need to check because victim is obviously alive.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 10-08-2015 at 04:44.
yokomo is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-08-2015 , 05:01   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #9

i was a little bit confused with take damage, thanks alot you made it clear for me

Last edited by Depresie; 10-08-2015 at 05:02.
Depresie is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-08-2015 , 08:32   Re: [Suggestion] Amxmodx: New functions for cstrike module.
Reply With Quote #10

Just because you don't feel to use fun module is not really a valid argument.
That's said,

cs_give_player_item: Actually we added recently cs_create_entity because CS stores classname into an hashtable for faster lookup, this would make sense to have a CS version of this one as well, I guess.
cs_strip_user_weapons: I see no valid reason here.
cs_strip_user_weapon: I think it has been requested, is it useful to remove silently a weapon? You are supposed to control what weapons you give to a player. Do you have an example of situation?
find entity in a square/rectangle: You mean likely UTIL_EntitiesInBox?
__________________

Last edited by Arkshine; 10-08-2015 at 08:33.
Arkshine 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 11:57.


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