AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ammo regen in every 2 mins + The screen so you can when it goes down please help. (https://forums.alliedmods.net/showthread.php?t=83424)

X0Left4dead0X 01-09-2009 12:47

Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Ammo regen"
#define VERSION "1.3.3.7"
#define AUTHOR "Left4Dead"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_dictionary("regen.txt")
}

public 
client_authorized(id)
{
   
set_task(0.5,"Ammoregen",id// < Doesnt work
}

public 
Ammoregen(id)
{
    new 
task
    task 
set_task(4.0,"Fill")
    
client_print(idprint_chat"%L"LANG_PLAYER"AMMO_REGEN"task) << Doesnt shower above the hp or Amour Gen
    
//show_hudmessage(id, "Ammo regen in %s", Timer)
}

public 
Fill(id)
{
    
show_hudmessage(id"Here's some ammo")



Bad_Bud 01-09-2009 15:40

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
try

PHP Code:

public client_putinserver(id)
{
     
set_task(0.5,"Ammoregen",id)


If that doesn't work, I'd make the delay for that first set_task longer, like two seconds instead of half of a second; that can help, too.

SnoW 01-09-2009 15:52

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
You should call it for spawn or even better event, because if he goes to spec for example, that's not the best thing. You can't also show hudmessage if you haven't set it. (Though I might be wrong, there can be some default hudsettings that I don't know)

X0Left4dead0X 01-09-2009 20:35

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
2 Attachment(s)
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <time>

#define PLUGIN "Ammo regen"
#define VERSION "1.3.3.7"
#define AUTHOR "Left4Dead"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_dictionary("regen.txt")
}

public 
client_authorized(id)
{
    
//new task
    //task = set_task(4.0,"Ammofill")
    
new time2count[31]
    
get_time("0:120:0",time2count,32//%H:%M:%S
    //time2count = time(0,120,0)
    
client_print(idprint_chat"%L"LANG_PLAYER"AMMO_REGEN"time2count)
    
//show_hudmessage(id, "Ammo regen in %s", Timer)


Someone test my code please and print screen and report bugs

regen.txt goes in addons/amxmodx/data/lang if your newb at amxmodx.

X0Left4dead0X 01-10-2009 06:28

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
Can anyone help..

SnoW 01-10-2009 08:01

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
Quote:

Originally Posted by X0Left4dead0X (Post 741348)
PHP Code:

/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <time>
 
#define PLUGIN "Ammo regen"
#define VERSION "1.3.3.7"
#define AUTHOR "Left4Dead"
 
 
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_dictionary("regen.txt")
}
 
public 
client_authorized(id)
{
    
//new task
    //task = set_task(4.0,"Ammofill")
    
new time2count[31]
    
get_time("0:120:0",time2count,32//%H:%M:%S
    //time2count = time(0,120,0)
    
client_print(idprint_chat"%L"LANG_PLAYER"AMMO_REGEN"time2count)
    
//show_hudmessage(id, "Ammo regen in %s", Timer)


Someone test my code please and print screen and report bugs

regen.txt goes in addons/amxmodx/data/lang if your newb at amxmodx.

This is scripting help, where you can ask help with your scripting. You don't ask here someone to test your code. What are you even doing, if you want this code for yourself, I doubt that you have a server to test this. You should really read the rules, because bump time is 2 weeks. I don't understand even what are you doing, why do you get that time into this? If you want to do it to make something every 2 mins, use set_task. Also as I said, don't use client_authorized.

EDIT: Btw:
Code:

public plugin_init()
      set_task(120.0, "function", 0);
public function()
{
        //loop alive players and make you thingys.
}


ConnorMcLeod 01-10-2009 08:41

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
1 Attachment(s)
Try this.

X0Left4dead0X 01-10-2009 09:24

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
Quote:

Originally Posted by SnoW (Post 741581)
This is scripting help, where you can ask help with your scripting. You don't ask here someone to test your code. What are you even doing, if you want this code for yourself, I doubt that you have a server to test this. You should really read the rules, because bump time is 2 weeks. I don't understand even what are you doing, why do you get that time into this? If you want to do it to make something every 2 mins, use set_task. Also as I said, don't use client_authorized.

EDIT: Btw:
Code:

public plugin_init()
      set_task(120.0, "function", 0);
public function()
{
        //loop alive players and make you thingys.
}


Don't post if your not gonna be help full.

Thank you connormclead is it possible to get more ammo like on every weapon in 2 minutes
and make it say above the health bar Ammo regen in %s seconds

ConnorMcLeod 01-10-2009 10:11

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
1 Attachment(s)
Untested.

Edit top of .sma if you want to regen ammo faster :

#define TIME_IN_SECONDS 60

SnoW 01-10-2009 11:29

Re: Ammo regen in every 2 mins + The screen so you can when it goes down please help.
 
Quote:

Originally Posted by X0Left4dead0X (Post 741598)
Don't post if your not gonna be help full.

If you thougth that you got no help from my post then it's fine. Still I think it was really helpful. It doesn't matter do I post "Oh my friend" and smile faces after that, People understand much better if you make simple phrases and don't talk trash.


All times are GMT -4. The time now is 09:14.

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