masher0782 发表于 2008-4-26 22:05:45

本菜鸟蛋壳第三次写插件还是失败了,各位老鸟来批评下..

修改自start_hp插件 介入start_armor功能
看截图

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "Starting Health or Armor"
#define VERSION "1.0"
#define AUTHOR "mashihao"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "NewRound", "a", "1=0", "2=0")
register_event("TeamInfo","new_player","a","2=CT","2=TERRORIST")
register_cvar("amx_starthp","100")
register_cvar("amx_startar","100")
}
public new_player()
{
new id = read_data(1)

if(is_user_connected(id) && is_user_alive(id))
set_user_health(id,get_cvar_num("amx_starthp"))
set_user_armor(id,get_cvar_num("amx_startar"))
}

public NewRound()
set_task(0.1,"set_health")
set_task(0.1,"set_armor")

public set_health()
for(new i = 0; i <= get_playersnum(); ++i)
if(is_user_connected(i) && is_user_alive(i))
set_user_health(i,get_cvar_num("amx_starthp"))
public set_armor()
for(new l = 0; l <= get_playersnum(); ++l)
if(is_user_connected(l) && is_user_alive(l))
set_user_armor(l,get_cvar_num("amx_startar"))
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

zwfgdlc 发表于 2008-4-26 22:35:36

回复: 本菜鸟蛋壳第三次写插件还是失败了,各位老鸟来批评下..


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("ResetHUD", "eResetHUD", "be")
register_cvar("amx_starthp","100")
register_cvar("amx_startar","100")
}
public new_player()
{
new id = read_data(1)

if(is_user_connected(id) && is_user_alive(id))
set_user_health(id,get_cvar_num("amx_starthp"))
set_user_armor(id,get_cvar_num("amx_startar"))
}

Arvy 发表于 2008-4-26 22:54:50

回复: 本菜鸟蛋壳第三次写插件还是失败了,各位老鸟来批评下..

Post by zwfgdlc

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("ResetHUD", "eResetHUD", "be")
register_cvar("amx_starthp","100")
register_cvar("amx_startar","100")
}
public eResetHUD()
{
new id = read_d...

我也是这样想的,不过我的代码不知道能不能用?


#include <amxmodx>
#include <amxmisc>
#include <fun>
public plugin_init() {
register_plugin("xxx","xxx","xxx")
register_event("ResetHUD", "new_round", "be")
register_cvar("amx_start_hp","100")
register_cvar("amx_startar","100")
return PLUGIN_CONTINUE
}
public new_round(id) {
      {
set_user_health(id,get_cvar_num("amx_start_hp"))
                set_user_armor(id,get_cvar_num("amx_startar"))
}
return PLUGIN_CONTINUE
}

zwfgdlc 发表于 2008-4-26 23:05:06

回复: 本菜鸟蛋壳第三次写插件还是失败了,各位老鸟来批评下..

Post by Arvy
我也是这样想的,不过我的代码不知道能不能用?
没错,是我弄错了.:cold:

Rulzy 发表于 2008-4-27 18:54:23

回复: 本菜鸟蛋壳第三次写插件还是失败了,各位老鸟来批评下..

楼主需要注意的是{}的使用!

masher0782 发表于 2008-4-27 21:36:11

回复: 本菜鸟蛋壳第三次写插件还是失败了,各位老鸟来批评下..

谢谢各位.................
页: [1]
查看完整版本: 本菜鸟蛋壳第三次写插件还是失败了,各位老鸟来批评下..