#include <sourcemod>
#include <thc_rpg>
public void OnPluginStart()
{
RegConsoleCmd("prestige", Command_Prestige);
}
public Action Command_Prestige(int client, int args)
{
if(thc_rpg_GetLevel(client) > 99)
{
ServerCommand("thc_rpg_resetplayer %N", client);
ServerCommand("thc_rpg_credits set %N 50000", client);
}
else
{
PrintToChat(client, "Получить престиж можно только после достижения уровня 100");
}
return Plugin_Handled;
}
#include <sourcemod>
#include <thc_rpg>
public void OnPluginStart()
{
RegConsoleCmd("prestige", Command_Prestige);
}
public Action Command_Prestige(int client, int args)
{
if(thc_rpg_GetLevel(client) > 99)
{
ServerCommand("thc_rpg_resetplayer %N", client);
CreateTimer(1.0, Timer_Credits, GetClientUserId(client), TIMER_HNDL_CLOSE);
}
else
{
PrintToChat(client, "Получить престиж можно только после достижения уровня 100");
}
return Plugin_Handled;
}
public Action Timer_Credits(Handle hTimer)
{
ServerCommand("thc_rpg_credits set %N 50000", client);
}
Тогда уж так:PHP:#include <sourcemod> #include <thc_rpg> public void OnPluginStart() { RegConsoleCmd("prestige", Command_Prestige); } public Action Command_Prestige(int client, int args) { if(thc_rpg_GetLevel(client) > 99) { ServerCommand("thc_rpg_resetplayer %N", client); CreateTimer(1.0, Timer_Credits, GetClientUserId(client), TIMER_HNDL_CLOSE); } else { PrintToChat(client, "Получить престиж можно только после достижения уровня 100"); } return Plugin_Handled; } public Action Timer_Credits(Handle hTimer) { ServerCommand("thc_rpg_credits set %N 50000", client); }
Хз, мб так прокатит
Кредиты должны устанавливаться через секунду после обнуления игрока
Время можно поменьше поставить
#include <sourcemod>
#include <thc_rpg>
public void OnPluginStart()
{
RegConsoleCmd("prestige", Command_Prestige);
}
public Action Command_Prestige(int client, int args)
{
if(thc_rpg_GetLevel(client) > 99)
{
ServerCommand("thc_rpg_resetplayer %N", client);
CreateTimer(1.0, Timer_Credits, GetClientUserId(client), TIMER_HNDL_CLOSE);
}
else
{
PrintToChat(client, "Получить престиж можно только после достижения уровня 100");
}
return Plugin_Handled;
}
public Action Timer_Credits(Handle hTimer, any UserId)
{
int client = GetClientOfUserId(UserId);
ServerCommand("thc_rpg_credits set %N 50000", client);
}
А что нужно ставить вместо %N, чтоб команда выполнялась по стим ид, а не нику?Тогда уж так:
PHP:#include <sourcemod> #include <thc_rpg> public void OnPluginStart() { RegConsoleCmd("prestige", Command_Prestige); } public Action Command_Prestige(int client, int args) { if(thc_rpg_GetLevel(client) > 99) { ServerCommand("thc_rpg_resetplayer %N", client); CreateTimer(1.0, Timer_Credits, GetClientUserId(client), TIMER_HNDL_CLOSE); } else { PrintToChat(client, "Получить престиж можно только после достижения уровня 100"); } return Plugin_Handled; } public Action Timer_Credits(Handle hTimer, any UserId) { int client = GetClientOfUserId(UserId); ServerCommand("thc_rpg_credits set %N 50000", client); }
Возможно ошибаюсь.А что нужно ставить вместо %N, чтоб команда выполнялась по стим ид, а не нику?
Например, в строке ServerCommand("thc_rpg_credits set %N 50000", client)
GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
ServerCommand("thc_rpg_credits set %s 50000", authid)
Но а потом будут спрашивать, а почему не компилится))Возможно ошибаюсь.
Ну иPHP:GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
p.s Не бейте костылямиPHP:ServerCommand("thc_rpg_credits set %s 50000", authid)
#include <sourcemod>
#include <thc_rpg>
public void OnPluginStart()
{
RegConsoleCmd("prestige", Command_Prestige);
}
public Action Command_Prestige(int client, int args)
{
if(thc_rpg_GetLevel(client) > 99)
{
ServerCommand("thc_rpg_resetplayer %N", client);
CreateTimer(1.0, Timer_Credits, GetClientUserId(client), TIMER_HNDL_CLOSE);
}
else
PrintToChat(client, "Получить престиж можно только после достижения уровня 100");
return Plugin_Handled;
}
public Action Timer_Credits(Handle hTimer, any UserId)
{
int client = GetClientOfUserId(UserId);
if(client)
{
char szAuth[32];
GetClientAuthId(client, AuthId_Engine, szAuth, sizeof szAuth);
ServerCommand("thc_rpg_credits set %s 50000", szAuth);
}
}
Щито поделать, если я не кодер :DНо а потом будут спрашивать, а почему не компилится))
PHP:#include <sourcemod> #include <thc_rpg> public void OnPluginStart() { RegConsoleCmd("prestige", Command_Prestige); } public Action Command_Prestige(int client, int args) { if(thc_rpg_GetLevel(client) > 99) { ServerCommand("thc_rpg_resetplayer %N", client); CreateTimer(1.0, Timer_Credits, GetClientUserId(client), TIMER_HNDL_CLOSE); } else PrintToChat(client, "Получить престиж можно только после достижения уровня 100"); return Plugin_Handled; } public Action Timer_Credits(Handle hTimer, any UserId) { int client = GetClientOfUserId(UserId); if(client) { char szAuth[32]; GetClientAuthId(client, AuthId_Engine, szAuth, sizeof szAuth); ServerCommand("thc_rpg_credits set %s 50000", szAuth); } }
Можно сделать когда игрок апает 100, у него все сбрасывается и ставятся кредиты, но опять же нужно искать в инклюдах событие повышения уровня, если такое там есть (по типу SMRPG_OnClientLevel). Можно и без него, но с ним адекватнее.Спасибо вам всем, очень помогли, у меня возник ещё 1 вопросик, а можно ли сделать данную штуку автоматической?
Т.е. добавить автопроверку уровня, по которой будет это всё делаться (заместо команды)