Half-Life и Adrenaline Gamer форум

Всё об игре в Халф-Лайф и АГ
Текущее время: 07 май 2024, 05:38

Часовой пояс: UTC + 5 часов [ Летнее время ]




Начать новую тему Ответить на тему  [ Сообщений: 6 ] 
Автор Сообщение
 Заголовок сообщения: Cs plugin to HL !
СообщениеДобавлено: 07 май 2015, 10:00 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
04 май 2024, 03:13
Сообщения: 1025
How can I convert plugin Cs to HL !
For example, I want to change this teams Cs to Teams HL !
 
Код:
public joined_msg(user[]) {
    if (get_cvar_num("amx_join_leave")==0) return PLUGIN_HANDLED
    new username[32]
    get_user_name(user[0], username, 31)
    new message[192]
    get_cvar_string("amx_joined_message", message, 191)
    replace(message, 191, "#name", username)

    //Checks for team
    new CsTeams:userTeam = cs_get_user_team( user[0] )
    if( userTeam == CS_TEAM_T ){
      replace(message, 191, "#team_msg", "joined the Terrorist Force!")
    }
    else if( userTeam == CS_TEAM_CT ){
      replace(message, 191, "#team_msg", "joined the Counter-Terrorist Force!")
    }
    else if( userTeam == CS_TEAM_SPECTATOR ){
      replace(message, 191, "#team_msg", "is Spectating.")
    }
    else{
      if (get_cvar_num("amx_join_leave_idler")==1)
        replace(message, 191, "#team_msg", "is choosing a team...")
      set_task(10.0, "joined_msg", 0, user, 1)
    }
    set_hudmessage(0, 225, 0, -1.0, 0.79, 0, 6.0, 6.0, 0.5, 0.15, 3)
    if( !containi(message, "#team") )
       show_hudmessage(0, message)
    return PLUGIN_CONTINUE
}
That's what I did
Код:
#include <hl>
Код:
public joined_msg(user[]) {
    if (get_cvar_num("amx_join_leave")==0) return PLUGIN_HANDLED
    new username[32]
    get_user_name(user[0], username, 31)
    new message[192]
    get_cvar_string("amx_joined_message", message, 191)
    replace(message, 191, "#name", username)

    //Checks for team
    new hlTeams:userTeam = hl_get_user_team( user[0] )
    if( userTeam == HL_TEAM_Iron ){
      replace(message, 191, "#team_msg", "joined the Iron-Man Force!")
    }
    else if( userTeam == HL_TEAM_Bat ){
      replace(message, 191, "#team_msg", "joined the Bat-Man Force!")
    }
    else if( userTeam == HL_TEAM_SPECTATOR ){
      replace(message, 191, "#team_msg", "is Spectating.")
    }
    else{
      if (get_cvar_num("amx_join_leave_idler")==1)
        replace(message, 191, "#team_msg", "is choosing a team...")
      set_task(10.0, "joined_msg", 0, user, 1)
    }

    set_hudmessage(0, 225, 0, -1.0, 0.79, 0, 6.0, 6.0, 0.5, 0.15, 3)
    if( !containi(message, "#team") )
       show_hudmessage(0, message)
    return PLUGIN_CONTINUE
}

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Cs plugin to HL !
СообщениеДобавлено: 07 май 2015, 11:52 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
03 май 2024, 14:48
Сообщения: 6867
You moved in a right direction.
The code you showed could be right or a bit wrong, depending on the code you didn't showed.
Stock hl_get_user_team returns team ID. Simply saying: it returns just a team number (1,2,3, etc). 0 for spectators, or if mp_teamplay is 0.
So, if you properly specified hlTeams enum, then you did well. Or you can just do so:
Код:
   new userTeam = hl_get_user_team( user[0] )
    if( userTeam == 1 ){


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Cs plugin to HL !
СообщениеДобавлено: 07 май 2015, 16:54 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
04 май 2024, 03:13
Сообщения: 1025
Код:
   new userTeam = hl_get_user_team( user[0] )
    if( userTeam == 1 ){
[/quote]

Код:
 error 017: undefined symbol "hl_get_user_team"

Код:
public joineds_msg(user[]) {
if (get_cvar_num("amx_join_leave")==0) return PLUGIN_HANDLED
new username[32]
get_user_name(user[0], username, 31)
new message[192]
get_cvar_string("amx_joined_message", message, 191)
replace(message, 191, "#name", username)

//Checks for team
   new userTeam = hl_get_user_team( user[0] )
    if( userTeam == 1 ){
replace(message, 191, "#team_msg", "joined the Bat-Man Force!")
}
else if( userTeam == 2 ){
replace(message, 191, "#team_msg", "joined the Iron-Man Force!")
}
else if( userTeam == 0 ){
replace(message, 191, "#team_msg", "is Spectating.")
}
else{
if (get_cvar_num("amx_join_leave_idler")==1)
replace(message, 191, "#team_msg", "is choosing a team...")
set_task(10.0, "joined_msg", 0, user, 1)
}
set_hudmessage(0, 225, 0, -1.0, 0.79, 0, 6.0, 6.0, 0.5, 0.15, 3)
if( !containi(message, "#team") )
show_hudmessage(0, message)
return PLUGIN_CONTINUE
}

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Cs plugin to HL !
СообщениеДобавлено: 07 май 2015, 17:03 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
03 май 2024, 14:48
Сообщения: 6867
You should download hl.inc file and put it to your includes folder: http://aghl.ru/forum/viewtopic.php?f=39&t=59.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Cs plugin to HL !
СообщениеДобавлено: 07 май 2015, 18:08 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
04 май 2024, 03:13
Сообщения: 1025
im used this http://aghl.ru/webcompiler/

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Cs plugin to HL !
СообщениеДобавлено: 08 май 2015, 01:50 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
03 май 2024, 14:48
Сообщения: 6867
Then you missed #include <hl> in the beginning of the file.


Вернуться к началу
 Профиль 
  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 6 ] 

Часовой пояс: UTC + 5 часов [ Летнее время ]


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 5


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
Создано на основе phpBB® Forum Software © phpBB Group
Русская поддержка phpBB