Raised This Month: $51 Target: $400
 12% 

I cant quite seem to figure it out


Post New Thread Reply   
 
Thread Tools Display Modes
tnsk8er27
Senior Member
Join Date: Mar 2004
Location: richfield MN
Old 03-17-2004 , 19:39  
Reply With Quote #11

no baller i think its reading testing as the username too.....i dono tho just a guess
__________________
Toxic
tnsk8er27 is offline
Send a message via AIM to tnsk8er27
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 03-17-2004 , 19:47  
Reply With Quote #12

Ok.. this is the code im using:
Code:
register_clcmd("say /noclip","toggle_noclip",ACCESS_NOCLIP,"Toggle noclip") // This gets called with say /noclip USERNAME       read_argv(1,arg,31)         new pid = cmd_target(id,arg,1)       if (!pid) {             console_print(id,"[NSX] No such user")             return PLUGIN_HANDLED         }

Which mod are you running this on? Maybe its something that sends messages in a weird way?

You need to do some debugging stuff
After "read_argv(1,name,31) " put console_print(id,"%s",name)
Then make sure the name it says is the one you typed
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 03-17-2004 , 20:13  
Reply With Quote #13

Debugging is your friend
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-17-2004 , 21:34  
Reply With Quote #14

devicenull

Thanks the debug thing worked out, it is thinking that /msg is the client you are sending a message you.

BTW i re wrote the code also, right now imunity is a problem but that can be fixed with ease.

Code:
/* Private Messaging 0.1 by BigBaller Based from AMXX Team amx_psay command */ #include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Private Messaging","0.1","BigBaller")     register_clcmd("say /msg","pmsg",0," - Sends a private message to another user")     register_concmd("amx_msg","pmsg",0," - Sends a private message to another user") } public pmsg(id){     new user[32]     read_argv(1,user,31)         console_print(id,"%s",user)     new msg = cmd_target(id,user,1)     if (!msg) return PLUGIN_HANDLED         new length = strlen(user)+1     new message[192],user2[32]     get_user_name(id,user2,31)     read_args(message,191)     if (message[0]=='"' && message[length]=='"'){       message[0]=' '       message[length]=' '       length+=2         }     remove_quotes(message[length])     get_user_name(msg,user,31)     if (id&&id!=msg) client_print(id,print_chat,"(PM To - %s) You said : %s", user,message[length])     client_print(msg,print_chat,"(PM From - %s) %s says : %s",user2,user2,message[length])         return PLUGIN_HANDLED }

soo basically when your in console it goes

]say /msg BigBaller Testing
/msg
Client or UserID not found

now, how do get around that problem? BTW this is Counter-Strike that I am testing this on.

EDIT

right now im not worried about immunity and all that stuff, i just want the damn /msg command to work haha.
__________________

BigBaller is offline
_KaszpiR_
AMX Mod X Beta Tester
Join Date: Feb 2004
Location: Warsaw, Poland
Old 03-18-2004 , 03:05  
Reply With Quote #15

