Sieć serwerów Counter-Strike Dust2.pl
Plugin (rozgrzewka dd2 losowe bronie) - Wersja do druku

+- Sieć serwerów Counter-Strike Dust2.pl (http://dust2.danielkucal.com)
+-- Dział: Strefa Counter Strike (/forum-Strefa-Counter-Strike--9)
+--- Dział: Pluginy AMXX (/forum-Pluginy-AMXX--38)
+--- Wątek: Plugin (rozgrzewka dd2 losowe bronie) (/temat-Plugin-rozgrzewka-dd2-losowe-bronie--13110)



Plugin (rozgrzewka dd2 losowe bronie) - Sprytny :) - 12-05-2014 02:34

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

#define PLUGIN "Rozgrzewka"
#define VERSION "1.2.2"
#define AUTHOR "R3X"

new const gszMusic[]="misc/rabkarestart.mp3"; //cstrike/sound/[gszMusic]
new const gszPausePlugins[][]={
"alt_end_round_sounds.amxx"
};

new const giColor[3]={0, 200,200};

#define MAX_PLAYERS 32
#define SPAWN_TASKID 9999
#define TASK_EQUIP 99999
#define RESTART_TASKID 123
#define ACTIVE_TASKID 124

new bool:Active=false;
new bool:gbPlay[33];

new Float:fPosition[2];

new g_cvarRTime;
new g_cvarFreeze;
new g_cvarTimerX,g_cvarTimerY, g_cvarDelay, g_cvarSpawnDelay;

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);

register_event("TextMsg", "Game_Restart", "a", "2&#Game_C");
register_event("DeathMsg","onDeath","a");
register_event("CurWeapon","eventCurWeapon","be","1=0", "2!0");

RegisterHam(Ham_Spawn, "player", "fwSpawn",1);
register_forward(FM_SetModel, "fwSetModel",1);
register_event("HLTV", "setWeapons", "a", "1=0", "2=0");

g_cvarRTime=register_cvar("restart_time","45");
g_cvarTimerX=register_cvar("restart_timer_pozx","0.01",0,0.01);
g_cvarTimerY=register_cvar("restart_timer_pozy","0.86",0,0.86);
g_cvarDelay=register_cvar("restart_weapondelay","2.0",0,2.0);
g_cvarSpawnDelay=register_cvar("restart_spawndelay","2.0",0,2.0);

g_cvarFreeze=get_cvar_pointer("mp_freezetime");

blockBuy();
}
public plugin_precache(){
precache_sound(gszMusic);
}

public Game_Restart(){
if(Active){
remove_task(RESTART_TASKID);
return;
}
Active=true;
new iRTime=get_pcvar_num(g_cvarRTime)+get_pcvar_num(g_​cvarFreeze)+1;

for(new i=1;i<33;i++)
gbPlay[i]=true;

fPosition[0]=get_pcvar_float(g_cvarTimerX);
fPosition[1]=get_pcvar_float(g_cvarTimerY);
new param[1];
param[0]=iRTime;
set_task(1.0,"CountDown",RESTART_TASKID,param,1);

for(new i=0;i<sizeof gszPausePlugins;i++)
pause("ac",gszPausePlugins[i]);
}
public CountDown(param[1]){
new iNow=param[0]--;
switch(iNow){
case 0:{
server_cmd("sv_restartround 1");
clearRespawns();
new param[1];
param[0]=0;
set_task(1.0,"Activation",ACTIVE_TASKID,param,1);
for(new i=0;i<sizeof gszPausePlugins;i++)
unpause("ac",gszPausePlugins[i]);
}
case 1:{
client_cmd(0,"speak one");
}
case 2:{
client_cmd(0,"speak two");
}
case 3:{
client_cmd(0,"speak three");
}
}
if(iNow>=1)
set_task(1.0,"CountDown",RESTART_TASKID,param,1);
new fx=0;
if(iNow<=5){
fx=1;
}
set_hudmessage(giColor[0], giColor[1], giColor[2], fPosition[0], fPosition[1], fx, 6.0, 1.0)
show_hudmessage(0, "Czas rozgrzewki^n%2d:%02d",iNow/60,iNow%60);
}
public Activation(param[1]){
Active=(param[0]==0)?false:true;
}
public onDeath(){
new vid=read_data(2);
if(Active)
set_task(get_pcvar_float(g_cvarSpawnDelay),"respawn",SPAWN_TASKID+vid);
return PLUGIN_CONTINUE;
}
public fwSpawn(id){
if(Active && is_user_alive(id)){
if(gbPlay[id]){
play(id, gszMusic);
gbPlay[id]=false;
}
if(task_exists(TASK_EQUIP+id))
remove_task(TASK_EQUIP+id);
set_task(0.2, "taskEquip", TASK_EQUIP+id);
}
}
public eventCurWeapon(id){
if(Active){
if(task_exists(TASK_EQUIP+id))
remove_task(TASK_EQUIP+id);
set_task(0.5, "taskEquip", TASK_EQUIP+id);
}
}
public taskEquip(id){
id-=TASK_EQUIP;
if(Active && is_user_alive(id)){
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_hegrenade");
}
}
public fwSetModel(ent, szModel[]){
if(Active){
if(equal(szModel[7], "w_hegrenade.mdl"))
set_task(get_pcvar_float(g_cvarDelay), "taskEquip", TASK_EQUIP+pev(ent,pev_owner));
else{
static szClass[32];
pev(ent, pev_classname,szClass ,31);
if(equal(szClass, "weaponbox") ||
contain(szClass, "weapon_")==0 ||
contain(szClass, "item_")==0
){
set_pev(ent, pev_solid, SOLID_NOT);
fm_set_rendering(ent, _, _,_,_,kRenderTransAlpha,0);
}
}
}
}
public respawn(task_id){
ExecuteHamB(Ham_CS_RoundRespawn,task_id-SPAWN_TASKID);
}
public clearRespawns(){
for(new i=1;i<=MAX_PLAYERS;i++){
if(task_exists(SPAWN_TASKID+i))
remove_task(SPAWN_TASKID+i);
if(task_exists(TASK_EQUIP+i))
remove_task(TASK_EQUIP+i);
}
}

