|
发表于 2008-1-6 14:55:15
|
显示全部楼层
来自 智利
回复: 那位高手帮我写一个插件
果然不去测试不行啊~ 原来的代码只是检测只要一边的队伍赢了50局, 而不是整个盘赢了50局, 现在这应该是正确代码了:- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- new a_score = 0
- new b_score = 0
- public restart(time[]) {
- set_cvar_string("sv_restart", time)
- return PLUGIN_CONTINUE
- }
- public score_new() {
- new team[32]
- read_data(1, team, 31)
- if(team[0] == 'C') {
- a_score = read_data(2)
- } else if(team[0] == 'T') {
- b_score = read_data(2)
- }
- new totalScore = a_score + b_score
- if(totalScore == 50) {
- new playersCT[32]
- new playersT[32]
- new nbrCT, nbrT
- get_players(playersCT,nbrCT,"e","CT")
- get_players(playersT,nbrT,"e","TERRORIST")
- for(new i = 0; i < nbrCT; i++) {
- cs_set_user_team(playersCT[i], CS_TEAM_T)
- }
- for(new i = 0; i < nbrT; i++) {
- cs_set_user_team(playersT[i], CS_TEAM_CT)
- }
- set_task(5.0, "restart", 0, "1", 1)
- }
- return PLUGIN_CONTINUE
- }
- public plugin_init() {
- register_plugin("50 Rounds Swap Restart", "1.0", "Codetrinis")
- register_event("TeamScore", "score_new", "a")
- return PLUGIN_CONTINUE
- }
复制代码 |
|