Разработчик
Скриптер
Участник
Пользователь
- Сообщения
- 1,698
- Реакции
- 1,510
- Помог
- 26 раз(а)
wellasgood, client_print(id, print_console ?
Natives:
/*
* Get sql data
*
* @param data
* @param num
* @param len
*/
native pigwar_get_sql_data(data[], num, len)
/*
* Get row names data
*
* @param data
* @param num
* @param len
*/
native pigwar_get_row_names(data[], num, len)
Forward:
/*
* Called after running native pigwar_check_sql_initialized (), to intercept sql_tuple initialization data
*
* param Handle:SQL_Tuple (the sql descriptor that you can use to connect, do not release it)
*
* sends information about sql_tuple data initialization
*/
forward sql_initialized(Handle:SQL_Tuple)
Сверху:
enum _:SqlCvarData
{
SQL_HOST[64],
SQL_USER[64],
SQL_PASS[64],
SQL_DB[64],
SQL_TABLE_STATS[64],
SQL_TABLE_SERVERS[64],
MAX_STATS,
RATING_NAMES
};
eSqlCvarData[SqlCvarData];
далее идет bind_pcvar_string
Далее:
enum _:RowIds
{
ROW_ID,
ROW_NAME,
ROW_STEAM,
ROW_IP,
ROW_ATTACKER,
ROW_VICTIM,
ROW_SURVIVOR,
ROW_RATING,
ROW_SERVER,
ROW_TOTAL_ENTRIES
};
new const RowNames[RowIds][] =
{
"id",
"name",
"steam",
"ip",
"attacker",
"victim",
"survivor",
"rating",
"server",
"total_entries"
};
Нативные:
public native_get_sql_data(params) //получить данные sql
{
enum
{
arg_buff = 1,
arg_num,
arg_len
};
set_string(arg_buff, eSqlCvarData[get_param(arg_num)], get_param(arg_len));
}
public native_get_row_names(params)
{
enum
{
arg_buff = 1,
arg_num,
arg_len
};
set_string(arg_buff, RowNames[get_param(arg_num)], get_param(arg_len));
}
public GetData()
{
new tb_stats[64], tb_servers[64];
pigwar_get_sql_data(tb_stats, 4, cm(tb_stats)); //4 цифра по счету в enum плагина A
pigwar_get_row_names(tb_servers, 5, cm(tb_servers)); //5 цифра по счету в enum плагина A
}
//форвард перехват результата запроса native pigwar_check_sql_initialized()
public sql_initialized(Handle:tuple)
{
SQL_Tuple = tuple;
}
SQL ERROR #1103, Incorrect table name ''
SQL ERROR #1103, Incorrect table name ''
SQL ERROR #1146, Table 'pigwar.steam' doesn't exist
SQL ERROR #1146, Table 'pigwar.steam' doesn't exist
SQL ERROR #1146, Table 'pigwar.steam' doesn't exist
write_file(путь, строка, -1);
строка ;(последняя строка)
строка ;(новая строка)
строкастрока (посл + новая)
Из-за каретки. Функция write_file вставляет в конец файла только символ перевода строки ("\n" (unix-style), а не "\r\n" (windows-style)).В чем может быть причина такого эффекта?
В конец файла можно записывать функциями fopen + fputs* @note This native is expensive. Consider the use of new file natives (fopen(), fputs(), etc.)
* if purpose is to write several lines of a file.
new Data[128], Float:Origin[COORD_DATA];
new f = fopen(MapPath, "rt");
new Type[1], Coord_X[13], Coord_Y[13], Coord_Z[13];
while(!feof(f))
{
fgets(f, Data, charsmax(Data));
trim(Data);
if(!Data[0])
{
continue;
}
parse(Data, Type, 1, Coord_X, charsmax(Coord_X), Coord_Y, charsmax(Coord_Y), Coord_Z, charsmax(Coord_Z));
Origin[X] = str_to_float(Coord_X);
Origin[Y] = str_to_float(Coord_Y);
Origin[Z] = str_to_float(Coord_Z);
log_amx("%f %f %f", Origin[X], Origin[Y], Origin[Z]);
}
fclose(f);
}
CreateEnt(PlayerID, check_model)
{
if((Entity[PlayerID] = rg_create_entity("info_target")))
{
set_entvar(Entity[PlayerID], var_classname, "_male_sexual_organ");
set_entvar(Entity[PlayerID], var_model, check_model == 1 ? SMALL_ORGAN_MODEL : BIG_ORGAN_MODEL);
set_entvar(Entity[PlayerID], var_modelindex, check_model == 1 ? ModelIndex[0] : ModelIndex[1]);
set_entvar(Entity[PlayerID], var_movetype, MOVETYPE_FOLOW);
set_entvar(Entity[PlayerID], var_aiment, PlayerID);
set_entvar(Entity[PlayerID], var_frame, 0.0);
set_entvar(Entity[PlayerID], var_framerate, FRAME_RATE_MODEL);
set_entvar(Entity[PlayerID], var_sequence, 0);
set_entvar(Entity[PlayerID], var_animtime, get_gametime());
}
}
SetOrgan(PlayerID)
{
if(Entity[PlayerID] && is_entity(Entity[PlayerID]))
{
set_entvar(Entity[PlayerID], var_body, 0);
Check[PlayerID] = true;
}
}
stock UTIL_PlayerAnimation(pPlayer, const szAnimation[])
{
new iAnimDesired, Float:flFrameRate, Float:flGroundSpeed, bool:bLoops;
if((iAnimDesired = lookup_sequence(pPlayer, szAnimation, flFrameRate, bLoops, flGroundSpeed)) == -1) iAnimDesired = 0;
new Float:flGametime = get_gametime();
set_entvar(pPlayer, var_frame, 0.0);
set_entvar(pPlayer, var_framerate, 1.0);
set_entvar(pPlayer, var_animtime, flGametime);
set_entvar(pPlayer, var_sequence, iAnimDesired);
set_pdata_int(pPlayer, m_fSequenceLoops, bLoops, linux_diff_animating);
set_pdata_int(pPlayer, m_fSequenceFinished, 0, linux_diff_animating);
set_pdata_float(pPlayer, m_flFrameRate, flFrameRate, linux_diff_animating);
set_pdata_float(pPlayer, m_flGroundSpeed, flGroundSpeed, linux_diff_animating);
set_pdata_float(pPlayer, m_flLastEventCheck, flGametime, linux_diff_animating);
set_pdata_int(pPlayer, m_Activity, ACT_RANGE_ATTACK1, linux_diff_player);
set_pdata_int(pPlayer, m_IdealActivity, ACT_RANGE_ATTACK1, linux_diff_player);
set_pdata_float(pPlayer, m_flLastAttackTime, flGametime, linux_diff_player);
}
UTIL_PlayerAnimation(Entity[PlayerID], "idle");
Limbooc,wellasgood, maybe stock,
Код:stock UTIL_PlayerAnimation(pPlayer, const szAnimation[]) { new iAnimDesired, Float:flFrameRate, Float:flGroundSpeed, bool:bLoops; if((iAnimDesired = lookup_sequence(pPlayer, szAnimation, flFrameRate, bLoops, flGroundSpeed)) == -1) iAnimDesired = 0; new Float:flGametime = get_gametime(); set_entvar(pPlayer, var_frame, 0.0); set_entvar(pPlayer, var_framerate, 1.0); set_entvar(pPlayer, var_animtime, flGametime); set_entvar(pPlayer, var_sequence, iAnimDesired); set_pdata_int(pPlayer, m_fSequenceLoops, bLoops, linux_diff_animating); set_pdata_int(pPlayer, m_fSequenceFinished, 0, linux_diff_animating); set_pdata_float(pPlayer, m_flFrameRate, flFrameRate, linux_diff_animating); set_pdata_float(pPlayer, m_flGroundSpeed, flGroundSpeed, linux_diff_animating); set_pdata_float(pPlayer, m_flLastEventCheck, flGametime, linux_diff_animating); set_pdata_int(pPlayer, m_Activity, ACT_RANGE_ATTACK1, linux_diff_player); set_pdata_int(pPlayer, m_IdealActivity, ACT_RANGE_ATTACK1, linux_diff_player); set_pdata_float(pPlayer, m_flLastAttackTime, flGametime, linux_diff_player); }
UTIL_PlayerAnimation(Entity[PlayerID], "idle");
\Male_sexual_organ.sma(224) : warning 213: tag mismatch
\Male_sexual_organ.sma(224) : error 017: undefined symbol "linux_diff_animating"
\Male_sexual_organ.sma(224) : error 088: number of arguments does not match definition
\Male_sexual_organ.sma(225) : warning 213: tag mismatch
\Male_sexual_organ.sma(225) : error 017: undefined symbol "linux_diff_animating"
\Male_sexual_organ.sma(225) : error 088: number of arguments does not match definition
\Male_sexual_organ.sma(226) : warning 213: tag mismatch
\Male_sexual_organ.sma(226) : error 017: undefined symbol "linux_diff_animating"
\Male_sexual_organ.sma(226) : error 088: number of arguments does not match definition
\Male_sexual_organ.sma(227) : warning 213: tag mismatch
\Male_sexual_organ.sma(227) : error 017: undefined symbol "linux_diff_animating"
\Male_sexual_organ.sma(227) : error 088: number of arguments does not match definition
\Male_sexual_organ.sma(228) : warning 213: tag mismatch
\Male_sexual_organ.sma(228) : error 017: undefined symbol "linux_diff_animating"
\Male_sexual_organ.sma(228) : error 088: number of arguments does not match definition
\Male_sexual_organ.sma(229) : warning 213: tag mismatch
\Male_sexual_organ.sma(229) : warning 213: tag mismatch
\Male_sexual_organ.sma(229) : error 017: undefined symbol "linux_diff_player"
\Male_sexual_organ.sma(229) : error 088: number of arguments does not match definition
\Male_sexual_organ.sma(230) : warning 213: tag mismatch
\Male_sexual_organ.sma(230) : warning 213: tag mismatch
\Male_sexual_organ.sma(230) : error 017: undefined symbol "linux_diff_player"
\Male_sexual_organ.sma(230) : error 088: number of arguments does not match definition
\Male_sexual_organ.sma(231) : error 017: undefined symbol "m_flLastAttackTime"
\Male_sexual_organ.sma(231) : warning 215: expression has no effect
\Male_sexual_organ.sma(231) : error 017: undefined symbol "linux_diff_player"
\Male_sexual_organ.sma(231) : error 029: invalid expression, assumed zero
\Male_sexual_organ.sma(231) : fatal error 107: too many error messages on one line