AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Very simple,constructive request (https://forums.alliedmods.net/showthread.php?t=184427)

kileedyg 05-05-2012 08:02

Very simple,constructive request
 
Hello Fellows,

so i need simple thing for hidenseek, i don't want to use exolent's plugin , couse it have lots of things like scrim,alot of checking,much integrated things,code that i don't use for ages and don't want to use weapon chance plugin couse it have lots of code that i don't use, please don't suggest it,would be great if you make plugin sample ,

the plugin should have functions:
for terrorist team only,giving x amount of he,fb,sg with from 0 to 100 percentage of luck (float would be great ), also these are configurable settings:
hiders_he (amount variable from 0 to x)
hiders_he_percent (variable from 0 to 100)
hiders_fb (amount variable from 0 to x)
hiders_fb_percent (variable from 0 to 100)
hiders_sg (amount variable from 0 to x)
hiders_sg_percent (variable from 0 to 100)


also tryed:

PHP Code:

/* All credits goes to Exolent */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>

#define OFFSET_ARMORTYPE 112
#define OFFSET_TEAM 114


enum CsTeams
{
CS_TEAM_UNASSIGNED 0,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
};
new const 
g_sTeamInfo[CsTeams][] =
{
"UNASSIGNED",
"TERRORIST",
"CT",
"SPECTATOR"
};
new const 
g_sTeamNames[CsTeams][] =
{
"Spectator",
"Terrorist",
"Counter-Terrorist",
"Spectator"
};
enum (+= 1000)
{
TASK_ID_STRIPWEAPONS 1000,
TASK_ID_GIVEWEAPONS
};
new const 
g_PlayerTasks[] =
{
TASK_ID_STRIPWEAPONS,
TASK_ID_GIVEWEAPONS
}
enum CsArmorType
{
CS_ARMOR_NONE 0,
CS_ARMOR_KEVLAR,
CS_ARMOR_VESTHELM
};

new 
CsTeams:g_Team[33];
new 
he[CsTeams];
new 
he_percent[CsTeams];
new 
fb[CsTeams];
new 
fb_percent[CsTeams];
new 
sg[CsTeams];
new 
sg_percent[CsTeams];
new 
armor[CsTeams];
new 
param[2];

new const 
g_sBlank[] = "";
new const 
CsTeams:HIDER CS_TEAM_T;
new const 
CsTeams:SEEKER CS_TEAM_CT;

new 
bool:g_bWeaponsGiven;

public 
plugin_init() {
he[HIDER] = register_cvar("hider_he""0"00.0)
he_percent[HIDER] = register_cvar("hider_he_percent""0"00.0)
fb[HIDER] = register_cvar("hider_fb""0"00.0)
fb_percent[HIDER] = register_cvar("hider_fb_percent""0"00.0)
sg[HIDER] = register_cvar("hider_sg""0"00.0)
sg_percent[HIDER] = register_cvar("hider_sg_percent""0"00.0)
armor[HIDER] = register_cvar("hider_armor""100"00.0)
if( 
g_bWeaponsGiven ) {
set_task(0.6"taskGiveWeapons"plr TASK_ID_GIVEWEAPONSparam2g_sBlank0)
}
g_msgArmorType get_user_msgid("ArmorType");




}
public 
taskStripWeapons(plr) {
plr -= TASK_ID_STRIPWEAPONS;

fm_strip_user_weapons(plr);

return 
PLUGIN_CONTINUE;
}


public 
taskGiveWeapons(param[], plr) {
plr -= TASK_ID_GIVEWEAPONS;
new 
CsTeams:team CsTeams:param[0];
if( 
team != HIDER && team != SEEKER ) {
return 
PLUGIN_CONTINUE;
}
chance(plrget_pcvar_num(he[team]), get_pcvar_num(he_percent[team]),"weapon_hegrenade"CSW_HEGRENADE"HE Grenade");
chance(plrget_pcvar_num(fb[team]), get_pcvar_num(fb_percent[team]), "weapon_flashbang"CSW_FLASHBANG"Flashbang");
chance(plrget_pcvar_num(sg[team]), get_pcvar_num(sg_percent[team]), "weapon_smokegrenade"CSW_SMOKEGRENADE"Smoke Grenade");
new 
num get_pcvar_num(armor[team]);
num clamp(num0100);
switch( 
num ) {
case 
0: {
cs_set_user_armor(plr0CS_ARMOR_NONE);
}
case 
1..99: {
cs_set_user_armor(plrnumCS_ARMOR_KEVLAR);
}
case 
100: {
cs_set_user_armor(plrnumCS_ARMOR_VESTHELM);
}
}
return 
PLUGIN_CONTINUE;
}
/*if( g_bDisableSlash ) {
new button = get_uc(ucHandle, UC_Buttons);
if( button&IN_ATTACK ) {
button &= ~IN_ATTACK;
button |= IN_ATTACK2;
}
set_uc(ucHandle, UC_Buttons, button);
return FMRES_SUPERCEDE;
}*/ 

p.s exolent, don't blame on me,your plugin is great ,i just need couple of things from it,ofcourse for idea credits belongs to you

kileedyg 05-07-2012 01:16

Re: Very simple,constructive request
 
UP,also

PHP Code:

chance(plrmaxcountpercentsClass[], CSW_type=0sName[]="") {
    if( !
maxcount || !percent ) {
    return 
0;
    }
    new 
count;
    for( new 
0maxcounti++ ) {
    if( 
random_num(1100) <= percent )
    {
    if( 
count == )
    {
    
fm_give_item(plrsClass);
    }
    
count++;
    }
    }
    if( 
count && CSW_type )
    {
    if( 
percent 100 )
    {
    
client_print(plr,print_chat"You received %i %s%s! (%i%% chance)"countsName, (count == 1) ? g_sBlank g_sSpercent);
    }
    
cs_set_user_bpammo(plrCSW_typecount);
    }
 
 return 
1;
}
chance(plrget_pcvar_num(hns_grenades[team]), get_pcvar_num(hns_grenades_percent[team]),"weapon_hegrenade"CSW_HEGRENADE"HE Grenade");
chance(plrget_pcvar_num(hns_flashbangs[team]), get_pcvar_num(hns_flashbangs_percent[team]), "weapon_flashbang"CSW_FLASHBANG"Flashbang");
chance(plrget_pcvar_num(hns_smokegren[team]), get_pcvar_num(hns_smokegren_percent[team]), "weapon_smokegrenade"CSW_SMOKEGRENADE"Smoke Grenade"); 



All times are GMT -4. The time now is 17:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.