Witam, napisałem plugin w którym raz na runde losuje jednego gracza z TT i daje mu łom , działa jednak wali errorami, jestem raczej słaby w pisaniu pluginów więc prosiłbym o wskazówki.
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#define PLUGIN "Losowanie lomu"
#define VERSION "1.0"
#define AUTHOR "BaRa"
#define DMG_BULLET (1<<1)
new g_MaxPlayers;
new bool:lom[33];
#pragma tabsize 0
public plugin_init(){
register_plugin(PLUGIN, VERSION, AUTHOR);
register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
register_event("CurWeapon","Noz","be", "1=1")
register_logevent("Koniec_Rundy", 2, "1=Round_End")
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public plugin_precache() {
precache_model("models/SC_jail/v_freelom.mdl")
precache_model("models/SC_jail/p_freelom.mdl")
}
public plugin_cfg(){
g_MaxPlayers = get_maxplayers();
}
public Koniec_Rundy(id)
{
for(new i=1; i<=32; i++){
lom[i] = false
}
}
public Poczatek_Rundy(){
new g_UserIndex = RandomPlayer(1);
lom[g_UserIndex] = true
if(get_user_weapon(g_UserIndex) == CSW_KNIFE){
set_pev(g_UserIndex, pev_viewmodel2, "models/SC_jail/v_freelom.mdl")
set_pev(g_UserIndex, pev_weaponmodel2, "models/SC_jail/p_freelom.mdl")
}
set_hudmessage(255, 255, 0, -1.0, 0.21, 0, 6.0, 5.0)
show_hudmessage(g_UserIndex, "Brawo wylosowales lom i 1.5 razy wieksze obrazenia!")
}
public Noz(id) {
new wpn = read_data(2)
if(get_user_team(id) == 1 && lom[id] == true && wpn == CSW_KNIFE){
set_pev(id, pev_viewmodel2, "models/SC_jail/v_freelom.mdl")
set_pev(id, pev_weaponmodel2, "models/SC_jail/p_freelom.mdl")
}
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_KNIFE)
if(lom[idattacker] == true)
SetHamParamFloat(4, damage*1.5)
return HAM_IGNORED;
}
stock RandomPlayer(g_Team){
new g_PlayersIndex[33],
g_Value;
for(new i = 1; i <= g_MaxPlayers; i++){
if(is_user_alive(i) && get_user_team(i) == g_Team){
g_PlayersIndex[g_Value] = i;
g_Value++;
}
}
return g_PlayersIndex[random(g_Value)];
}


Dodatki SourceMod












