Редакция на REVIVE плъгин

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
JustInCase
Извън линия
Потребител
Потребител
Мнения: 582
Регистриран на: 14 Окт 2016, 23:31
Се отблагодари: 4 пъти
Получена благодарност: 15 пъти

Редакция на REVIVE плъгин

Мнение от JustInCase » 02 Дек 2016, 15:31

Код за потвърждение: Избери целия код

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

#define PLUGIN "Ultimate Revive"
#define VERSION "1.1"
#define AUTHOR "anakin_cstrike"

new g_fade;
public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR);
   register_concmd("amx_revive","revive_cmd",ADMIN_RCON,"- <player/@/@T/@CT> <hp> <armor>");
   g_fade = get_user_msgid("ScreenFade");
}
public revive_cmd(id,level,cid)
{
   if(!cmd_access(id,level,cid,4))
      return PLUGIN_HANDLED;
   new 
   arg[32],arg2[4],arg3[4],
   name[32],hp,armor;
   read_argv(1,arg,31);
   read_argv(2,arg2,3);
   read_argv(3,arg3,3);
   get_user_name(id,name,31);
   new argc = read_argc();
   if(argc < 2) {hp = 100;armor = 0;}
   else if(argc == 3) {hp = str_to_num(arg2);armor = 0;}
   else {hp = str_to_num(arg2);armor = str_to_num(arg3);}
   if(arg[0] == '@')
   {
      new players[32],teamname[24],tname[16],num,index,i;
      if(arg[1])
      {
         if(arg[1] == 'T')
         {
            copy(tname,15,"TERRORIST");
            copy(teamname,23,"Terrorist");
         } else if(arg[1] == 'C' && arg[2] == 'T') {
            copy(tname,15,"CT");
            copy(teamname,23,"Counter-Terrorist");
         } else {
            console_print(id,"Usage: @T/@CT");
            return PLUGIN_HANDLED;
         }
         get_players(players,num,"be",tname);
      } else {
         get_players(players,num);
         copy(teamname,23,"All");
      }
      if(num == 0)
      {
         console_print(id,"No players in team %s",teamname);
         return PLUGIN_HANDLED;
      }
      for(i = 0;i < num;i++)
      {
         index = players[i];
         if(is_user_alive(index)) continue;
         Revive(index,hp,armor);
      }
      log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,teamname,hp,armor);
   } else {
      new target = cmd_target(id,arg,0);
      if(!target)
      return PLUGIN_HANDLED;
      if(is_user_alive(target))
      {
         console_print(id,"Player is allready alive !");
         return PLUGIN_HANDLED;
      }
      new namet[32]; 
      get_user_name(target,namet,31);
      Revive(target,hp,armor);
      log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,namet,hp,armor);
   }
   return PLUGIN_HANDLED;
}
Revive(index,hp,armor)
{
   set_pev(index,pev_deadflag,DEAD_RESPAWNABLE);
   set_pev(index,pev_iuser1,0);
   dllfunc(DLLFunc_Think,index);
   engfunc(EngFunc_SetOrigin,index,Float:{-4800.0,-4800.0,-4800.0});
   new array[3];
   array[0] = index;
   array[1] = hp;
   array[2] = armor
   set_task(0.5,"respawn",0,array,3);
}
public respawn(array[3])
{
   new index = array[0];
   new hp = array[1];
   new armor = array[2];
   if(is_user_connected(index))
   {
      dllfunc(DLLFunc_Spawn,index);
      set_pev(index,pev_health,float(hp));
      set_pev(index,pev_armorvalue,float(armor));
      switch(get_user_team(index))
           {
                  case 1:
                  {
                      fm_give_item(index,"weapon_knife");
                      fm_give_item(index,"weapon_glock18");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                  }
                  case 2:
                  {
                         fm_give_item(index,"weapon_knife");
                      fm_give_item(index,"weapon_usp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                  }
           }
      Fade(index,0,255,0,30);
   }
}
stock fm_give_item(id,const item[])
{
   static ent
   ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
   if(!pev_valid(ent)) return;
   
   static Float:originF[3]
   pev(id, pev_origin, originF);
   set_pev(ent, pev_origin, originF);
   set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
   dllfunc(DLLFunc_Spawn, ent);
   
   static save
   save = pev(ent, pev_solid);
   dllfunc(DLLFunc_Touch, ent, id);
   if(pev(ent,pev_solid) != save)
      return;
      
   engfunc(EngFunc_RemoveEntity, ent);
}
stock Fade(index,red,green,blue,alpha)
{
   message_begin(MSG_ONE,g_fade,{0,0,0},index);
   write_short(1<<10);
   write_short(1<<10);
   write_short(1<<12);
   write_byte(red);
   write_byte(green);
   write_byte(blue);
   write_byte(alpha);
   message_end();
}
Може ли някой да преработи плъгина така, че да може да се REVIVE чрез команда /revive "NickName" "HP" "AP" ако няма въведени стойности на HP/AP да ги прави автоматично на 100.
MANSION - HNS : 45.144.155.99:27026
ONLINE

Аватар
hackera457
Извън линия
Потребител
Потребител
Мнения: 768
Регистриран на: 01 Ное 2016, 09:46
Местоположение: София
Се отблагодари: 1 път
Получена благодарност: 124 пъти
Обратна връзка:

Re: Редакция на REVIVE плъгин

Мнение от hackera457 » 02 Дек 2016, 21:20

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "Ultimate Revive"
#define VERSION "1.1"
#define AUTHOR "anakin_cstrike/Edit:hackera457"

new g_fade;
public plugin_init()
{
    
   register_plugin(PLUGIN, VERSION, AUTHOR);
   register_clcmd("say","HookSay")
   
   g_fade = get_user_msgid("ScreenFade");
}

public HookSay(id)
{
    new iArgs[38], iArg1[6], iArg2[33],iArg3[34],iArg4[34]; 
    read_args( iArgs, 37 ); 
    remove_quotes( iArgs ); 
    
     
    if( containi(iArgs, "revive") == -1 && iArgs[0] != '/' ) 
        return PLUGIN_CONTINUE; 
    
    parse( iArgs, iArg1, 5, iArg2, 32, iArg3,33,iArg4,33 );
    
    if( equali(iArg1, "/revive", 5) && get_user_flags(id) & ADMIN_RCON ) {
        
        new iPlayer,iHp,iArmor
        
        if(equali(iArg2,""))
        {
            client_print(id,print_chat,"[AMXX] Usage: /revive <nickname> <hp> <armor>")
            return PLUGIN_HANDLED
        }
        
        
        iPlayer = cmd_target(id,iArg2,0)
        
        if(iPlayer)
        {
            if (!is_user_alive(iPlayer) && cs_get_user_team(iPlayer) != CS_TEAM_SPECTATOR ) {
                
                new szAdminName[32], szPlayerName[32]
                
                get_user_name(id,szAdminName,charsmax(szAdminName))
                get_user_name(iPlayer,szPlayerName, charsmax(szPlayerName))
                
                if(equali(iArg3,"") || equali(iArg4,""))
                {
                    iHp = 100
                    iArmor = 100
                }
                else
                {
                    iHp = str_to_num(iArg3)
                    iArmor = str_to_num(iArg4)
                }
                
                Revive(iPlayer,iHp,iArmor)
                
                client_print(iPlayer,print_chat,"[AMXX] ADMIN %s revived you! (HP: %i | Armor: %i)",szAdminName,iHp,iArmor)
                log_amx("ADMIN %s: Revive %s with %i hp and %i armor",szAdminName,szPlayerName,iHp,iArmor)
                
            }
        }
        else
        {
            client_print(id,print_chat,"[AMXX] Player not found!")
            return PLUGIN_HANDLED
        }
        
    }
    
    return PLUGIN_CONTINUE
}



Revive(index,hp,armor)
{
   set_pev(index,pev_deadflag,DEAD_RESPAWNABLE);
   set_pev(index,pev_iuser1,0);
   dllfunc(DLLFunc_Think,index);
   engfunc(EngFunc_SetOrigin,index,Float:{-4800.0,-4800.0,-4800.0});
   new array[3];
   array[0] = index;
   array[1] = hp;
   array[2] = armor
   set_task(0.5,"respawn",0,array,3);
}
public respawn(array[3])
{
   new index = array[0];
   new hp = array[1];
   new armor = array[2];
   if(is_user_connected(index))
   {
      dllfunc(DLLFunc_Spawn,index);
      set_pev(index,pev_health,float(hp));
      set_pev(index,pev_armorvalue,float(armor));
      switch(get_user_team(index))
           {
                  case 1:
                  {
                      fm_give_item(index,"weapon_knife");
                      fm_give_item(index,"weapon_glock18");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                  }
                  case 2:
                  {
                      fm_give_item(index,"weapon_knife");
                      fm_give_item(index,"weapon_usp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                  }
           }
      Fade(index,0,255,0,30);
   }
}
stock fm_give_item(id,const item[])
{
   static ent
   ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
   if(!pev_valid(ent)) return;
   
   static Float:originF[3]
   pev(id, pev_origin, originF);
   set_pev(ent, pev_origin, originF);
   set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
   dllfunc(DLLFunc_Spawn, ent);
   
   static save
   save = pev(ent, pev_solid);
   dllfunc(DLLFunc_Touch, ent, id);
   if(pev(ent,pev_solid) != save)
      return;
      
   engfunc(EngFunc_RemoveEntity, ent);
}
stock Fade(index,red,green,blue,alpha)
{
   message_begin(MSG_ONE,g_fade,{0,0,0},index);
   write_short(1<<10);
   write_short(1<<10);
   write_short(1<<12);
   write_byte(red);
   write_byte(green);
   write_byte(blue);
   write_byte(alpha);
   message_end();
}

Код за потвърждение: Избери целия код

/revive <nickname> <hp> <armor> 
Моите плъгини

Код за потвърждение: Избери целия код

#include <hambeer>

RegisterHamBeer(HamBeer_Spawn, "player", "GivePlayerBeer", 1);

public GivePlayerBeer(Pl){
    if(!is_user_alive(Pl)){
        ham_give_beer(Pl, 5)
        client_print(Pl, print_chat, "Go Go Go"){
}  


Аватар
JustInCase
Извън линия
Потребител
Потребител
Мнения: 582
Регистриран на: 14 Окт 2016, 23:31
Се отблагодари: 4 пъти
Получена благодарност: 15 пъти

Re: Редакция на REVIVE плъгин

Мнение от JustInCase » 03 Дек 2016, 14:38

Благодаря. Добавих и една проверка ако играчът е жив, за да може плъгина да е напълно изпипан.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "Ultimate Revive"
#define VERSION "1.1"
#define AUTHOR "anakin_cstrike/Edit:hackera457"

new g_fade;
public plugin_init()
{
    
   register_plugin(PLUGIN, VERSION, AUTHOR);
   register_clcmd("say","HookSay")
   
   g_fade = get_user_msgid("ScreenFade");
}

public HookSay(id)
{
    new iArgs[38], iArg1[6], iArg2[33],iArg3[34],iArg4[34]; 
    read_args( iArgs, 37 ); 
    remove_quotes( iArgs ); 
    
     
    if( containi(iArgs, "revive") == -1 && iArgs[0] != '/' ) 
        return PLUGIN_CONTINUE; 
    
    parse( iArgs, iArg1, 5, iArg2, 32, iArg3,33,iArg4,33 );
    
    if( equali(iArg1, "/revive", 5) && get_user_flags(id) & ADMIN_RCON ) {
        
        new iPlayer,iHp,iArmor
        
        if(equali(iArg2,""))
        {
            client_print(id,print_chat,"[AMXX] Usage: /revive <nickname> <hp> <armor>")
            return PLUGIN_HANDLED
        }
        
        
        iPlayer = cmd_target(id,iArg2,0)
        if(is_user_alive(iPlayer))
        {
            new szPlayerName[33]
            get_user_name(iPlayer, szPlayerName, 32)
            client_print(id, print_chat, "[AMXX] Player %s is already alive", szPlayerName)
        }
        
        if(iPlayer)
        {
            if (!is_user_alive(iPlayer) && cs_get_user_team(iPlayer) != CS_TEAM_SPECTATOR ) {
                
                new szAdminName[32], szPlayerName[32]
                
                get_user_name(id,szAdminName,charsmax(szAdminName))
                get_user_name(iPlayer,szPlayerName, charsmax(szPlayerName))
                
                if(equali(iArg3,"") || equali(iArg4,""))
                {
                    iHp = 100
                    iArmor = 100
                }
                else
                {
                    iHp = str_to_num(iArg3)
                    iArmor = str_to_num(iArg4)
                }
                
                Revive(iPlayer,iHp,iArmor)
                
                client_print(iPlayer,print_chat,"[AMXX] ADMIN %s revived you! (HP: %i | Armor: %i)",szAdminName,iHp,iArmor)
                log_amx("ADMIN %s: Revive %s with %i hp and %i armor",szAdminName,szPlayerName,iHp,iArmor)
                
            }
        }
        else
        {
            client_print(id,print_chat,"[AMXX] Player not found!")
            return PLUGIN_HANDLED
        }
        
    }
    
    return PLUGIN_CONTINUE
}



Revive(index,hp,armor)
{
   set_pev(index,pev_deadflag,DEAD_RESPAWNABLE);
   set_pev(index,pev_iuser1,0);
   dllfunc(DLLFunc_Think,index);
   engfunc(EngFunc_SetOrigin,index,Float:{-4800.0,-4800.0,-4800.0});
   new array[3];
   array[0] = index;
   array[1] = hp;
   array[2] = armor
   set_task(0.5,"respawn",0,array,3);
}
public respawn(array[3])
{
   new index = array[0];
   new hp = array[1];
   new armor = array[2];
   if(is_user_connected(index))
   {
      dllfunc(DLLFunc_Spawn,index);
      set_pev(index,pev_health,float(hp));
      set_pev(index,pev_armorvalue,float(armor));
      switch(get_user_team(index))
           {
                  case 1:
                  {
                      fm_give_item(index,"weapon_knife");
                      fm_give_item(index,"weapon_glock18");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                      fm_give_item(index,"ammo_9mm");
                  }
                  case 2:
                  {
                      fm_give_item(index,"weapon_knife");
                      fm_give_item(index,"weapon_usp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                      fm_give_item(index,"ammo_45acp");
                  }
           }
      Fade(index,0,255,0,30);
   }
}
stock fm_give_item(id,const item[])
{
   static ent
   ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
   if(!pev_valid(ent)) return;
   
   static Float:originF[3]
   pev(id, pev_origin, originF);
   set_pev(ent, pev_origin, originF);
   set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
   dllfunc(DLLFunc_Spawn, ent);
   
   static save
   save = pev(ent, pev_solid);
   dllfunc(DLLFunc_Touch, ent, id);
   if(pev(ent,pev_solid) != save)
      return;
      
   engfunc(EngFunc_RemoveEntity, ent);
}
stock Fade(index,red,green,blue,alpha)
{
   message_begin(MSG_ONE,g_fade,{0,0,0},index);
   write_short(1<<10);
   write_short(1<<10);
   write_short(1<<12);
   write_byte(red);
   write_byte(green);
   write_byte(blue);
   write_byte(alpha);
   message_end();
}
MANSION - HNS : 45.144.155.99:27026
ONLINE

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Bing [Bot] и 14 госта