Raised This Month: $32 Target: $400
 8% 

weapon ammo


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LightScribe16
Junior Member
Join Date: Jul 2011
Old 07-27-2011 , 07:59   weapon ammo
Reply With Quote #1

In some maps give ammunition scout, Please help fix this problem!

PHP Code:
public give_stuff(id)
{
if(!
is_user_alive(id)) return PLUGIN_HANDLED
 
    else if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
    
   
fm_give_item(id"item_assaultsuit");
   
fm_give_item(id"weapon_flashbang");
   
fm_give_item(id"weapon_flashbang");
   
fm_give_item(id"weapon_hegrenade");
   
fm_give_item(id"weapon_smokegrenade");
   
set_user_gravity (id0.75);
   
cs_set_weapon_ammo(fm_give_itemid"weapon_scout" ), 0);
   
cs_set_user_bpammo(idCSW_SCOUT0);
   
   return 
PLUGIN_CONTINUE
         
}
    

LightScribe16 is offline
Send a message via Skype™ to LightScribe16
Aykay
Senior Member
Join Date: Jul 2009
Location: Australia
Old 07-27-2011 , 08:04   Re: weapon ammo
Reply With Quote #2

How are you calling give_stuff(id)?

Maybe you should put it in the CurWeapon event?
__________________

Aykay is offline
Send a message via MSN to Aykay
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-27-2011 , 08:11   Re: weapon ammo
Reply With Quote #3

What's wrong with give_item()?
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
LightScribe16
Junior Member
Join Date: Jul 2011
Old 07-27-2011 , 08:19   Re: weapon ammo
Reply With Quote #4

Quote:
Originally Posted by Aykay View Post
How are you calling give_stuff(id)?

Maybe you should put it in the CurWeapon event?
PHP Code:
RegisterHam(Ham_Spawn"player""give_stuff"1
Quote:
What's wrong with give_item()?
When someone die, grenades return, but with fm give item not so

Sorry for my bad language

Full code

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <amxmisc>
#include <fun>

#define PLUGIN_NAME "vipas"
#define PLUGIN_AUTHOR "Kukulis"
#define PLUGIN_VERSION "0.1"

static const COLOR[] = "^x04"
static const CONTACT[] = ""

new maxplayers
new gmsgSayText
new bool:HasC4[33]
#define Keysrod (1<<0)|(1<<1)|(1<<9) // Keys: 1234567890

public plugin_init()
{
register_plugin(PLUGIN_NAMEPLUGIN_AUTHORPLUGIN_VERSION);

RegisterHam(Ham_Spawn"player""give_stuff"1)     
register_event("ResetHUD","event_reset_hud","be");
register_event"ResetHUD""ResetHUD""be" )
register_clcmd("say /vip","admin_motd",0,"- Shows the MOTD.")

register_clcmd("say""handle_say")
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
gmsgSayText get_user_msgid("SayText")

maxplayers get_maxplayers()

return 
PLUGIN_CONTINUE

}



public 
event_reset_hud(id)
{
if(!
is_user_connected(id))
return 
PLUGIN_CONTINUE;

client_print(idprint_chat"[VIP] Write /vip To see the VIP privileges.")

if(!
access(id,ADMIN_CVAR))
return 
PLUGIN_CONTINUE;

set_task(1.0,"give_stuff",id);

return 
PLUGIN_CONTINUE;
}

public 
admin_motd(id,level,cid) {

    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_CONTINUE
    
    show_motd
(id,"vip.txt","VIP by Kukulis")
    return 
PLUGIN_CONTINUE   
}




public 
give_stuff(id)
{
if(!
is_user_alive(id)) return PLUGIN_HANDLED
 
    else if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
    
   
fm_give_item(id"item_assaultsuit");
   
fm_give_item(id"weapon_flashbang");
   
fm_give_item(id"weapon_flashbang");
   
fm_give_item(id"weapon_hegrenade");
   
fm_give_item(id"weapon_smokegrenade");
   
set_user_gravity (id0.75);
   
cs_set_weapon_ammo(fm_give_itemid"weapon_scout" ), 0);
   
cs_set_user_bpammo(idCSW_SCOUT0);
   
   return 
PLUGIN_CONTINUE
         
}
    
}

public 
handle_say(id)
{
    new 
said[192]
    
read_args(said,192)
    if(( 
containi(said"who") != -&& containi(said"admin") != -1) || contain(said"/vips") != -1)
        
set_task(0.1,"print_viplist"id)
    return 
PLUGIN_CONTINUE
}

