User
Pass
2FA
 
 

Modificare plugin respawn.dr

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> CS 2006-2019 (Archived) -> Resources
Author Message1087
alexinio3d

[Mentally Stable]



Status: Offline
(since 18-12-2017 10:11)
Joined: 02 Aug 2011
Posts: 7, Topics: 3
Location: Romania

Reputation: 67.4
Votes: 2

Post Posted: 03-04-2013, 15:35:43 | Translate post to: ... (Click for more languages)

Caremi poate modifica si mie putin pluginul respawn.dr ??
As dori sa dea respawn la intrarea pe server . Am incercat asa :

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

new g_counter 

new g_SyncRestartTimer
new g_SyncGameStart

new Float:RoundStartTime

new g_Time_Interval;
const MAX_PLAYERS = 32;

new g_iRespawn[MAX_PLAYERS+1], g_TeamInfoCounter[MAX_PLAYERS+1], CsTeams:g_iPlayerTeam[MAX_PLAYERS+1];
new g_pCvarRespawnTime, g_pCvarRespawnDelay, g_pCvarMaxHealth;

public plugin_init()
{
   register_plugin("Dr.Respawn", "1.2", "Vicious Vixen");
   RegisterHam(Ham_Killed, "player", "dead_playerr", 1);
   RegisterHam(Ham_Killed, "player", "fwdPlayerKilledPost", 1);
   RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawnPost", 1);
   register_event("TeamInfo", "eTeamInfo", "a");
   register_logevent( "LogEventRoundStart", 2, "1=Round_Start" )
   g_pCvarRespawnTime = register_cvar("amx_respawn_tickets", "0"); //Set to 0 for unlimited respawns
   g_pCvarRespawnDelay = register_cvar("amx_respawn_delay", "1");
   g_pCvarMaxHealth = register_cvar("amx_max_health", "100");
   g_Time_Interval = register_cvar("amx_max_time", "30");
   set_msg_block( get_user_msgid( "ClCorpse" ), BLOCK_SET );
   
   g_SyncRestartTimer = CreateHudSyncObj()
   g_SyncGameStart = CreateHudSyncObj()
   
}

public LogEventRoundStart()
{
   RoundStartTime = get_gametime()
   
   new iPlayers[32]
   new iNum
   
   get_players( iPlayers, iNum )
   
   for( new i = 0; i < iNum; i++ )
   {
      g_iRespawn[iPlayers[i]] = true
   }
   set_task(1.0,"TimeCounter",123456,_,_,"a",get_pcvar_num(g_Time_Interval))
   set_task(get_pcvar_float(g_Time_Interval),"Runda_Terminata",789123)
}

public Runda_Terminata()
{
   if(RoundStartTime)
   {
      set_hudmessage( 255, 0, 0, 0.09, 0.00, 1, 0.5, 1.0, 0.5, 15.0, -1)
      ShowSyncHudMsg( 0, g_SyncGameStart, "Modul respawn este dezactivat!")
   }
}

public fwdPlayerKilledPost(iVictim, iKiller, iShoudlGib)
{
   if(g_iRespawn[iVictim]++ < get_pcvar_num(g_pCvarRespawnTime) || get_pcvar_num(g_pCvarRespawnTime) == 0)
   {
      set_task(get_pcvar_float(g_pCvarRespawnDelay), "taskRespawnPlayer", iVictim);
   }
   return HAM_IGNORED;
}

public fwdPlayerSpawnPost(iClient)
{
   if(is_user_alive(iClient))
   {
      set_pev(iClient, pev_health, get_pcvar_float(g_pCvarMaxHealth));
   }
}

