AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with grenades + kevlar + deagle (https://forums.alliedmods.net/showthread.php?t=213627)

TRUE RED 04-17-2013 04:34

help with grenades + kevlar + deagle
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init()
{
    
register_plugin("Admins are VIP's + grenades + kevlar""1.0""Eg@r4$il{")
    
register_event("ResetHUD""ResetHUD""be")
}

public 
ResetHUD(id)
{
    
set_task(0.5"VIP"id 6910)
}

public 
VIP(TaskID)
{
    new 
id TaskID 6910
    
    
if (is_user_admin(id))
    {
        
message_begin(MSG_ALLget_user_msgid("ScoreAttrib"))
        
write_byte(id)
        
write_byte(4)
        
message_end()
        
give_item(id,"weapon_hegrenade")
        
give_item(id,"weapon_flashbang")
        
give_item(id,"weapon_flashbang")
        
give_item(id,"weapon_smokegrenade")
        
give_item(id,"item_assaultsuit")
        
give_item(id"weapon_deagle")    
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
        
give_item(id"ammo_50ae")
    }
    
    return 
PLUGIN_HANDLED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 

Help. how to avoid usp/glock at the round start? i would like to have deagle straight away. Can someone help me with it?

hornet 04-17-2013 05:00

Re: help with grenades + kevlar + deagle
 
You could set m_iDefaultItems, or you could use strip_user_weapons() - but not in ResetHUD message - this message is more complex than you think - you should really use Ham_Spawn, not only is it easier it's more efficient.

Leon M. 04-17-2013 05:01

Re: help with grenades + kevlar + deagle
 
Take a look here. This should help you.

ConnorMcLeod 04-17-2013 13:54

Re: help with grenades + kevlar + deagle
 
Try this :

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#tryinclude <cstrike_pdatas>

#if !defined _cbaseentity_included
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \
                
2. Put it into amxmodx/scripting/include/ folder   \
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif

enum scoreAttribFlags ( <<= ) {
    
SA_NONE 0,
    
SA_DEAD 1,
    
SA_BOMB,
    
SA_VIP
}

const 
WEAPON_SUIT 31

public plugin_init()
{
    
register_plugin("Admins are VIP's + grenades + kevlar""2.0""Eg@r4$il{")
    
RegisterHam(Ham_Spawn"player""OnCBasePlayer_Spawn")
    
RegisterHam(Ham_Spawn"player""OnCBasePlayer_Spawn_Post"true)
}

public 
OnCBasePlayer_Spawnid )
{
    if( 
pev_valid(id) == && (CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT) && is_user_admin(id) )
    {
        
set_pdata_bool(idm_bHasReceivedDefItemstrue)
    }
}

public 
OnCBasePlayer_Spawn_Postid )
{
    if( 
is_user_alive(id) && is_user_admin(id) )
    {
        
Util_ScoreAttrib(0idSA_VIP)

        
give_item(id"weapon_knife")
        
give_item(id"item_assaultsuit")
        
give_item(id"weapon_deagle")
        
ExecuteHam(Ham_GiveAmmoid70"50AE"70)
        
give_item(id"item_suit")
    }
}

Util_ScoreAttrib(idtargetflags)
{
    static 
msgScoreAttrib 0;
    if( !
msgScoreAttrib )
    {
        
msgScoreAttrib get_user_msgid("ScoreAttrib");
    }

    
message_begin(id MSG_ONE MSG_ALLmsgScoreAttrib_id);
    
write_byte(target);
    
write_byte(flags);
    
message_end();



TRUE RED 04-21-2013 14:21

Re: help with grenades + kevlar + deagle
 
make it for me somebody please, i didn't get it how to make it simple way..

Leon M. 04-21-2013 14:26

Re: help with grenades + kevlar + deagle
 
What's the problem?

I've posted a link with an answer you can easily edit by yourself and Connor has given you a full example based on pdatas.

ConnorMcLeod 04-21-2013 15:26

Re: help with grenades + kevlar + deagle
 
Just noticed that m_iHideHUD pdata is updated right when suit is given.
Touch code is like this :
Spoiler



So it should be better to directly send give_item(id, "item_suit") but after player has received his weapons (previous post code edited).


If you don't want to bother to figure out if player already has weapons or not, you can use that function :
Spoiler

Bos93 04-21-2013 16:58

Re: help with grenades + kevlar + deagle
 
PHP Code:

    static msgScoreAttrib 0;
    if( !
msgScoreAttrib )
    {
        
msgScoreAttrib get_user_msgid("ScoreAttrib");
    } 

Connor,why this is not registered inside plugin init ?

ConnorMcLeod 04-21-2013 17:10

Re: help with grenades + kevlar + deagle
 
Because i have a file with all messages stocks like this one, was lazy to put it in plugin_init, anyway it gonna be executed only once, it doesn't hurt.

TRUE RED 04-21-2013 17:15

Re: help with grenades + kevlar + deagle
 
Quote:

Originally Posted by ConnorMcLeod
Try this

Works fine but has couple wierd things:
  • When i entered the game i have this view on photo
  • When i chose class and start to play welcome motd appears and then i close it and all seems to be fine.
Photo is here http://firepic.org/images/2013-04/22/3xu8ct2nhey0.jpg


All times are GMT -4. The time now is 10:46.

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