Raised This Month: $51 Target: $400
 12% 

[EDIT] Revive Teammates


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 02-28-2014 , 23:46   [EDIT] Revive Teammates
Reply With Quote #1

Hello everyone
look at this code
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <fakemeta>

new const PLUGIN[] = "Revive teammate"
new const VERSION[] = "2.0.1"

new const PREFIX[] = "[ Deathrun ]"

enum {PrimarySecondaryHeFlash1Flash2Smoke}

// These weapons will be given to a revived player if rev_give_weaps cvar is enabled
// Leave an empty string ("") to disable the weapon
new const WEAPONS_CT[][] =
{    
    
"weapon_m4a1",            // primary
    
"weapon_usp",            // secondary
    
"weapon_hegrenade",        // he
    
"weapon_flashbang",        // flash1
    
"weapon_flashbang",        // flash2
    
"weapon_smokegrenade"        // smoke
}

new const 
WEAPONS_TERR[][] =
{
    
"weapon_ak47",            // primary
    
"weapon_glock18",        // secondary
    
"weapon_hegrenade",        // he
    
"weapon_flashbang",        // flash1
    
"weapon_flashbang",        // flash2
    
"weapon_smokegrenade"        // smoke
}

new 
cvarTeamcvarHudMsgOncvarRevPriceCtcvarRevPriceTerrcvarGiveWeaps,

g_HudSyncMsgg_MsgSayText

public plugin_init()
{
    
register_plugin(PLUGINVERSION"beast")
    
    
register_dictionary("revive_teammate.txt")
    
    
register_clcmd("say /revtm""ReviveMenu")
    
register_clcmd("say_team /revtm""ReviveMenu")
    
    
/* rev_team:
       0 - disables the plugin
       1 - enables it only for CT's
       2 - enables it only for Terr's
       3 - enables it for both teams
    */
    
cvarTeam register_cvar("rev_team""3")
    
    
/* rev_hudmsg:
       0 - disables the revival announcement hud message
       1 - enables it
    */
    
cvarHudMsgOn register_cvar("rev_hudmsg""1")
    
    
/* rev_price_ct:
       Price for CT's to revive a teammate
    */
    
cvarRevPriceCt register_cvar("rev_price_ct""10000")
    
    
/* rev_price_terr:
       Price for Terr's to revive a teammate
    */
    
cvarRevPriceTerr register_cvar("rev_price_terr""10000")
    
    
/* rev_give_weaps:
       0 - does not give weapons and armor to revived players
       1 - gives it only to revived CT's
       2 - gives it only to revived Terr's
       3 - gives it to both teams
    */
    
cvarGiveWeaps register_cvar("rev_give_weaps""3")
    
    
register_cvar(PLUGINVERSIONFCVAR_SPONLY FCVAR_SERVER)
    
    
g_HudSyncMsg CreateHudSyncObj()
    
    
g_MsgSayText get_user_msgid("SayText")
}

public 
ReviveMenu(id)
{
    if(!
is_user_alive(id))
    {
        
client_printcolor(id"/g%s/y %L"PREFIXid"DEAD_DENYED")
        return 
PLUGIN_HANDLED_MAIN
    
}
    
    new 
CsTeams:teamBuyer cs_get_user_team(id), revPrice
    
    
switch(get_pcvar_num(cvarTeam))
    {    
        case 
0: return PLUGIN_HANDLED_MAIN
        
case 1:
        {
            if(
teamBuyer == CS_TEAM_CT)
                
revPrice get_pcvar_num(cvarRevPriceCt)
            
            else
                return 
PLUGIN_HANDLED_MAIN
        
}
        case 
2
        {
            
            if(
teamBuyer == CS_TEAM_T)
                
revPrice get_pcvar_num(cvarRevPriceTerr)
            
            else
                return 
PLUGIN_HANDLED_MAIN
        
}
        default:
        {
            if(
teamBuyer == CS_TEAM_CT)
                
revPrice get_pcvar_num(cvarRevPriceCt)
            
            else
                
revPrice get_pcvar_num(cvarRevPriceTerr)
        }
    }
    
    if(
cs_get_user_money(id) < revPrice)
    {
        
client_printcolor(id"/g%s/y %L"PREFIXid"MONEY_SHORT"revPrice)
        return 
PLUGIN_HANDLED_MAIN
    
}
    
    new 
menuName[32], name[32], info[3], players[32], numitempIddeadTeammatesCsTeams:teamTempId
    
    formatex
(menuNamecharsmax(menuName), "%L"id"MENU_NAME")
    
    new 
menu menu_create(menuName"MenuHandler")

    
get_players(playersnum"bh")

    for(
0numi++)
    {
        
tempId players[i]
        
        
teamTempId cs_get_user_team(tempId)
        
        if(
teamBuyer == teamTempId)
        {    
            
deadTeammates++
            
            
get_user_name(tempIdnamecharsmax(name))
            
            
num_to_str(tempIdinfocharsmax(info))

            
menu_additem(menunameinfo)
        }
    }
    
    if(!
deadTeammates)
    {
        
client_printcolor(id"/g%s/y %L"PREFIXid"ALL_TMMS_ALIVE")
        return 
PLUGIN_HANDLED_MAIN
    
}
    
    
menu_display(idmenu)
    
    return 
PLUGIN_CONTINUE
}

public 
MenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
        
    if(!
is_user_alive(id))
    {
        
client_printcolor(id"/g%s/y %L"PREFIXid"DEAD_DENYED")
        
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}

    new 
accessinfo[3], name[32], callback
    
    menu_item_getinfo
(menuitemaccessinfocharsmax(info), namecharsmax(name), callback)
    
    
menu_destroy(menu)    

    new 
target str_to_num(info)
    
    if(
is_user_alive(target))
        return 
