#include <sourcemod>
#include <sdktools>
public Plugin:myinfo = {
name = "Statnullazo-kiegyenlito",
author = "qKKKJ",
description = "Ezzel a pluginnal nullazni és kiegyenlíteni tudod a statod",
version = "1.0",
url = "www.warhosting.hu"
}
public OnPluginStart()
{
RegConsoleCmd("rs", ResetScore);
RegConsoleCmd("bs", BalanceScore);
RegConsoleCmd("ScoreOptions", ScoreOptions_Menu);
}
public ScoreOptions_Menu_Handler(Handle:menu, MenuAction:action, param1, param2)
{
if (action == MenuAction_Select)
{
if(param2 == 1)
BalanceScore(param1, GetClientOfUserId(param1)); //ebben nem vagyok biztos... Mi a második paraméter
else if(param2 == 2)
ResetScore(param1, GetClientOfUserId(param1)); //Itt is. Mert ha simán csak ResetScore(param1)-et írok akkor errort dob.
else
CloseHandle(menu);
}
else if (action == MenuAction_End)
{
CloseHandle(menu);
}
}
public Action:ScoreOptions_Menu(client, args)
{
new Handle:menu = CreateMenu(ScoreOptions_Menu_Handler);
SetMenuTitle(menu, "Mit szeretnél csinálni?");
AddMenuItem(menu, "balance", "Stat kiegyenlítés");
AddMenuItem(menu, "reset", "Stat Nullázása");
AddMenuItem(menu, "quit", "Kilép");
SetMenuExitButton(menu, false);
DisplayMenu(menu, client, 20);
return Plugin_Handled;
}
public Action:ResetScore(client, args) //Itt két paramétert vár, de ebből az egyik a játékos a másik az pedig számomra ismeretlen.
{
SetClientFrags(client, 0)
SetClientDeaths(client, 0)
decl String:name[64]
GetClientName(client, name, sizeof(name))
PrintToChat(client, "Sikeres statnullazás")
PrintToChatAll("%s sikeresen nullazta a statját!", name)
}
public Action:BalanceScore(client,args) //Szintúgy.
{
new oles = GetClientFrags(client)
new halal = GetClientDeaths(client)
new eredmeny = oles - halal
decl String:name[64]
GetClientName(client, name, sizeof(name))
if(oles >= halal)
{
SetClientFrags(client, eredmeny)
SetClientDeaths(client, 0)
PrintToChat(client, "Sikeres statkiegyenlítés")
PrintToChatAll("%s sikeresen kiegyenlítette a statját!", name)
}
else
PrintToChat(client, "Ez sajnos nem siekrült!")
}
stock SetClientFrags( index, frags )
{
SetEntProp( index, Prop_Data, "m_iFrags", frags );
return 1;
}
stock SetClientDeaths( index, deaths )
{
SetEntProp( index, Prop_Data, "m_iDeaths", deaths );
return 1;
}