Raised This Month: $ Target: $400
 0% 

Announce


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 01-18-2013 , 21:02   Announce
Reply With Quote #1

hello.

type console in "anno abc123" to print chat "[] 123"
i want type console in "anno abc123" to print chat "[] abc123"
where is the problem?
help me.

thanks.

source code here:
PHP Code:
#include <amxmodx>
#include <fun>

public plugin_init()
{
    
register_clcmd("/anno""cmdAnno")
    
register_clcmd(".anno""cmdAnno")
}

public 
cmdAnno(id)
{
    new 
MessageText[4], PrintText
    read_argv
(1MessageTextcharsmax(MessageText))
    
PrintText str_to_num(MessageText)
    
client_print(idprint_chat"[prifix] %s"PrintText)

    return 
PLUGIN_HANDLED

RuRuRu612754 is offline
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 01-18-2013 , 21:15   Re: Announce
Reply With Quote #2

str_to_num is for converting string with number to integer.
Code:
#include <amxmodx> 

public plugin_init() 
{ 
	register_clcmd("/anno", "cmdAnno") 
	register_clcmd(".anno", "cmdAnno") 
} 

public cmdAnno(id) 
{ 
	new MessageText[100], Left[1], Right[50] 
	read_argv(1, MessageText, charsmax(MessageText)) 
	strtok(MessageText, Left, charsmax(Left), Right, charsmax(Right), ' ') 
	client_print(id, print_chat, "[prifix] %s", Right) 

	return PLUGIN_HANDLED 
}
__________________
My plugins:
[ZP] ZM_VIP (v2.0.0 is comming. v1.9.1 BETA is out!)

aaarnas is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-19-2013 , 00:22   Re: Announce
Reply With Quote #3

Quote:
Originally Posted by aaarnas View Post
str_to_num is for converting string with number to integer.
Code:
#include <amxmodx> 

public plugin_init() 
{ 
	register_clcmd("/anno", "cmdAnno") 
	register_clcmd(".anno", "cmdAnno") 
} 

public cmdAnno(id) 
{ 
	new MessageText[100], Left[1], Right[50] 
	read_argv(1, MessageText, charsmax(MessageText)) 
	strtok(MessageText, Left, charsmax(Left), Right, charsmax(Right), ' ') 
	client_print(id, print_chat, "[prifix] %s", Right) 

	return PLUGIN_HANDLED 
}
This code is not correct either. There are no spaces in "abc123" and if there were, your code would give undesirable results. You simply need to print the variable MessageText, that's it.
__________________
fysiks is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 01-25-2013 , 07:07   Re: Announce
Reply With Quote #4

Quote:
Originally Posted by aaarnas View Post
str_to_num is for converting string with number to integer.
Code:
#include <amxmodx> 

public plugin_init() 
{ 
	register_clcmd("/anno", "cmdAnno") 
	register_clcmd(".anno", "cmdAnno") 
} 

public cmdAnno(id) 
{ 
	new MessageText[100], Left[1], Right[50] 
	read_argv(1, MessageText, charsmax(MessageText)) 
	strtok(MessageText, Left, charsmax(Left), Right, charsmax(Right), ' ') 
	client_print(id, print_chat, "[prifix] %s", Right) 

	return PLUGIN_HANDLED 
}
thanks you.
i will try it.
RuRuRu612754 is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 01-25-2013 , 07:36   Re: Announce
Reply With Quote #5

Quote:
Originally Posted by RuRuRu612754 View Post
thanks you.
i will try it.
Quote:
Originally Posted by fysiks View Post
This code is not correct either. There are no spaces in "abc123" and if there were, your code would give undesirable results. You simply need to print the variable MessageText, that's it.
EpicMonkey 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 13:39.


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