- Регистрация
- 29 Сен 2013
- Сообщения
- 110
- Лучшие ответы
- 0
- Репутация
- 3
Добрый день, помогите пожалуйста поставить правильно проверку
команда /call
Вот сама проверка, у меня она не работает
Ну и с командой /sms
команда /call
PHP:
CMD:call ( playerid, params [ ] )
{
new id_playerid=-1,id_params=-1;
if ( GetPVarInt ( playerid, "PlayerCuffed" ) )return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Вы в наручниках." ) ;
if ( GetPVarInt ( playerid, "PlayerTied" ) )return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Вы связаны." ) ;
if ( ! p_info [ playerid ] [ number ] ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}У вас нет телефона." ) ;
if ( ! p_t_info [ playerid ] [ phone_toggled ] ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}У вас отключен мобильный телефон." ) ;
if ( id_playerid ==- 1 ) return SendClientMessage(playerid,-1,""#net"Игрок не в зоне действий вышек связи!");
if ( id_params ==- 1 ) return SendClientMessage(playerid,-1,""#net"Вы не в зоне действия вышки связи!");
if ( p_t_info [ playerid ] [ phone_id ] != INVALID_PLAYER_ID || is_ether_calling { playerid } != 0 ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Закончите текущий разговор." ) ;
if ( p_info [ playerid ] [ phone_balance ] < 1 ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Баланс вашего телефона равен нулю." ) ;
if ( is_ether { playerid } != 0 )return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Вы не можете говорить по телефону во время эфира." ) ;
if ( sscanf ( params, "d", params [ 0 ] ) ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Используйте: /call [номер]" ) ;
if ( p_info [ playerid ] [ number ] == params [ 0 ] ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Вы не можете звонить самому себе." ) ;
if ( params [ 0 ] == 0 ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Данный номер не существует." ) ;
for(new i; i < TOTAL_VISHKA; i++)
{
if(MobileSystem[i][m_Status] && IsPlayerToSquare(1000,playerid,MobileSystem[i][m_Pos][0],MobileSystem[i][m_Pos][1],MobileSystem[i][m_Pos][2])) id_playerid = true;
if(MobileSystem[i][m_Status] && IsPlayerToSquare(1000,params[0],MobileSystem[i][m_Pos][0],MobileSystem[i][m_Pos][1],MobileSystem[i][m_Pos][2])) id_params = true;
}
if ( params [ 0 ] == 911 )
{
show_dialog ( playerid, d_service, DIALOG_STYLE_LIST, "{"#cYW"}Сервисы", "Полиция\nСкорая помощь\nТакси\nМеханик\nДоставка продуктов", "Выбрать", "Назад" ) ;
return 1 ;
}
if ( params [ 0 ] == f_info [ 25 ] [ f_materials ] && cas_price [ 0 ] != 0 )
{
new scm_string [ 98 ] ;
format ( scm_string, sizeof scm_string, "{ffffff}Стоимость звонка: %d$.\n\nВы действительно хотите позвонить?",
cas_price [ 0 ] ) ;
show_dialog ( playerid, d_ether_calling, DIALOG_STYLE_MSGBOX, "{"#cYW"}Звонок на прямой эфир", scm_string, "Да", "Нет" ) ;
is_ether_calling { playerid } = 26 ;
return 1 ;
}
if ( params [ 0 ] == f_info [ 26 ] [ f_materials ] && cas_price [ 1 ] != 0 )
{
new scm_string [ 98 ] ;
format ( scm_string, sizeof scm_string, "{ffffff}Стоимость звонка: %d$.\n\nВы действительно хотите позвонить?",
cas_price [ 1 ] ) ;
show_dialog ( playerid, d_ether_calling, DIALOG_STYLE_MSGBOX, "{"#cYW"}Звонок на прямой эфир",scm_string, "Да", "Нет" ) ;
is_ether_calling { playerid } = 27 ;
return 1 ;
}
if ( params [ 0 ] == f_info [ 27 ] [ f_materials ] && cas_price [ 2 ] != 0 )
{
new scm_string [ 98 ] ;
format ( scm_string, sizeof scm_string, "{ffffff}Стоимость звонка: %d$.\n\nВы действительно хотите позвонить?",
cas_price [ 2 ] ) ;
show_dialog ( playerid, d_ether_calling, DIALOG_STYLE_MSGBOX, "{"#cYW"}Звонок на прямой эфир", scm_string, "Да", "Нет" ) ;
is_ether_calling { playerid } = 28 ;
return 1 ;
}
foreach(new i: logged_players)
{
if ( p_info [ i ][ number ] == params [ 0 ] )
{
if ( ! p_t_info [ i ] [ phone_toggled ] ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}У игрока отключен мобильный телефон." ) ;
if ( p_t_info [ i ] [ phone_id ] != INVALID_PLAYER_ID ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Абонент в данный момент уже с кем-то разговаривает." ) ;
new scm_string [ 128 ] ;
format ( scm_string, 128, "Вы звоните %s (%d). Ожидание ответа…", p_info [ i ] [ name ], p_info [ i ] [ number ] ) ;
SendClientMessage ( playerid, -1, scm_string ) ;
format ( scm_string, 128, "Вам звонит %s (%d). Ответьте на звонок...", p_info [ playerid ] [ name ], p_info [ playerid ] [ number ] ) ;
SendClientMessage ( i, -1, scm_string ) ;
SetPlayerSpecialAction ( playerid,SPECIAL_ACTION_USECELLPHONE);
SetPlayerAttachedObject ( playerid, 3, 18870, 6, 0.09, 0.019, -0.011, 88.90, -176.40, 0.49, 0.787, 0.753, 0.562 ) ;
p_t_info [ playerid ] [ phone_caller ] = 1 ;
p_t_info [ i ] [ phone_id ] = playerid ;
p_t_info [ i ] [ phone_caller ] = 1 ;
return 1;
}
}
return 1;
}
PHP:
new id_playerid=-1,id_params=-1;
if ( id_playerid ==- 1 ) return SendClientMessage(playerid,-1,""#net"Игрок не в зоне действий вышек связи!");
if ( id_params ==- 1 ) return SendClientMessage(playerid,-1,""#net"Вы не в зоне действия вышки связи!");
for(new i; i < TOTAL_VISHKA; i++)
{
if(MobileSystem[i][m_Status] && IsPlayerToSquare(1000,playerid,MobileSystem[i][m_Pos][0],MobileSystem[i][m_Pos][1],MobileSystem[i][m_Pos][2])) id_playerid = true;
if(MobileSystem[i][m_Status] && IsPlayerToSquare(1000,params[0],MobileSystem[i][m_Pos][0],MobileSystem[i][m_Pos][1],MobileSystem[i][m_Pos][2])) id_params = true;
}
PHP:
CMD:sms( playerid, params [ ] )
{
if ( p_info [ playerid ] [ mute ] )
{
new _t_string [ 38 ] ;
format ( _t_string, sizeof ( _t_string ),"У Вас бан чата | %d секунд(ы)", p_info [ playerid ] [ mute ] ) ;
SendClientMessage ( playerid, col_light_red, _t_string ) ;
return false ;
}
if ( GetPVarInt ( playerid, "PlayerCuffed" ) )return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Вы в наручниках." ) ;
if ( GetPVarInt ( playerid, "PlayerTied" ) )return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Вы связаны." ) ;
if ( ! p_info [ playerid ] [ number ] ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}У вас нет телефона." ) ;
if ( ! p_t_info [ playerid ] [ phone_toggled ] ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}У вас отключен мобильный телефон." ) ;
if ( p_info [ playerid ] [ phone_balance ] < 5 ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}У вас нет средств для отправки SMS." ) ;
if ( sscanf ( params, "ds[82]", params [ 0 ], params [ 1 ] ) ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Используйте: /sms [номер] [текст]" ) ;
new id_playerid=-1,id_params=-1;
for(new i; i < TOTAL_VISHKA; i++)
{
if(MobileSystem[i][m_Status] && IsPlayerInRangeOfPoint(1000,playerid,MobileSystem[i][m_Pos][0],MobileSystem[i][m_Pos][1],MobileSystem[i][m_Pos][2])) id_playerid = true;
if(MobileSystem[i][m_Status] && IsPlayerInRangeOfPoint(1000,params[0],MobileSystem[i][m_Pos][0],MobileSystem[i][m_Pos][1],MobileSystem[i][m_Pos][2])) id_params = true;
}
if(id_playerid == -1) return SendClientMessage(playerid,-1,""#net"Вы не в зоне действия вышки связи!");
if(id_params == -1) return SendClientMessage(playerid,-1,""#net"Игрок не в зоне действий вышек связи!");
if ( params [ 0 ] == 0 ) return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Данный номер не существует." ) ;
check_advertise ( playerid, params [ 1 ] ) ;
foreach(new i: logged_players)
{
if ( p_info [ i ][ number ] == params [ 0 ] )
{
if ( i == playerid )return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}Нельзя отправить SMS-самому себе." ) ;
if ( ! p_t_info [ i ] [ phone_toggled ] )
{
return SendClientMessage ( playerid, col_gray,"{"#cRD"}* {"#cGR"}У игрока отключен мобильный телефон." ) ;
}
new scm_string [ 144 ] ;
format ( scm_string, sizeof ( scm_string ), "SMS: %s | Получатель: %s(%i) [т. %i]", params [ 1 ], p_info [ i ] [ name ], i, p_info [ i ] [ number ] ) ;
SendClientMessage ( playerid, col_yellow, scm_string ) ;
format ( scm_string, sizeof ( scm_string ), "SMS: %s | Отправитель: %s(%i) [т. %i]", params [ 1 ], p_info [ playerid ] [ name ], playerid, p_info [ playerid ] [ number ] ) ;
SendClientMessage(i, col_yellow, scm_string ) ;
format ( scm_string, sizeof ( scm_string ), "SMS: %s(%d) to %s(%d) | %s", p_info [ playerid ] [ name ], playerid, p_info [ i ] [ name ], i, params [ 1 ] ) ;
foreach(new j: admin_players)
{
if ( big_ears { playerid } == 0 ) continue ;
SendClientMessage(j, col_yellow, scm_string ) ;
}
PlayerPlaySound ( i, 1052, 0.0, 0.0, 0.0 ) ;
PlayerPlaySound ( playerid, 1052, 0.0, 0.0, 0.0 ) ;
p_info [ playerid ] [ phone_balance ] -- ;
return 1;
}
}
SendClientMessage( playerid, col_gray, "{"#cRD"}* {"#cGR"}В настоящий момент абонент недоступен!" ) ;
return 1;
}