08:44:50 (_KaszpiR_) bigballer, still having problem with getting the player target from say command?
08:45:11 (SniperBot) ([OD]-BigBaller) yea
08:45:13 (SniperBot) ([OD]-BigBaller) i posted on forums
08:45:16 (SniperBot) ([OD]-BigBaller) scripting forum
08:45:20 (SniperBot) ([OD]-BigBaller) take a look at the code if you want
08:45:22 (SniperBot) ([OD]-BigBaller) ill brb
08:46:02 (_KaszpiR_) i got no idea about cmd_target()
08:46:04 (_KaszpiR_)
08:47:26 (_KaszpiR_) as i said try registering "say" and not "say /msg"
08:47:40 (_KaszpiR_) cause probably it will return all the time the /msg as an argument
08:47:46 (_KaszpiR_) withut anything later
08:47:52 (SniperBot) ([OD]-BigBaller) mm
08:48:04 (SniperBot) ([OD]-BigBaller) well if I registered say
08:48:08 (SniperBot) ([OD]-BigBaller) in game chat
08:48:15 (_KaszpiR_) it parsed any line
08:48:16 (SniperBot) ([OD]-BigBaller) how would they wispher?
08:480 (SniperBot) ([OD]-BigBaller) i would have ot make a new function then right?
08:487 (_KaszpiR_) you gotta detect the lines taht starts with /msg statement and then parse them, otherwise
plugin-continue
08:48:44 (SniperBot) ([OD]-BigBaller) ahh
08:49:00 (SniperBot) ([OD]-BigBaller) soo yea i would have to make a new function for /msg
08:49:02 (SniperBot) ([OD]-BigBaller) as I thought
08:49:03 (SniperBot) ([OD]-BigBaller) haha
08:50:09 (_KaszpiR_) see this http://info.wsisiz.edu.pl/~sochon/do...mysql_playtime
.sma
08:50:27 (_KaszpiR_) there is a function called public playtime_say(id){
08:506 (SniperBot) ([OD]-BigBaller) yea devicenull said something about playtim
08:508 (SniperBot) ([OD]-BigBaller) haha
08:51:43 (_KaszpiR_) the plugin checks any say or say_team for following begins
08:51:45 # Unknown command: PLAYTIME
08:51:51 (_KaszpiR_) /playtimetop
08:51:53 (_KaszpiR_) /playtime
08:52:11 (_KaszpiR_) and that function just detects the say commands
08:52:29 (_KaszpiR_) other command is parsing the console command
08:52:42 (_KaszpiR_) but both of them are finally exporting cvars to another function
08:52:55 (SniperBot) ([OD]-BigBaller) if(equal(speech,"/playtimetop", 12))
08:52:56 (SniperBot) ([OD]-BigBaller) playtime_report(id,"",1)
08:52:56 (SniperBot) ([OD]-BigBaller) else if(equal(speech,"/playtime", 9))
08:52:56 (SniperBot) ([OD]-BigBaller) {
08:52:59 (SniperBot) ([OD]-BigBaller) right there heh?
08:53:03 (_KaszpiR_) in your case the query will contain "name message"
08:53:04 (_KaszpiR_) yea
08:530 (_KaszpiR_) and you gotta use equal(speech,"/msg", 4)
08:53:40 (SniperBot) ([OD]-BigBaller) why 4 ?
08:53:45 (SniperBot) ([OD]-BigBaller) j/w
08:53:52 (_KaszpiR_) cause "/msg" is 4 chars
08:53:53 (_KaszpiR_)
08:54:19 (_KaszpiR_) the equal function works in a way how many chars to complare
08:54:27 (_KaszpiR_) actually "/msg" contains 5 chars
08:547 (SniperBot) ([OD]-BigBaller) ahh
08:54:45 (_KaszpiR_) bbut last one is a string ending that can be omitted
08:54:59 (SniperBot) ([OD]-BigBaller) soo it would be equal(speech,"/msg",5)
08:55:03 (SniperBot) ([OD]-BigBaller) or 4
08:55:05 (SniperBot) ([OD]-BigBaller) like you said?
08:55:08 (_KaszpiR_) use 4
08:55:10 (SniperBot) ([OD]-BigBaller) ok
08:55:28 (_KaszpiR_) then you gonna detect all lines containing /msg on the beginning
08:55:40 (_KaszpiR_) but if the someone will use say /msg john hello
08:55:42 (_KaszpiR_) it will work
08:55:43 (_KaszpiR_) but
08:55:54 (_KaszpiR_) say /msg johny hello
08:56:01 (_KaszpiR_) probably not (i gotta test it)
08:56:10 (_KaszpiR_) thats because of the aditional space
08:564 (_KaszpiR_) actually the query later should be splitted on parts with detection of the space
08:56:45 (_KaszpiR_) there is a string function that can hep in achieveing that
08:57:18 (_KaszpiR_) you gotta split query into 2 parts
08:572 (_KaszpiR_) to split the target name form rest of the message
08:57:46 (_KaszpiR_) i have not seen any other privmsg addon, maybe someone allready did that
08:58:18 (SniperBot) ([OD]-BigBaller) ok
08:58:21 (SniperBot) ([OD]-BigBaller) soo basically
08:58:28 (SniperBot) ([OD]-BigBaller) i take the pmsg code
08:580 (SniperBot) ([OD]-BigBaller) i already have
08:583 (SniperBot) ([OD]-BigBaller) copy it
08:588 (SniperBot) ([OD]-BigBaller) to use it for the say commands
08:58:45 (SniperBot) ([OD]-BigBaller) and use plugin_continue
08:58:50 (SniperBot) ([OD]-BigBaller) soo I can also use console?
08:58:53 (SniperBot) ([OD]-BigBaller) something like that?
08:58:55 (_KaszpiR_) then you would search for player id between players dependin gon the nick check (there is allready
implemented func for that)
08:59:03 (_KaszpiR_) yea
08:59:10 (_KaszpiR_) well
08:599 (_KaszpiR_) when you press a "say" bind key it will in fact act as if you would print in the console "say
message_here"
09:00:48 (SniperBot) ([OD]-BigBaller) yea
09:01:29 (SniperBot) ([OD]-BigBaller) ok
09:013 (SniperBot) ([OD]-BigBaller) im going to do a rough test
__________________
= Ave Cesar, morituri Te salutant. = http://nvt.prv.pl = http://hlds.pl/
_KaszpiR_ is offline
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-18-2004 , 15:58  
Reply With Quote #16

UGGG

I must be doing something wrong here man, I try doing what KaszpiR said, UGG UGG UGG

Code:
/* Private Messaging 0.1 by BigBaller Based from AMXX Team amx_psay command */ #include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Private Messaging","0.1","BigBaller")     register_clcmd("say","pmsg_say")     register_clcmd("say_team","pmsg_say")     register_concmd("amx_msg","pmsg",0," - Sends a private message to another user") } public pmsg_say(id){     new user[32]         read_argv(1,user,31)         console_print(id,"%s",user)         new msg = cmd_target(id,user,1)         if (!msg) return PLUGIN_HANDLED         new length = strlen(user)+1         new message[192],user2[32]         get_user_name(id,user2,31)         read_args(message,191)         if (message[0]=='"' && message[length]=='"'){         message[0]=' '         message[length]=' '         length+=2         }         remove_quotes(message[length])     new query;(msg,user)         new speech[192]     remove_quotes(speech)         if(equal(speech,"/msg", 4))         get_user_name(msg,user,31)         if (id&&id!=msg) client_print(id,print_chat,"(PM To - %s) You said : %s", user,message[length])         client_print(msg,print_chat,"(PM From - %s) %s says : %s",user2,user2,message[length])         return PLUGIN_CONTINUE } public pmsg(id){     new user[32]         read_argv(1,user,31)         console_print(id,"%s",user)         new msg = cmd_target(id,user,1)         if (!msg) return PLUGIN_HANDLED         new length = strlen(user)+1         new message[192],user2[32]         get_user_name(id,user2,31)         read_args(message,191)         if (message[0]=='"' && message[length]=='"'){         message[0]=' '         message[length]=' '         length+=2         }         remove_quotes(message[length])         get_user_name(msg,user,31)         if (id&&id!=msg) client_print(id,print_chat,"(PM To - %s) You said : %s", user,message[length])         client_print(msg,print_chat,"(PM From - %s) %s says : %s",user2,user2,message[length])         return PLUGIN_HANDLED }

That would not allow anyone to chat, you would type in game, and it would show up in console "cilent with that name or userid not found"

>_<
__________________

BigBaller is offline
_KaszpiR_
AMX Mod X Beta Tester
Join Date: Feb 2004
Location: Warsaw, Poland
Old 03-19-2004 , 04:31  
Reply With Quote #17

in say parsingfunction return PLUGIN_CONTINUE
__________________
= Ave Cesar, morituri Te salutant. = http://nvt.prv.pl = http://hlds.pl/
_KaszpiR_ is offline
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-21-2004 , 00:36  
Reply With Quote #18

UGG I GIVE UP FOR NOW

TO ADVANCED FOR ME!
__________________

BigBaller is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-21-2004 , 00:37  
Reply With Quote #19

you should have started with "How To Properly Indednt my code"
Freecode is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-21-2004 , 01:30   yeah
Reply With Quote #20

Quote:
Originally Posted by Freecode
you should have started with "How To Properly Indednt my code"
Indent's are importand and makes it easier to read.. i will take a farther look tommorrow maybe I can think of something.. hehe
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
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 15:39.


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