public taskRespawnPlayer(id)
{
   if(is_user_connected(id) && RoundStartTime + get_pcvar_num(g_Time_Interval) >= get_gametime() && g_iRespawn[id] && !is_user_alive(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR) {
      ExecuteHamB(Ham_CS_RoundRespawn, id)
      g_iRespawn[id] = false
      return PLUGIN_HANDLED;
   }
   return PLUGIN_HANDLED;


public eTeamInfo()
{
   new iClient = read_data(1);
   new szTeam[2];
   read_data(2, szTeam, charsmax(szTeam));
   switch(szTeam[0])
   {
      case 'T':
      {
         remove_task(iClient);
         g_iPlayerTeam[iClient] = CS_TEAM_T;
      }
      case 'C':
      {
         if(g_TeamInfoCounter[iClient] == 2 || g_iPlayerTeam[iClient] == CS_TEAM_SPECTATOR)
         {
            set_task(get_pcvar_float(g_pCvarRespawnDelay), "taskRespawnPlayer",  iClient);
         }
         g_iPlayerTeam[iClient] = CS_TEAM_CT;
      }
      case 'S':
      {
         remove_task(iClient);
         g_iPlayerTeam[iClient] = CS_TEAM_SPECTATOR;
      }
   }
}

public TimeCounter()
{
   g_counter++
   
   new Float:iRestartTime = get_pcvar_float(g_Time_Interval) - g_counter
   new Float:fSec
   fSec = iRestartTime
   
   set_hudmessage( 255, 0, 0, 0.09, 0.0, 1, 0.0, 1.0, 0.0, 0.0, -1)
   ShowSyncHudMsg( 0, g_SyncRestartTimer, "Au mai ramas %d secunde de respawn", floatround(fSec))
   
   if(get_pcvar_num(g_Time_Interval) - g_counter < 11 && get_pcvar_num(g_Time_Interval) - g_counter !=0)
   {
      static szNum[32]
      num_to_word(get_pcvar_num(g_Time_Interval) - g_counter, szNum, 31)
   }
   if(g_counter == get_pcvar_num(g_Time_Interval))
   {
      g_counter = 0
   }
}

public dead_playerr( id )
{
    if( is_user_connected( id ) )
    {
        set_task( 0.2, "taskRespawnPlayer", id )
    }
}


Aici ii sursa nemodificata :
Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

new g_counter 

new g_SyncRestartTimer
new g_SyncGameStart

new Float:RoundStartTime

new g_Time_Interval;
const MAX_PLAYERS = 32;

new g_iRespawn[MAX_PLAYERS+1], g_TeamInfoCounter[MAX_PLAYERS+1], CsTeams:g_iPlayerTeam[MAX_PLAYERS+1];
new g_pCvarRespawnTime, g_pCvarRespawnDelay, g_pCvarMaxHealth;

public plugin_init()
{
   register_plugin("Dr.Respawn", "1.2", "Vicious Vixen");
   RegisterHam(Ham_Killed, "player", "fwdPlayerKilledPost", 1);
   RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawnPost", 1);
   register_event("TeamInfo", "eTeamInfo", "a");
   register_logevent( "LogEventRoundStart", 2, "1=Round_Start" )
   g_pCvarRespawnTime = register_cvar("amx_respawn_tickets", "0"); //Set to 0 for unlimited respawns
   g_pCvarRespawnDelay = register_cvar("amx_respawn_delay", "1");
   g_pCvarMaxHealth = register_cvar("amx_max_health", "100");
   g_Time_Interval = register_cvar("amx_max_time", "30");
   set_msg_block( get_user_msgid( "ClCorpse" ), BLOCK_SET );
   
   g_SyncRestartTimer = CreateHudSyncObj()
   g_SyncGameStart = CreateHudSyncObj()
   
}

public LogEventRoundStart()
{
   RoundStartTime = get_gametime()
   
   new iPlayers[32]
   new iNum
   
   get_players( iPlayers, iNum )
   
   for( new i = 0; i < iNum; i++ )
   {
      g_iRespawn[iPlayers[i]] = true
   }
   set_task(1.0,"TimeCounter",123456,_,_,"a",get_pcvar_num(g_Time_Interval))
   set_task(get_pcvar_float(g_Time_Interval),"Runda_Terminata",789123)
}

public Runda_Terminata()
{
   if(RoundStartTime)
   {
      set_hudmessage( 255, 0, 0, 0.09, 0.00, 1, 0.5, 1.0, 0.5, 15.0, -1)
      ShowSyncHudMsg( 0, g_SyncGameStart, "Modul respawn este dezactivat!")
   }
}

public fwdPlayerKilledPost(iVictim, iKiller, iShoudlGib)
{
   if(g_iRespawn[iVictim]++ < get_pcvar_num(g_pCvarRespawnTime) || get_pcvar_num(g_pCvarRespawnTime) == 0)
   {
      set_task(get_pcvar_float(g_pCvarRespawnDelay), "taskRespawnPlayer", iVictim);
   }
   return HAM_IGNORED;
}

public fwdPlayerSpawnPost(iClient)
{
   if(is_user_alive(iClient))
   {
      set_pev(iClient, pev_health, get_pcvar_float(g_pCvarMaxHealth));
   }
}

public taskRespawnPlayer(id)
{
   if(is_user_connected(id) && RoundStartTime + get_pcvar_num(g_Time_Interval) >= get_gametime() && g_iRespawn[id] && !is_user_alive(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR) {
      ExecuteHamB(Ham_CS_RoundRespawn, id)
      g_iRespawn[id] = false
      return PLUGIN_HANDLED;
   }
   return PLUGIN_HANDLED;


public eTeamInfo()
{
   new iClient = read_data(1);
   new szTeam[2];
   read_data(2, szTeam, charsmax(szTeam));
   switch(szTeam[0])
   {
      case 'T':
      {
         remove_task(iClient);
         g_iPlayerTeam[iClient] = CS_TEAM_T;
      }
      case 'C':
      {
         if(g_TeamInfoCounter[iClient] == 2 || g_iPlayerTeam[iClient] == CS_TEAM_SPECTATOR)
         {
            set_task(get_pcvar_float(g_pCvarRespawnDelay), "taskRespawnPlayer",  iClient);
         }
         g_iPlayerTeam[iClient] = CS_TEAM_CT;
      }
      case 'S':
      {
         remove_task(iClient);
         g_iPlayerTeam[iClient] = CS_TEAM_SPECTATOR;
      }
   }
}

public TimeCounter()
{
   g_counter++
   
   new Float:iRestartTime = get_pcvar_float(g_Time_Interval) - g_counter
   new Float:fSec
   fSec = iRestartTime
   
   set_hudmessage( 255, 0, 0, 0.09, 0.0, 1, 0.0, 1.0, 0.0, 0.0, -1)
   ShowSyncHudMsg( 0, g_SyncRestartTimer, "Au mai ramas %d secunde de respawn", floatround(fSec))
   
   if(get_pcvar_num(g_Time_Interval) - g_counter < 11 && get_pcvar_num(g_Time_Interval) - g_counter !=0)
   {
      static szNum[32]
      num_to_word(get_pcvar_num(g_Time_Interval) - g_counter, szNum, 31)
   }
   if(g_counter == get_pcvar_num(g_Time_Interval))
   {
      g_counter = 0
   }
}


Si as mai dori inca ceva si ca sa nu deschid al topic scriu tot aici :
Imi puteti zice careva functia de verificare daca playerul are arma selectata sau nu, deoarece am urmatorul plugin :
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>

#pragma semicolon 1

static const PLUGIN[ ]   = "Bonus Menu";
static const VERSION[ ]   = "1.0";
static const AUTHOR[ ]   = "Rap";

new g_Menu;


public plugin_init( )
{
   register_plugin(PLUGIN, VERSION, AUTHOR);
   register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");
   register_clcmd("say /tmenu", "eventNewRound");
   g_Menu = register_menuid("MENU");
   register_menucmd(g_Menu, 1023, "MenuAction");
}
public BonusMenu(id) ShowMenu(id);

public eventNewRound( )
{
   
   new Players[32], iNum, player;
   get_players(Players, iNum, "ch");
   
   for( new i = 0; i < iNum; i++ )
   {
      player = Players[i];
      
      set_user_rendering(player, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
      
      if( cs_get_user_team(player) == CS_TEAM_T )
      {   set_task( 3.0, "BonusMenu", player ); }
      else
      {   ColorChat(player , TEAM_COLOR, "[ BG ]^x01 Doar TERRO^x01 poate folosi comanda asta.");   }
   }
}
public ShowMenu(id)
{

   new menuBody[512];
   add(menuBody, 511, "\rMeniu Bonus Tero^n^n");
   add(menuBody, 511, "\y1. \wAk47 + M4A1 + Deagle + Pachet Grenazi^n");
   add(menuBody, 511, "\y2. \wAk47 + Deagle + Pachet Grenazi^n");
   add(menuBody, 511, "\y3. \wM4A1 + Deagle + Pachet Grenazi^n");
   add(menuBody, 511, "\y4. \wSpeed^n");
   add(menuBody, 511, "\y0. \wIesire");
   
   
   new KEYS = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<9 );
   show_menu(id, KEYS, menuBody, -1, "MENU");
   return PLUGIN_HANDLED;
}

public MenuAction(id, key)
{
   switch(key)
   {
      case 0:
      {
         give_item(id, "weapon_m4a1");
         cs_set_user_bpammo(id, CSW_M4A1, 0);
         give_item(id, "weapon_ak47");
         cs_set_user_bpammo(id, CSW_AK47, 0);
         give_item(id, "weapon_deagle");
         cs_set_user_bpammo(id, CSW_DEAGLE, 0);
         give_item(id, "weapon_hegrenade");
         cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
         give_item(id, "weapon_smokegrenade");
         cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
         ColorChat(id , TEAM_COLOR, "[ BG ]^x01 Ai primit pe langa M4A1, Ak47, deagle si un pachet de grenazi.");
      }
      case 1:
      {
         give_item(id, "weapon_ak47");
         cs_set_user_bpammo(id, CSW_AK47, 90);
         give_item(id, "weapon_deagle");
         cs_set_user_bpammo(id, CSW_DEAGLE, 21);
         give_item(id, "weapon_hegrenade");
         cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
         give_item(id, "weapon_smokegrenade");
         cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
         ColorChat(id , TEAM_COLOR, "[ BG ]^x01 Ai primit pe langa Ak47, deagle si un pachet de grenazi.");
      }
      case 2:
      {
         give_item(id, "weapon_m4a1");
         cs_set_user_bpammo(id, CSW_M4A1, 90);
         give_item(id, "weapon_deagle");
         cs_set_user_bpammo(id, CSW_DEAGLE, 21);
         give_item(id, "weapon_hegrenade");
         cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
         give_item(id, "weapon_smokegrenade");
         cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
         ColorChat(id , TEAM_COLOR, "[ BG ]^x01 Ai primit pe langa M4A1, deagle si un pachet de grenazi.");
      }
      case 3:
      {
         set_user_maxspeed(id, 600.0);
         ColorChat(id , TEAM_COLOR, "[ BG ]^x01 Ai primit 600 speed.");
      }
      case 9:
      {
         return PLUGIN_HANDLED;
      }
      
      default: return PLUGIN_HANDLED;
   }
   return PLUGIN_HANDLED;
}

care ii da un meniu la terro cu arme si vreau ca dupa ce alege odata arma si mai scrie inca o data /tmenu sa verifice pluginu daca acel jucator deja sia ales din meniu sau nu .
Mai pe scurt sa poata folosi numa o data acel meniu terro`ul.

Va multumesc.

0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> CS 2006-2019 (Archived) -> Resources  


The time now is 18-10-2024, 15:16:33
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x