|
发表于 2012-10-28 10:29:42
|
显示全部楼层
|阅读模式
来自 中国–山东–淄博
本帖最后由 css 于 2012-10-31 10:02 编辑
很多玩家对于放置实体广告很陌生
看看翻译的源码吧
一共4个命令就可以放置,能学会了吧
+place_ad 建议对着墙壁 打开此命里的菜单 里面可缩放(有菜单 等同命令-place_ad)
delete_ad 打开菜单选择要删除的实体
iga_closer 使用此命令让实体靠近你(无菜单)
iga_father 使用此命令让实体远离你(等同命令iga_further)
实体可以是mdl和spr
[code]#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#define CONFIG_FOLDERNAME "In-Game Ads"
#define MAIN_PRECACHE_FILE "precache_list.cfg"
#define MAIN_PRECACHE_FILE_TEXT "// 看到您的模型mdl或菜单中的动画spr,它的完整路径.^n// 例如:^n//models/wall.mdl^n//models/player.mdl^n//sprites/custom/sprite.spr^n//^n^n^n"
#define ERROR_FILE_NOT_FOUND "出错: 失败缓存载入 precache/load (%s), model/sprite 目录不存在."
#define ERROR_USER_ALREADY_PLACING "出错: 一个以上的用户放置广告!"
#define ERROR_USER_ALREADY_DELETING "出错: 一个以上的用户删除的广告!"
#define MENU_SAVE_TEXT "保存这个实体?^n^n1. 是,保存它.^n0. 不, 删除它.^n"
#define MENU_SELECT_TEXT_CHOOSE_MODEL "选择一个: %i/%i^n^n"
#define MENU_SELECT_TEXT_OPTIONS_1 "^n6. 延展向上^n7. 延展向下^n^n8. 保存这个实体!^n^n9. 更多...^n0. %s"
#define MENU_SELECT_TEXT_OPTIONS_2 "^n6. 延展向上^n7. 延展向下^n^n8. 保存这个实体!^n^n0. %s"
#define MENU_DELETE_TEXT_HEADER "删除一个实体: %i/%i^n(选择一个在地图上高亮显示)^n^n"
#define MENU_DELETE_TEXT_OPTIONS_1 "^n^n9.更多...^n0.%s"
#define MENU_DELETE_TEXT_OPTIONS_2 "^n^n0.%s"
#define MENU_DELETE_TEXT_CONFIRM "删除选中的实体?^n^n1. 是, 删除它.^n0. 取消.^n"
#define MENU_TEXT_PREVIOUS "前一页"
#define MENU_TEXT_EXIT "退出"
//every X frames the ad's origin/angles will be updated每一个X帧的广告坐标/角度将更新
#define PRETHINK_REFRESH_TIME 5
//distance to move the entity away or towards the client多少距离可移动实体,或朝向客户
#define MOVE_DISTANCE 5.0
//amount to scale the sprites, for example文件spr延展缩放量, 1.00 - 0.01 = 0.99, 0.99 - 0.01 = 0.98
#define SCALE_AMOUNT 0.01
//model used to hilite before an ad is deleted在一个广告删除之前用什么模型作为标记
#define DELETE_ICON_PATH "models/chick.mdl"
//广告实体在当前地图的最大数字
#define MAX_NUMBER_OF_ADS 32
//最大数字 models/sprites 可以从选择菜单中出现
#define MAX_AD_MODELS 16
//最大长度的完整文件名 一个 model/sprite, eg. "sprites/advert/bloodservers.spr"
#define MAX_MODEL_NAMELEN 48
//models/sprites 类名
#define MODEL_CLASSNAME "stupok_ad"
//这个命令可用权限等级
#define ADMIN_ACCESS_LEVEL ADMIN_BAN
//Do not change below不要更改以下
#define MENU_SELECT_SIZE (128 + (MAX_AD_MODELS * MAX_MODEL_NAMELEN))
#define MENU_SELECT_OPTIONS_NUM 5
#define MENU_DELETE_SIZE (128 + (MAX_AD_MODELS * MAX_MODEL_NAMELEN))
#define MENU_DELETE_OPTIONS_NUM 7
//不要更改以上
//names of the models that are precached on the map的模型名称,在地图上预缓存
new g_precached_model_list[MAX_AD_MODELS][MAX_MODEL_NAMELEN]
new g_precached_model_list_len
//index of the model selected for creation or deletion创建或删除选择的模型索引
new g_selected_model_index
new g_delete_model_index
//current page on the menu在菜单上的当前页
new g_menu_select_current_page
new g_menu_delete_current_page
//names/indexes of the models that are placed on the map被放置在地图上的模型名称/索引
new g_map_model_entindex_list[MAX_NUMBER_OF_ADS]
new g_map_model_list[MAX_AD_MODELS][MAX_MODEL_NAMELEN]
new g_map_model_list_len
//creating/deleting/modifying this ent创建/删除/修改此ENT
new g_ent
new Float:g_aim_origin[3]
new Float:g_ent_angles[3]
//one user may use this plugin at a time一个用户可以在同一时间使用这个插件
new g_ad_placer_id = -1
new bool:g_is_user_placing_ad = false
new g_prethink_counter
//names
new g_filename[256]
new g_mapname[32]
//is the model for hiliting deletions precached?是的模型为hiliting(便于搜索的标记)删除预取 是否删除缓存的图标标记?
new bool:g_is_deleteicon_precached = false
//forward for player prethink 在前面为玩家预想 操作
new fw_ppt
public plugin_init()
{
register_plugin("In-Game Ads", "1.83", "stupok")
register_clcmd("+place_ad", "cmd_place_ad", ADMIN_ACCESS_LEVEL) //两个命令一致 命令放置广告打开菜单
register_clcmd("-place_ad", "cmd_place_ad", ADMIN_ACCESS_LEVEL) //两个命令一致
register_clcmd("delete_ad", "cmd_delete_ad", ADMIN_ACCESS_LEVEL) //删除命令
register_clcmd("iga_closer", "cmd_move_toward_client", ADMIN_ACCESS_LEVEL) //客户对着实体,命令移动实体,让实体靠近你
//例如 对着实体执行,实体会改变角度和位置,变得与你的视角垂直
register_clcmd("iga_farther", "cmd_move_away_from_client", ADMIN_ACCESS_LEVEL) //两个命令一致 让实体远离你
register_clcmd("iga_further", "cmd_move_away_from_client", ADMIN_ACCESS_LEVEL) //两个命令一致
register_menucmd(register_menuid("广告保存菜单"), MENU_KEY_1|MENU_KEY_0, "Pressedmenu_save")
register_menucmd(register_menuid("广告选择菜单"), 1023, "Pressedmenu_select")
register_menucmd(register_menuid("广告删除菜单"), 1023, "Pressedmenu_delete")
register_menucmd(register_menuid("广告确认菜单"), MENU_KEY_1|MENU_KEY_0, "Pressedmenu_confirm")
load_saved_ads(g_filename)
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|