AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   New health every round (https://forums.alliedmods.net/showthread.php?t=47343)

Da_sk8rboy 11-15-2006 17:37

New health every round
 
I cant think of a way to make a users health go up every round.
[Automatically]

LittleDude 11-15-2006 17:49

Re: New health every round
 
register the new round event, and on the event of when the new round starts set the users health to what you want

so like:

Code:
 public plugin_init() {           register_plugin("test", "test", "test")           register_logevent("new_round", 2, "1=Round_Start") } public new_round(id) {           // set health here }

The Specialist 11-15-2006 18:00

Re: New health every round
 
here you go . this will add +10 on there first spawn. +20 on there second. and you can go up from there. basicly it increments the g_iRounds varaible every time the player spawns. (using VEN's theory of spawning:wink: ) . and then jsut get and set health. hope this helps
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define MAX_PLAYERS            32 new bool:g_restart_attempt[MAX_PLAYERS + 1] new g_iRounds[33]; public plugin_init() {  register_plugin("increase_health","0.1","The Specilaist");  register_event("ResetHUD", "event_hud_reset", "be")  register_clcmd("fullupdate", "clcmd_fullupdate")  register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in") } public clcmd_fullupdate() {  return PLUGIN_HANDLED } public event_restart_attempt() {  new players[32], num  get_players(players, num, "a")  for (new i; i < num; ++i)  {   g_restart_attempt[players[i]] = true  } } public event_hud_reset(id) {  if (g_restart_attempt[id])  {   g_restart_attempt[id] = false   return  }  event_player_spawn(id) } public event_player_spawn(id) {  ++g_iRounds[id];    new health = get_user_health(id);    switch(g_iRounds[id])  {   case 0: set_user_health(id,(health + 10));   case 1: set_user_health(id,(health +20));  } }
:up:

LittleDude 11-15-2006 18:01

Re: New health every round
 
you're a god The Specialist lol

The Specialist 11-15-2006 18:04

Re: New health every round
 
Quote:

Originally Posted by LittleDude (Post 403595)
you're a god The Specialist lol

LOL. nope im just a nice guy who's borred :wink:

Da_sk8rboy 11-15-2006 20:49

Re: New health every round
 
case 1: set_user_health(id,(health +20));
Why +20 why not + 20 with a space like you did with 10.

Emp` 11-15-2006 20:52

Re: New health every round
 
or how about just
Code:

set_user_health(id, get_user_health(id) + (10*g_iRounds[id]))

The Specialist 11-15-2006 20:56

Re: New health every round
 
Quote:

Originally Posted by Da_sk8rboy (Post 403634)
case 1: set_user_health(id,(health +20));
Why +20 why not + 20 with a space like you did with 10.

oops lol. i made it in like 3 mins :wink:

Da_sk8rboy 11-15-2006 21:03

Re: New health every round
 
Code:
#include <amxmodx> #include <amxmisc> #include <fun>   #define PLUGIN "Life_Mod" #define VERSION "1.02b" #define AUTHOR "Da_sk8rboy" public plugin_init() {      register_plugin(PLUGIN, VERSION, AUTHOR)      register_concmd("amx_lifemod", "cmd_lifemod", ADMIN_SLAY, "<target> <hp>") }   public cmd_lifemod(id, level, cid) {      if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED        new Arg1[24]      new Arg2[4]        //Get the command arguments from the console      read_argv(1, Arg1, 23)      read_argv(2, Arg2, 3)        //Convert the health from a string to a number      new Health = str_to_num(Arg2)      if(Health < 1)      {           // Print a message saying health has to be greater than 0.           // If they get their health set to less than 1.           // It will kill the player automatically.           return PLUGIN_HANDLED;      }        //Is the first character the @ symbol?      if (Arg1[0] == '@')      {           new Team = 0           if (equali(Arg1[1], "CT"))           {                Team = 2           } else if (equali(Arg1[1], "T")) {                Team = 1           }           new players[32], num           get_players(players, num)           new i           for (i=0; i<num; i++)           {                if (!Team)                {                     set_user_health(players[i], Health)                } else {                     if (get_user_team(players[i]) == Team)                     {                          set_user_health(players[i], Health)                     }                }           }      } else {           new player = cmd_target(id, Arg1, 1)           if (!player)           {                console_print(id, "[LIFE_MOD] Sorry,%s could not be found or targetted!", Arg1)                return PLUGIN_HANDLED           } else {                set_user_health(player, Health)           }      }        return PLUGIN_HANDLED          }

where would i put:
Code:
set_user_health(id, get_user_health(id) + (10*g_iRounds[id]))

The Specialist 11-15-2006 21:09

Re: New health every round
 
well youd have to use my version if you wanted to add that becuase i used a varaible to count rounds . do you want the amount of health to increment each round or jsut liek +10 each round?


All times are GMT -4. The time now is 06:59.

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