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

Limit ammopacks


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ahmedkhater012
Member
Join Date: Jan 2017
Location: Egypt
Old 03-03-2017 , 21:58   Limit ammopacks
Reply With Quote #1

i want to make limit ammopacks in my server 100 how?
ahmedkhater012 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-04-2017 , 07:54   Re: Limit ammopacks
Reply With Quote #2

You can start by giving some more information.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 03-04-2017 , 08:02   Re: Limit ammopacks
Reply With Quote #3

he does want the ammopacks in his server to not go over 100 ammopacks, if player each 100 amoopack then he can't get over it. here it is : https://forums.alliedmods.net/showth...78816?t=178816 .search before post next time.
__________________
FINISHED WORKING ON : Attack On Titan Mod (100% Done).

FB Acc : FaceBook Account.

pic: http://prntscr.com/fszkke not good quality
yas17sin is offline
Send a message via ICQ to yas17sin
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-04-2017 , 08:11   Re: Limit ammopacks
Reply With Quote #4

By more information I meant which mod he's using.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-04-2017 , 08:29   Re: Limit ammopacks
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
By more information I meant which mod he's using.
What information do you want? Obviously the Mod is ZP. Version of ZP doesn't matter because ZP50/.X has Backward compatibility.

@yas17in That plugin uses PreThink which is a poor way, a better way would be to create a forward that gets called every time player's Ammo Packs get [in/de]creased, but that's a lot of work .

PHP Code:
#include < amxmodx >
#include < zombieplague >

#define TASK_FREQUENCY 1.0

new g_maxplayers;
new 
cvar_limit;
new 
cvar_value;

public 
plugin_init( ) {

    
register_plugin"[ZP] Limit AP""1.0""DoNii" );
    
register_event"HLTV""event_new_round""a""1=0""2=0" );  

    
cvar_limit register_cvar"zp_limit_ap""100" );
    
    
g_maxplayers get_maxplayers( );

    
set_taskTASK_FREQUENCY"LimitPlayerAP"0__"b" );

}

public 
LimitPlayerAP( ) {

    for ( new 
id=1id <= g_maxplayersid++ ) {

        if( 
zp_get_user_ammo_packsid ) > cvar_value )
        
zp_set_user_ammo_packsidcvar_value );
    }
}

public 
event_new_round( ) {

    
cvar_value get_pcvar_numcvar_limit )

Better way. I'm caching CVAR's value in New Round event instead of using get_pcvar_num every second. [Task frequency is 1.0]
__________________

Last edited by edon1337; 03-04-2017 at 08:39.
edon1337 is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 03-04-2017 , 11:20   Re: Limit ammopacks
Reply With Quote #6

nice code edon1337.
__________________
FINISHED WORKING ON : Attack On Titan Mod (100% Done).

FB Acc : FaceBook Account.

pic: http://prntscr.com/fszkke not good quality
yas17sin is offline
Send a message via ICQ to yas17sin
ahmedkhater012
Member
Join Date: Jan 2017
Location: Egypt
Old 03-05-2017 , 14:16   Re: Limit ammopacks
Reply With Quote #7

You are the best edon
ahmedkhater012 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 01:48.


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