/* ammx编写头版 by Devzone*/
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "插件名"
#define VERSION "1.0"
#define AUTHOR "DSHGFHDS"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("logevent_round_start",2, "1=Round_Start") //这个是注册开局函数,每一局的开始,都会触发
}
public logevent_round_start()
{
for(new i = 1; i < 33; i ++) //由于这个函数不带有玩家的id,所以要循环所有玩家来获取玩家ID
{
if(!is_user_alive(i)) //这个是用来判断玩家i是否是活着的,如果玩家i不是活着的,就跳过这次循环.
continue
give_weapon(i, CSW_AK47, 90)
give_weapon(i, CSW_M4A1, 90)
client_print(player, print_chat, "你得到AK+M4 插件作者DS")
}
}
stock give_weapon(iPlayer, weaponid, ammo) //这是一个功能函数,你无须理解,使用便可以了
{
new weaponname[32]
get_weaponname(weaponid, weaponname, charsmax(weaponname))
new iEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, weaponname))
new Float:vecOrigin[3]
pev(iPlayer, pev_origin, vecOrigin)
set_pev(iEntity, pev_origin, vecOrigin)
set_pev(iEntity, pev_spawnflags, SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, iEntity)
dllfunc(DLLFunc_Touch, iEntity, iPlayer)
set_pdata_int(iPlayer, 376+get_pdata_int(iEntity, 49, 4), ammo, 4)
}