AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Client Command Help (https://forums.alliedmods.net/showthread.php?t=187646)

Waleed 06-16-2012 03:51

Client Command Help
 
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")
                       
        }


Backstabnoob 06-16-2012 05:23

Re: Client Command Help
 
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.

ConnorMcLeod 06-16-2012 05:27

Re: Client Command Help
 
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

Waleed 06-16-2012 05:43

Re: Client Command Help
 
I am using Ham_Spawn native before those,Is that the problem???????

Backstabnoob 06-16-2012 05:50

Re: Client Command Help
 
Show the full code or don't expect help here.

Aooka 06-16-2012 05:52

Re: Client Command Help
 
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

hornet 06-16-2012 06:27

Re: Client Command Help
 
Quote:

Originally Posted by Aooka (Post 1729680)
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.

ConnorMcLeod 06-16-2012 06:41

Re: Client Command Help
 
Quote:

Originally Posted by Waleed (Post 1729677)
I am using Ham_Spawn native before those,Is that the problem???????

Ham_Spawn is not a native.

SHOW YOUR F$*#ING CODE :mrgreen::mrgreen:

Waleed 06-16-2012 07:37

Re: Client Command Help
 
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.

Backstabnoob 06-16-2012 07:38

Re: Client Command Help
 
Quote:

Originally Posted by Backstabnoob (Post 1729679)
Show the full code or don't expect help here.



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

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