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

I cant quite seem to figure it out


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-17-2004 , 04:33   I cant quite seem to figure it out
Reply With Quote #1

I am trying to make a private message plugin for all users, something kinda neat you know, its based off the amx_psay code for 2 reasons, I am learning and because it is already setup to log chat actions within the standard amx log files, I want to keep a eye on people if they are saying things privately just incase of disputs and other lil things.

but I cant seem to get the /msg username message to work

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,level,cid){   if (!cmd_access(id,level,cid,1))     return PLUGIN_HANDLED   new name[32]   read_argv(1,name,31)   new priv = cmd_target(id,name,0)   if (!priv) return PLUGIN_HANDLED   new length = strlen(name)+1   new message[192], name2[32],authid[32],authid2[32], userid, userid2   get_user_authid(id,authid,31)   get_user_name(id,name2,31)   userid = get_user_userid(id)    read_args(message,191)   if (message[0]=='"' && message[length]=='"'){     message[0]=' '     message[length]=' '     length+=2   }   remove_quotes(message[length])   get_user_name(priv,name,31)   if (id&&id!=priv) client_print(id,print_chat,"(PM To - %s) %s Says :   %s",name,name2,message[length])   client_print(priv,print_chat,"(PM From - %s) %s Says :   %s",name,name2,message[length])   console_print(id,"(PM To - %s) %s Says :   %s",name,name2,message[length])   get_user_authid(priv,authid2,31)   userid2 = get_user_userid(priv)   log_amx("Private Message: ^"%s<%d><%s><>^" pmsg ^"%s<%d><%s><>^" ^"%s^"",       name2,userid,authid,name,userid2,authid2,message[length])   log_message("^"%s<%d><%s><>^" triggered ^"amx_msg^" against ^"%s<%d><%s><>^" (text ^"%s^")",     name2,userid,authid,name,userid2,authid2,message[length])   return PLUGIN_HANDLED }

I know I am missing something, anyone got some ideas on how to get the /msg command to work?
__________________

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

as far as i remeber on old forum is a such plugin that manages private messages...

say command has 2 arguments
say and "chat",
and say works different than console commands

i had that problem on playtime addon
it detect say /playtime part_of_nick
the prblem was that i thought part_of_nick will be a next argument, say nr 3, but it was not
the whole command was

say "/playtime part_of_nick"

so i had to detect the /playtime

you may use the string exploding by space detection (problem can be if player has a space in his name)
__________________
= 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-17-2004 , 04:41  
Reply With Quote #3

Mmm I didnt know there was a plugin on the other forum related to this, maybe ill go find it and learn how to do it.
__________________

BigBaller is offline
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-17-2004 , 14:57  
Reply With Quote #4

still i have no clue >_<
__________________

BigBaller is offline
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-17-2004 , 16:56  
Reply With Quote #5

ANYONE!@#!@#!@ PLEASE hehe help?
__________________

BigBaller is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 03-17-2004 , 17:14  
Reply With Quote #6

I might have an answer...
Use read_argv(2,...);
If not then make a different function for only say and then check argv 1 to see if its msg, then argv 2 for the name
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 , 18:23  
Reply With Quote #7

Nope your first suggestion didnt work IceMouse.

Ill try the other one when I got some time.
__________________

BigBaller is offline
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 03-17-2004 , 19:06  
Reply With Quote #8

Try this simple fix:
Change the 0 in the cmd_target to a 1
That will probably fix it
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
tnsk8er27
Senior Member
Join Date: Mar 2004
Location: richfield MN
Old 03-17-2004 , 19:13  
Reply With Quote #9

dangit baller your gettin ahead of me AHH i gotta work faster!!


haha gj Baller
__________________
Toxic
tnsk8er27 is offline
Send a message via AIM to tnsk8er27
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-17-2004 , 19:35  
Reply With Quote #10

AHH

I see, I tried to do the say command in console and it returned as followed

Quote:
] say /msg BigBaller testing
Client with that name or userid not found
So basically it is not finding the clients name and sending them the message.

This is with devicenull suggestion compiled. I assume the same thing if cmd_target 0 becuase it didnt send the message either way.

Any clue on that, I beleive the only way I would be able to do this now is making a new function, am I correct?
__________________

BigBaller 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 03:35.


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