Raised This Month: $ Target: $400
 0% 

[SOLVED] buy mod by frags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-20-2015 , 21:32   [SOLVED] buy mod by frags
Reply With Quote #1

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

Last edited by arvEL.; 10-28-2015 at 23:27.
arvEL. is offline
Send a message via Skype™ to arvEL.
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-21-2015 , 00:54   Re: [HELP] buy mod by frags
Reply With Quote #2

So, what the problem?
zmd94 is offline
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-21-2015 , 08:26   Re: [HELP] buy mod by frags
Reply With Quote #3

Quote:
Originally Posted by zmd94 View Post
So, what the problem?

Hello bro plz read my topic and what i want
arvEL. is offline
Send a message via Skype™ to arvEL.
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 10-21-2015 , 08:10   Re: [HELP] buy mod by frags
Reply With Quote #4

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


Last edited by Chihuahuax; 10-21-2015 at 08:15.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-21-2015 , 08:27   Re: [HELP] buy mod by frags
Reply With Quote #5

Quote:
Originally Posted by Chihuahuax View Post
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!

Last edited by arvEL.; 10-21-2015 at 20:16.
arvEL. is offline
Send a message via Skype™ to arvEL.
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-21-2015 , 13:38   Re: [HELP] buy mod by frags
Reply With Quote #6

i sloved it.
T/C

Last edited by arvEL.; 10-21-2015 at 20:16.
arvEL. is offline
Send a message via Skype™ to arvEL.
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 22:16.


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