Raised This Month: $ Target: $400
 0% 

Client Command Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-16-2012 , 03:51   Client Command Help
Reply With Quote #1

I want to give weapon to a client(not admin) or admin after he types in chat "/give" but,Its not working.


Code:
register_clcmd("say /give", "giveweapons")
}
public giveweapons(id)
{
	if(is_user_alive(id))
	{
		give_item(id, "weapon_mp5navy")
		give_item(id, "weapon_aug")
			
	}
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-16-2012 , 05:23   Re: Client Command Help
Reply With Quote #2

Show full code, problem is somewhere else. Also check your logs as there's probably an error somewhere that prevents the execution of the code you posted.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-16-2012 , 05:27   Re: Client Command Help
Reply With Quote #3

There could be a line in plugin_init, before :

register_clcmd("say /give", "giveweapons")

that prevent this one from being registered, like a missing callback.


Like if you do :

register_clcmd("say /take", "takeweapons")
register_clcmd("say /give", "giveweapons")

And if your plugin doesn't contain somewhere :

public takeweapons

Lines after register_clcmd("say /take", "takeweapons") are not considerated
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-16-2012 at 05:29.
ConnorMcLeod is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-16-2012 , 05:43   Re: Client Command Help
Reply With Quote #4

I am using Ham_Spawn native before those,Is that the problem???????
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-16-2012 , 05:50   Re: Client Command Help
Reply With Quote #5

Show the full code or don't expect help here.
Backstabnoob is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-16-2012 , 05:52   Re: Client Command Help
Reply With Quote #6

You forget (i think) to include fun. ( http://www.amxmodx.org/funcwiki.php?go=func&id=120 )

Quote:
give_item

[ Main ] [ Fun ] [ fun.inc ]
[ comments ]
Try this :
Code:
#include < amxmodx > #include < fun > public plugin_init( ) {     register_plugin( "Test" , "1.0" , "Aooka" );     register_clcmd( "say /give" , "CmdGive" ); } public CmdGive( id ) {     if( is_user_alive( id ) ) {         give_item( id , "weapon_mp5navy" );         give_item( id , "weapon_aug" );     }     else {         client_print( id , print_center , "You must be alive !" );     } }

Why do you use Ham_Spawn ? It's not when a player spawn but when the player type a cmd.

If you whant to set bullet in yours weapons take a look here :
http://www.amxmodx.org/funcwiki.php?go=func&id=186
__________________
Pawn ? Useless
Aooka is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-16-2012 , 06:27   Re: Client Command Help
Reply With Quote #7

Quote:
Originally Posted by Aooka View Post
You forget (i think) to include fun. ( http://www.amxmodx.org/funcwiki.php?go=func&id=120 )



Try this :
Code:
#include < amxmodx > #include < fun > public plugin_init( ) {     register_plugin( "Test" , "1.0" , "Aooka" );     register_clcmd( "say /give" , "CmdGive" ); } public CmdGive( id ) {     if( is_user_alive( id ) ) {         give_item( id , "weapon_mp5navy" );         give_item( id , "weapon_aug" );     }     else {         client_print( id , print_center , "You must be alive !" );     } }

Why do you use Ham_Spawn ? It's not when a player spawn but when the player type a cmd.

If you whant to set bullet in yours weapons take a look here :
http://www.amxmodx.org/funcwiki.php?go=func&id=186
Rewriting this isn't going to help. Also if he had forgotten to include the fun module the plugin would not have compiled. Its also quite obvious that Ham_Spawn itself has no relation to how he has written the function - it sinply may be preventing his function like Connor said, or it is not the full / correct code.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 06-16-2012 at 06:43.
hornet is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-16-2012 , 06:41   Re: Client Command Help
Reply With Quote #8

Quote:
Originally Posted by Waleed View Post
I am using Ham_Spawn native before those,Is that the problem???????
Ham_Spawn is not a native.

SHOW YOUR F$*#ING CODE
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-16-2012 , 07:37   Re: Client Command Help
Reply With Quote #9

OK,If its not a native the what ever it is? I am using
Code:
RegisterHam(Ham_Spawn, "player", "playerspawn", 1)
By the way I know that give_item is a fun module function,I have already included that.
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-16-2012 , 07:38   Re: Client Command Help
Reply With Quote #10

Quote:
Originally Posted by Backstabnoob View Post
Show the full code or don't expect help here.
Backstabnoob 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 06:16.


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