AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] buy mod by frags (https://forums.alliedmods.net/showthread.php?t=273541)

arvEL. 10-20-2015 21:32

[SOLVED] buy mod by frags
 
hi guys i moded this plugin

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <csx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <colorchat>

new const g_szModel[32] = "vip"
new g_iChosen

// Create the HUD Sync Objects
new g_MsgSync

// HUD messages
const Float:HUD_EVENT_X = -1.0
const Float:HUD_EVENT_Y 0.17

public plugin_init()
{
    
register_plugin("1 vs all""1.0""Flicker")
    
register_clcmd"cs_vsall""onNewRound"ADMIN_BAN"vsALL Round!!!" )
    
register_event("DeathMsg""onDeathMsgEvent""a")  
    
RegisterHam(Ham_Spawn"player""onPlayerSpawn"1)
    
// Create the HUD Sync Objects
    
g_MsgSync CreateHudSyncObj()
}

public 
plugin_precache()
{
    new 
szModel[64]
    
formatex(szModelcharsmax(szModel), "models/player/vip/vip.mdl")
    
precache_model(szModel)
}

public 
onNewRound(id,level,cid){
    if(!
cmd_access(id,level,cid,3))return PLUGIN_HANDLED;    
    
set_task(0.1"ChooseTheOne")    
}
  
public 
onPlayerSpawn(id)
{
    if(
is_user_alive(id) && g_iChosen == id)
    {
        new 
szModel[32]
        
cs_get_user_model(idszModelcharsmax(szModel))    
        if(!
equali(szModelg_szModel))
        
cs_set_user_model(idg_szModel)
    }
}
    
public 
ChooseTheOne()
{
    if(!
g_iChosen)
        
g_iChosen GetRandomPlayer("ah")  
    new 
players[32], numid
    get_players
(playersnum"ah")  
    for(new 
inumi++)
    {
        
id players[i]
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
        
set_user_health(id200)
        
cs_set_user_armor(id50CS_ARMOR_VESTHELM);
        
cs_set_user_team(idid == g_iChosen CS_TEAM_T CS_TEAM_CT)
        
ExecuteHamB(Ham_CS_RoundRespawnid)
    }
    
set_user_health(g_iChosen250)
    
cs_set_user_armor(g_iChosen200CS_ARMOR_VESTHELM);
    
strip_user_weapons(g_iChosen)
    
give_item(g_iChosen,"weapon_awp")
    
give_item(g_iChosen,"weapon_knife")
    
give_item(g_iChosen,"weapon_deagle")
    
cs_set_user_bpammo(g_iChosen,CSW_AWP,3)
    
cs_set_user_bpammo(g_iChosen,CSW_DEAGLE,7)
    new 
szName[32]
    
get_user_name(g_iChosenszNamecharsmax(szName))   
    
ColorChat(0GREY"^4[CS]^3 %s^1 bought^4 Sniper"szName)
    
set_hudmessage(20255255HUD_EVENT_XHUD_EVENT_Y10.05.01.01.0, -1)
    
ShowSyncHudMsg(0g_MsgSync"%s is Sniper !!!"szName)
    
client_cmd(0"spk ^"ambience/port_suckin1^"")
}

public 
onDeathMsgEvent()
{
    new 
kil read_data(1)
    new 
vic read_data(2
    if(!
is_user_connected(kil) || !is_user_connected(vic))
        return
    if(
g_iChosen == vic)
    {
        
cs_reset_user_model(vic)  
        new 
szName[32]
        
get_user_name(kilszNamecharsmax(szName))    
        if(
g_iChosen == kil)
        {
            
g_iChosen GetRandomPlayer("h")        
            
cs_set_user_model(g_iChoseng_szModel)     
            return
        }       
        
g_iChosen kil        
    
}
}

public 
client_disconnect(id)
{
    if(
id == g_iChosen)
    {
        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))      
        
g_iChosen GetRandomPlayer("h")
        while(
get_user_team(g_iChosen) == 3)
        
g_iChosen GetRandomPlayer("h")  
        new 
szNewName[32]
        
get_user_name(g_iChosenszNewNamecharsmax(szNewName))     
        
ColorChat(0GREY"^4[CS]^1 Last sniper,^3 %s^1 disconnected,^4 %s^1 is the last sniper!"szNameszNewName)
    }
}

stock GetRandomPlayer(const flags[])
{
    new 
players[32], num
    get_players
(playersnumflags
    return 
num players[random(num)] : 0


this plugin make challenge one VS all ok ?
it's give random challenge to players i want development it
so that the player can buy this mod with frags if the player have 50 frags
he can buy this mod for himself

example:

now i'm player my name arvEL and i have 50 frags
i want buy this mod to myself i open console and write cs_vsall
the server will give this mod to me
i will became sniper and all player have knifes

i wish you understand what i mean and what i need
sorry my english bad

zmd94 10-21-2015 00:54

Re: [HELP] buy mod by frags
 
So, what the problem?

Chihuahuax 10-21-2015 08:10

Re: [HELP] buy mod by frags
 
example
PHP Code:

public plugin_init()
{
    
register_clcmd("say /sniper""buy_sniper")


PHP Code:

public buy_sniper(id)
{
    if (
get_user_frags(id) < 50)
        return 
PLUGIN_HANDLED

    set_user_frags
(idget_user_frags(id) - 50)
    
strip_user_weapons(id)
    
give_item(id"weapon_knife")
    
give_item(id"weapon_awp")
    
xxx //functions that move other players to CT/T

    
return PLUGIN_CONTINUE



arvEL. 10-21-2015 08:26

Re: [HELP] buy mod by frags
 
Quote:

Originally Posted by zmd94 (Post 2355230)
So, what the problem?


Hello bro plz read my topic and what i want

arvEL. 10-21-2015 08:27

Re: [HELP] buy mod by frags
 
Quote:

Originally Posted by Chihuahuax (Post 2355321)
example
PHP Code:

public plugin_init()
{
    
register_clcmd("say /sniper""buy_sniper")


PHP Code:

public buy_sniper(id)
{
    if (
get_user_frags(id) < 50)
        return 
PLUGIN_HANDLED

    set_user_frags
(idget_user_frags(id) - 50)
    
strip_user_weapons(id)
    
give_item(id"weapon_knife")
    
give_item(id"weapon_awp")
    
xxx //functions that move other players to CT/T

    
return PLUGIN_CONTINUE



not work!

arvEL. 10-21-2015 13:38

Re: [HELP] buy mod by frags
 
i sloved it.
T/C


All times are GMT -4. The time now is 22:16.

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