Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature currently requires accessing the site using the built-in Safari browser.
#include <amxmodx>
#include <sqlx>
native cmsapi_set_user_flags(index, const szFlags[], iTime = -1, const szServiceName[] = "", bSilent = false)
native cmsstats_get_user_place(iClient);
/*==== настройки ======*/
new g_iLimitForTop = 3; //скок первых n - игроков наградить
new const g_szFlags[] = "zxcvb"; //флаги доступа
new const g_szAward[] = "ТОП за время"; //название награды
/*=====================*/
new Array:g_hArrPlace;
public plugin_init()
{
g_hArrPlace = ArrayCreate();
}
public OnCmsStatsInitializedPost(Handle:g_DbTuple)
{
new szQuery[100];
formatex(szQuery, charsmax(szQuery), "SELECT `place`, MAX(gametime) gametime FROM `csstats_players` GROUP BY gametime DESC LIMIT %d", g_iLimitForTop)
SQL_ThreadQuery(g_DbTuple, "QueryHandler", szQuery);
}
public QueryHandler(failstate, Handle:query, const error[], errornum)
{
if(!SQL_NumResults(query))
{
pause("ad");
return;
}
while(SQL_MoreResults(query))
{
ArrayPushCell(g_hArrPlace, SQL_ReadResult(query, SQL_FieldNameToNum(query, "place")));
SQL_NextRow(query);
}
}
public OnCmsStatsPutinserver(iClient, bool:bExist)
{
if(ArrayFindValue(g_hArrPlace, cmsstats_get_user_place(iClient)) != -1)
cmsapi_set_user_flags(iClient, g_szFlags, -1, g_szAward, true);
}
public plugin_end()
{
if(g_hArrPlace)
ArrayDestroy(g_hArrPlace);
}
супер, спасибоC++:#include <amxmodx> #include <sqlx> native cmsapi_set_user_flags(index, const szFlags[], iTime = -1, const szServiceName[] = "", bSilent = false) native cmsstats_get_user_place(iClient); /*==== настройки ======*/ new g_iLimitForTop = 3; //скок первых n - игроков наградить new const g_szFlags[] = "zxcvb"; //флаги доступа new const g_szAward[] = "ТОП за время"; //название награды /*=====================*/ new Array:g_hArrPlace; public plugin_init() { g_hArrPlace = ArrayCreate(); } public OnCmsStatsInitializedPost(Handle:g_DbTuple) { new szQuery[100]; formatex(szQuery, charsmax(szQuery), "SELECT `place`, MAX(gametime) gametime FROM `csstats_players` GROUP BY gametime DESC LIMIT %d", g_iLimitForTop) SQL_ThreadQuery(g_DbTuple, "QueryHandler", szQuery); } public QueryHandler(failstate, Handle:query, const error[], errornum) { if(!SQL_NumResults(query)) { pause("ad"); return; } while(SQL_MoreResults(query)) { ArrayPushCell(g_hArrPlace, SQL_ReadResult(query, SQL_FieldNameToNum(query, "place"))); SQL_NextRow(query); } } public OnCmsStatsPutinserver(iClient, bool:bExist) { if(ArrayFindValue(g_hArrPlace, cmsstats_get_user_place(iClient)) != -1) cmsapi_set_user_flags(iClient, g_szFlags, -1, g_szAward, true); } public plugin_end() { if(g_hArrPlace) ArrayDestroy(g_hArrPlace); }