ConVar
knopers666
05.03.2013
Ostatnio robię plugin i mam mały problem otóż chce, żeby on wysłał do konsoli takie coś: "thc_rpg_credits <nick> 10".Tylko, że nie wiem jakiej funkcji użyć 
Oto plugin"
Ps.Czy można zrobić coś w tym stylu ?
if (xxxx)
{
}
else if (yyyy)
{
}
else
{
}
Użytkownik knopers666 edytował ten post 05.03.2013 20:10

Oto plugin"
#pragma semicolon 1 #include <sourcemod> public Plugin:myinfo = { name = "Premia RPG", author = "knopers", description = "Plugin dla Johnego", version = "1.0", url = "heavycraft.pl", } public OnPluginStart() { PrintToServer("[KNOPERS]Plugin gotowy do pracy"); HookEvent("player_death", PlayerDeath); } public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { new attackerId = GetEventInt(event, "attacker"); new attacker = GetClientOfUserId(attackerId); new frag = GetClientFrags(attacker); new thc_rpg_credits = FindConVar("thc_rpg_credits"); new premia1 = 10; if (frag != 0) { SendConVarValue(attacker, thc_rpg_credits, "thc_rpg_credits attacker 1"); PrintToChat(attacker, "Dostales cos tam wololow"); } else { PrintToChat(attacker, "[KNOPERS]Cos nie tak <img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/sad.png' class='bbc_emoticon' alt=':(' />"); } }
Ps.Czy można zrobić coś w tym stylu ?
if (xxxx)
{
}
else if (yyyy)
{
}
else
{
}
Użytkownik knopers666 edytował ten post 05.03.2013 20:10
Gość_21977_* 12.03.2013
#pragma semicolon 1PS Tak
#include <sourcemod>
public Plugin:myinfo =
{
name = "Premia RPG",
author = "knopers",
description = "Plugin dla Johnego",
version = "1.0",
url = "heavycraft.pl",
}
public OnPluginStart()
{
PrintToServer("[KNOPERS]Plugin gotowy do pracy");
HookEvent("player_death", PlayerDeath);
}
public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new attackerId = GetEventInt(event, "attacker");
new attacker = GetClientOfUserId(attackerId);
if (GetClientFrags(attacker))
{
new name[32];
GetClientName(attacker, name, 31);
ServerCommand("thc_rpg_credits %s 1", name);
PrintToChat(attacker, "Dostales cos tam wololow");
} else {
PrintToChat(attacker, "[KNOPERS]Cos nie tak");
}
}