public blockBuy(){
register_clcmd("drop","block")
register_clcmd("cl_setautobuy","block")
register_clcmd("cl_autobuy","block")
register_clcmd("cl_setrebuy","block")
register_clcmd("cl_rebuy","block")
register_clcmd("buy","block")
register_clcmd("p228","block");
register_clcmd("228compact","block");
register_clcmd("shield","block");
register_clcmd("scout","block");    
register_clcmd("hegren","block");            
register_clcmd("xm1014","block");
register_clcmd("autoshotgun","block");                
register_clcmd("mac10","block");                
register_clcmd("aug","block");
register_clcmd("bullpup","block");
register_clcmd("sgren","block");
register_clcmd("elites","block");    
register_clcmd("fn57","block");
register_clcmd("fiveseven","block");
register_clcmd("ump45","block");                
register_clcmd("sg550","block");
register_clcmd("krieg550","block");
register_clcmd("galil","block");
register_clcmd("defender","block");
register_clcmd("famas","block");
register_clcmd("clarion","block");
register_clcmd("usp","block");
register_clcmd("km45","block");    
register_clcmd("glock","block");
register_clcmd("9x19mm","block");    
register_clcmd("awp","block");
register_clcmd("magnum","block");    
register_clcmd("mp5","block");
register_clcmd("smg","block");    
register_clcmd("m249","block");                
register_clcmd("m3","block");
register_clcmd("12gauge","block");
register_clcmd("m4a1","block");                
register_clcmd("tmp","block");
register_clcmd("mp","block");        
register_clcmd("g3sg1","block");
register_clcmd("d3au1","block");    
register_clcmd("flash","block");                
register_clcmd("deagle","block");
register_clcmd("nighthawk","block");
register_clcmd("sg552","block");
register_clcmd("krieg552","block");
register_clcmd("ak47","block");
register_clcmd("cv47","block");                        
register_clcmd("p90","block");
register_clcmd("c90","block");
register_clcmd("primammo","block");
register_clcmd("secammo","block");
register_clcmd("vest","block");
register_clcmd("vesthelm","block");
register_clcmd("nvgs","block");
}
public block(id){
if(Active){
client_print(id,print_center,"Nie tym razem");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public setWeapons(){
//weapons
new ent=-1;
do{
ent=engfunc(EngFunc_FindEntityByString, ent,"classname", "armoury_entity");
if(pev_valid( ent )) {
set_pev(ent, pev_solid, (Active)?SOLID_NOT:1);
fm_set_rendering(ent,kRenderFxNone, 0,0,0, kRenderTransTexture,(Active)?0:255);
}
}
while(ent);
}

play(id,const sound[])
{
new end=strlen(sound)-4;
if(containi(sound,".mp3") == end && end>0)
client_cmd(id,"mp3 play sound/%s",sound);
else if(containi(sound,".wav") == end && end>0)
client_cmd(id, "spk sound/%s",sound);
else
client_cmd(id, "speak %s",sound);

}
Posiadam o taki tutaj fajny pluginek który może się przydać do dd2 jeżeli ktoś bd chciał. plugin chyba trzeba trochę zmienić ale dacie radę


RE: Plugin (rozgrzewka dd2 losowe bronie) - Obey138 - 12-05-2014 08:12

Nie mogłeś sma do pliku wkleić? :P


RE: Plugin (rozgrzewka dd2 losowe bronie) - Sprytny :) - 12-05-2014 09:36

jeżeli potrafisz to moźesz to dokonczyć :)


RE: Plugin (rozgrzewka dd2 losowe bronie) - ZaQ - 12-05-2014 21:55

Dziabnij to w [code] bo sie emotki pojawiają. Skąd to masz? Źródło daj :)


RE: Plugin (rozgrzewka dd2 losowe bronie) - Sprytny :) - 12-05-2014 22:18

Źródło mogę dać na pw :)


RE: Plugin (rozgrzewka dd2 losowe bronie) - Obey138 - 12-05-2014 22:52

/tmp/textEutjqD.sma(64) : error 017: undefined symbol "g_"
/tmp/textEutjqD.sma(64) : error 029: invalid expression, assumed zero
/tmp/textEutjqD.sma(64) : error 029: invalid expression, assumed zero
/tmp/textEutjqD.sma(64) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.


RE: Plugin (rozgrzewka dd2 losowe bronie) - Mefiu - 21-05-2014 19:52

Gówniany kod.
Gówniany plugin.
Mówiąc w skrócie: GÓWNO. troll