View Single Post
Author Message
Zpoke
Senior Member
Join Date: Aug 2009
Location: Sweden
Old 08-10-2009 , 17:37   WHATS WRONG here ? PLEASE need help
Reply With Quote #1

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <colorchat>

#define TASK_TIME 10.0

new gMsg_SayText;

public plugin_init()
{
register_plugin("Health Chance", "1", "Zpoke");
register_logevent("round_start", 2, "1=Round_Start");

gMsg_SayText = get_user_msgid("SayText");
}
public round_start()
{
set_task(TASK_TIME, "give_stuff");
}
public give_stuff()
{
new players[32], num;
get_players(players, num, "ah");

new player;

for(new i = 0; i < num; i++)
{
player = players[i];

if(random_num(0, 20) <= 3)
{
set_pev(player, pev_health, 150.0);
ColorChat(player, RED, "Lucky you.. you got a healthpack with 50hp. (3/20 chance)");
}
if(random_num(0, 50) <= 5)
{
set_pev(player, pev_health, 200.0);
ColorChat(player, RED, "Lucky you.. you got a healthpack with 100hp. (5/50 chance)");
}
}

if(random_num(0, 100) <= 25)
{
cs_set_user_armor(player, 100, CS_ARMOR_VESTHELM);
ColorChat(player, RED, "Lucky you.. you got a Kevlar and Helm. (25/100 chance)");
}
if(random_num(0, 100) <= 1)
{
set_pev(player, pev_health, 1.0);

ColorChat(player, RED, "Bad Luck! You lost 99 HP. (1/100 chance)");

new name[32];
get_user_name( player, name, 32);
ColorChat(0, RED, "Bad Luck! %s just got 1 HP now", name);
}
}
stock fm_give_item(index, const item[]) {
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
return 0

new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
if (!pev_valid(ent))
return 0

new Floatrigin[3]
pev(index, pev_origin, origin)
set_pev(ent, pev_origin, origin)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)

new save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, index)
if (pev(ent, pev_solid) != save)
return ent

engfunc(EngFunc_RemoveEntity, ent)

return -1
}
stock fm_get_weapon_id(index, const weapon[])
{
new ent = -1;

while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", weapon)) != 0)
{
if(index == pev(ent, pev_owner))
return ent;
}
return 0;
}
stock print_green(id,const fmt[],{Float,_}:...) {
if(id && !is_user_connected(id)) return 0

static buffer[192]
buffer[0] = '^x04'
vformat(buffer[1],190, fmt,3)

message_begin(id ? MSG_ONE : MSG_ALL,gMsg_SayText,{0,0,0},id)
write_byte(id)
write_string(buffer)
message_end()

return 1
}
Zpoke is offline