Raised This Month: $ Target: $400
 0% 

Problem with adding value to other value using concmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 01-06-2013 , 08:50   Problem with adding value to other value using concmd
Reply With Quote #1

Hello everybody,

I've got a little problem here, I want to give the player with userid X 20 Points using the command :
Quote:
PHP Code:
"kbm_give_points_easy %i"usrid[id
.
The HUD Message is displaying, but the player doesn't get any Points.

Code of kbm_give_points_easy :

Quote:
PHP Code:
new Arg1[24]
read_argv(1Arg123)
    
new 
player cmd_target(idArg16)
iCoins[player] += 20
    
set_dhudmessage
(02550, -1.00.6906.06.0)
show_dhudmessage(player"You got 20 Points."
Anyone knows what I'm doing wrong?
__________________
Kia is offline
xDrugz
Senior Member
Join Date: Jul 2011
Location: return 4;
Old 01-06-2013 , 09:19   Re: Problem with adding value to other value using concmd
Reply With Quote #2

Try this code

Code:
#include < amxmodx >
#include < amxmisc >
#include < dhudmessage >

new iCoins[ 33 ];

public plugin_init() 
{
	register_concmd( "kbm_give_points_easy", "CmdGivePoints" );
}

public CmdGivePoints( client )
{
	new szArgs[ 35 ];
	
	read_argv( 1, szArgs, charsmax( szArgs ) );
	
	new iPlayer = cmd_target( client, szArgs, CMDTARGET_NO_BOTS );
	
	if( iPlayer )
	{
		iCoins[ iPlayer ] += 20;
		
		set_dhudmessage( 0, 255, 0, -1.0, 0.69, 0, 6.0, 6.0 );
		
		show_dhudmessage( iPlayer, "You got 20 Points. (Total: %i)", iCoins[ iPlayer ] );
	}

	return 1;
}
__________________

Last edited by xDrugz; 01-06-2013 at 09:31.
xDrugz is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 01-06-2013 , 09:48   Re: Problem with adding value to other value using concmd
Reply With Quote #3

Thanks, is working. Had to change "%i " ( using UserID) to "%s" (using Username).
__________________
Kia is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-06-2013 , 11:16   Re: Problem with adding value to other value using concmd
Reply With Quote #4

"kbm_give_points_easy #%i", usrid[id]
should work
jimaway is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-06-2013 , 16:25   Re: Problem with adding value to other value using concmd
Reply With Quote #5

Quote:
Originally Posted by Kia View Post
Thanks, is working. Had to change "%i " ( using UserID) to "%s" (using Username).
When using user ids with commands you have to use "#%i"
__________________
fysiks is offline
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 13:40.


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