PLUGIN_HANDLED
        
    
new CsTeams:teamBuyer cs_get_user_team(id), CsTeams:teamTarget cs_get_user_team(target)
    
    if(
teamBuyer != teamTarget)
        return 
PLUGIN_HANDLED
    
    
new money cs_get_user_money(id), revPrice
    
    
if(teamBuyer == CS_TEAM_CT)
        
revPrice get_pcvar_num(cvarRevPriceCt)
    
    else
        
revPrice get_pcvar_num(cvarRevPriceTerr)
    
    if(
money revPrice)
    {
        
client_printcolor(id"/g%s/y %L"PREFIXid"MONEY_SHORT"revPrice)
        return 
PLUGIN_HANDLED
    
}
        
    new 
nameBuyer[32], nameTarget[32]
        
    
get_user_name(idnameBuyercharsmax(nameBuyer))
    
get_user_name(targetnameTargetcharsmax(nameTarget))        
        
    
ExecuteHamB(Ham_CS_RoundRespawntarget)
        
    switch(
get_pcvar_num(cvarGiveWeaps))
    {    
        case 
1: if(teamTarget == CS_TEAM_CTGiveWeapons(targetWEAPONS_CT[Primary], WEAPONS_CT[Secondary], WEAPONS_CT[He], WEAPONS_CT

[Flash1], WEAPONS_CT[Flash2], WEAPONS_CT[Smoke])
        case 
2: if(teamTarget == CS_TEAM_TGiveWeapons(targetWEAPONS_TERR[Primary], WEAPONS_TERR[Secondary], WEAPONS_TERR[He], 

WEAPONS_TERR[Flash1], WEAPONS_TERR[Flash2], WEAPONS_TERR[Smoke])
        case 
3:
        {
            if(
teamTarget == CS_TEAM_CT)
                
GiveWeapons(targetWEAPONS_CT[Primary], WEAPONS_CT[Secondary], WEAPONS_CT[He], WEAPONS_CT[Flash1], WEAPONS_CT

[Flash2], WEAPONS_CT[Smoke])
        
            else
                
GiveWeapons(targetWEAPONS_TERR[Primary], WEAPONS_TERR[Secondary], WEAPONS_TERR[He], WEAPONS_TERR[Flash1], 

WEAPONS_TERR[Flash2], WEAPONS_TERR[Smoke])
        }
    }
    
    
cs_set_user_money(idmoney revPrice1)
        
    if(
get_pcvar_num(cvarHudMsgOn))
    {
        
set_hudmessage(2558500.010.2606.06.00.12.0, -1)
        
ShowSyncHudMsg(0g_HudSyncMsg"%L"LANG_PLAYER"HAS_REVIVED"nameBuyernameTarget)
    }
    
    return 
PLUGIN_HANDLED
}

GiveWeapons(idprimWeapon[], secWeapon[], he[], flash1[], flash2[], smoke[])
{
    
StripPlayerWeapons(id)
    
    
give_item(id"weapon_knife")
    
give_item(id"item_assaultsuit")
    
    if(
primWeapon[0] == 'w')
    {
        
give_item(idprimWeapon)
        
        new 
primWeaponId get_weaponid(primWeapon)
        
        
cs_set_user_bpammo(idprimWeaponIdGetWeaponMaxBpammo(primWeaponId))
    }
    
    if(
secWeapon[0] == 'w')
    {
        
give_item(idsecWeapon)
        
        new 
secWeaponId get_weaponid(secWeapon)
        
        
cs_set_user_bpammo(idsecWeaponIdGetWeaponMaxBpammo(secWeaponId))
    }
    
    if(
he[0] == 'w')
        
give_item(idhe)
    
    if(
flash1[0] == 'w')
        
give_item(idflash1)

    if(
flash2[0] == 'w')
        
give_item(idflash2)

    if(
smoke[0] == 'w')
        
give_item(idsmoke)
}

stock StripPlayerWeapons(id)
{
    
strip_user_weapons(id)
    
set_pdata_int(id1160// bugfix: http://forums.alliedmods.net/showthread.php?t=90106
}
    
stock GetWeaponMaxBpammo(weapon)
{
    new 
bp
    
    
switch(weapon)
    {
        case 
CSW_SCOUTCSW_AUGCSW_SG550CSW_GALILCSW_FAMASCSW_G3SG1CSW_SG552CSW_AK47bp 90
        
case CSW_MAC10CSW_FIVESEVENCSW_UMP45CSW_USPCSW_P90bp 100
        
case CSW_ELITECSW_GLOCK18CSW_MP5NAVYCSW_TMPbp 120
        
case CSW_XM1014CSW_M3bp 32
        
case CSW_DEAGLEbp 35
        
case CSW_M249bp 200
        
case CSW_P228bp 52
        
case CSW_AWPbp 30
    
}
    
    return 
bp
}

client_printcolor(const id, const input[], any:...)
{
    static 
msg[191]
    
    
vformat(msgcharsmax(msg), input3)
    
    
replace_all(msgcharsmax(msg), "/g""^4")
    
replace_all(msgcharsmax(msg), "/y""^1")

    if(
is_user_connected(id))
    {
        
message_begin(MSG_ONE_UNRELIABLEg_MsgSayText_id)
        
write_byte(id)
        
write_string(msg)
        
message_end()
    }

its only you can revive your Teammates if you have 10000 money
i want help to remove that and make it every player can revive one Teammate IN one round

need your help
thanks for your attention
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
joelverghese
Member
Join Date: Oct 2011
Old 03-01-2014 , 20:49   Re: [EDIT] Revive Teammates
Reply With Quote #2

PHP Code:
rev_price_ct 0
rev_price_terr 0 
put these in amxx.cfg
joelverghese is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:50.


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