public 
print_viplist(user
{
    new 
adminnames[33][32]
    new 
message[256]
    new 
contactinfo[256], contact[112]
    new 
idcountxlen
    
    
for(id id <= maxplayers id++)
        if(
is_user_connected(id))
            if(
get_user_flags(id) & ADMIN_CVAR)
                
get_user_name(idadminnames[count++], 31)

    
len format(message255"%s Online VIP: ",COLOR)
    if(
count 0) {
        for(
count x++) {
            
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
            if(
len 96 ) {
                
print_message(usermessage)
                
len format(message255"%s ",COLOR)
            }
        }
        
print_message(usermessage)
    }
    else {
        
len += format(message[len], 255-len"No online VIP.")
        
print_message(usermessage)
    }

    
get_cvar_string("amx_contactinfo"contact63)
    if(
contact[0])  {
        
format(contactinfo111"%s Contact Server Admin -- %s"COLORcontact)
        
print_message(usercontactinfo)
    }
}

print_message(idmsg[])
{
    
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()
}

public 
ResetHUDid )
{
    
set_task0.5"VIP"id 6910 )

    if (
user_has_weapon(idCSW_C4) && get_user_team(id) == 1)
        {
            
HasC4[id] = true;
            
set_task0.5"Bomb"id 6910 )
        }
}

public 
VIPTaskIDid )
{
    new 
id TaskID 6910

    
if ( get_user_flagsid ) & ADMIN_LEVEL_H 
    {
        
message_beginMSG_ALLget_user_msgid"ScoreAttrib" ) )
        
write_byteid )
        
write_byte)
        
message_end( )
    }

    return 
PLUGIN_HANDLED


Last edited by LightScribe16; 07-27-2011 at 08:33.
LightScribe16 is offline
Send a message via Skype™ to LightScribe16
Old 07-28-2011, 04:24
LightScribe16
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-28-2011 , 07:48   Re: weapon ammo
Reply With Quote #5

Could you specify what was the problem again?
SnoW is offline
Send a message via MSN to SnoW
LightScribe16
Junior Member
Join Date: Jul 2011
Old 07-28-2011 , 08:43   Re: weapon ammo
Reply With Quote #6

When starting a new round then given a scout with 10 / 0 , but I need to give a scout with 0/0 ammunition
LightScribe16 is offline
Send a message via Skype™ to LightScribe16
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-28-2011 , 09:07   Re: weapon ammo
Reply With Quote #7

Quote:
Originally Posted by LightScribe16 View Post
When starting a new round then given a scout with 10 / 0 , but I need to give a scout with 0/0 ammunition
Code:
cs_set_weapon_ammo(fm_give_item( id, "weapon_scout" ), 0);
This is exactly what you want. You have to though use the newest version of everything, not have some other plugin giving ammo and actually replace/update the copy of this same plugin that did not empty the ammo.
SnoW is offline
Send a message via MSN to SnoW
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 07-28-2011 , 09:20   Re: weapon ammo
Reply With Quote #8

It's hard for Lithuania people to script
usaexelent is offline
Send a message via Skype™ to usaexelent
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-28-2011 , 10:02   Re: weapon ammo
Reply With Quote #9

Quote:
Originally Posted by LightScribe16 View Post
UP Up
Don't bump until 2 weeks have passed since last post.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
LightScribe16
Junior Member
Join Date: Jul 2011
Old 07-29-2011 , 08:17   Re: weapon ammo
Reply With Quote #10

WTF!? When i compile plugin are error
Quote:
warning 209 : function "give_stuff" should return a value
With bold is marked place where is error

Quote:
public give_stuff(id)
{
if(!
is_user_alive(id)) return PLUGIN_HANDLED;

else if(
get_user_flags(id) & ADMIN_LEVEL_H)
{

fm_give_item(id, "item_assaultsuit");
fm_give_item(id, "weapon_flashbang");
fm_give_item(id, "weapon_flashbang");
fm_give_item(id, "weapon_hegrenade");
fm_give_item(id, "weapon_smokegrenade");
set_user_gravity (id, 0.75);
cs_set_weapon_ammo(fm_give_item( id, "weapon_scout" ), 0);
cs_set_user_bpammo(id, CSW_SCOUT, 0);

return
PLUGIN_CONTINUE
}

}
LightScribe16 is offline
Send a message via Skype™ to LightScribe16
Reply


Thread Tools
Display Modes

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 06:33.


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