Raised This Month: $ Target: $400
 0% 

double check source for starthp.sma


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oat
New Member
Join Date: Mar 2006
Old 05-07-2006 , 14:58   double check source for starthp.sma
Reply With Quote #1

Starthp.amxx

This is my first plug-in. I’m not submitting it because it has already been made and a lot of the source is from the tutorial. So far I haven’t had any one on one help and nobody has double checked my source. I posted here because I would like suggestions before I continue scripting.


Thanks...

The AMXX Community for your...
Support of amateur scripters
Bailopen for your...
Amazing Tutorial & AMX Mod X Studio
Jonny Got His Gun for your...
Weapon Arena Plug-in & Inspiration
Team OAT for...
Letting me use their server to test
BDC (Blue Delusion Coders) for...
Inspiration and support
Bob Fincheimer for...
Inspiration
Everybody else I forgot! Sorry!

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "StartHP" #define VERSION "1.0" #define AUTHOR "OAT|BDC" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("amx_starthp", "100")     register_logevent("event_roundstart", 2, "0=World triggered", "1=Round_Start" )   } /* public client_disconnect(id) {    remove_task(id)    return PLUGIN_HANDLED } */ public event_roundstart() {     new players[32], num     get_players(players, num)     new i     for (i=0; i<num; i++)     {         if (get_cvar_num("amx_starthp") > 0)         {         set_user_health(players[i], get_cvar_num("amx_starthp"))         }     } }     //StartAP: cs_set_user_armor /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par } */
__________________
K.I.S.S. Keep It Simple Stupid
oat is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-07-2006 , 15:31  
Reply With Quote #2

Looks fine to me.

You should add the "a" flag to get_players so it doesn't return dead players:
Code:
get_players(players, num, "a")
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 05-07-2006 , 21:47  
Reply With Quote #3

This code will run a bit faster.

Code:
public event_roundstart() {     new starthp = get_cvar_num("amx_starthp")     if (starthp)     {         new players[32], num         get_players(players, num, "a")                 new i         for (i = 0; i < num; i++)         {             set_user_health(players[i], starthp)         }     } }
__________________
FatalisDK is offline
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 05:11.


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