Raised This Month: $ Target: $400
 0% 

[Solved]Simple code to detect country


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eXist
Member
Join Date: Apr 2005
Old 09-06-2007 , 22:15   [Solved]Simple code to detect country
Reply With Quote #1

*EDIT* I know there are a lot of plugins that do similar things, but I decided to write my own because I disliked many of the current ones. Also, it helps me learn small .

Still learning, but I'm working on code to detect, then display a users country based on say input from a user. It is just for fun, but I would like to get it functioning.

For example: A user types '/country playername' in all chat, then I want it to display the user country to everyone. I guess I'm still retarded cause I can't get it to work .

Code:
#include <amxmodx> #include <amxmisc> #include <geoip> public plugin_init() {     register_plugin("Show Country","1.0","eXist`")     register_clcmd("say /country","showCountry",0,"Shows a users Country") } public showCountry(id) {     //Checks for flags m or s :: I know its weird, don't ask :D.     if((get_user_flags(id) & ADMIN_LEVEL_A) || (get_user_flags(id) & ADMIN_LEVEL_G)){         new args[128], name[33], target, userip[17], usercountry[46], msg[128]         read_argv(2,args,127)                 target = cmd_target(id,args,2)                 get_user_name(target,name,32)         get_user_ip(target,userip,16,1)         geoip_country(userip,usercountry,45)                 set_hudmessage(255,255,255,-1.0,0.35,0,6.0,12.0,0.1,0.2,4)         format(msg,127,"%s is from %s",name,usercountry)         show_hudmessage(0,msg)          } }

Last edited by eXist; 09-07-2007 at 23:30. Reason: Solved
eXist is offline
Old 09-07-2007, 10:44
Arkshine
This message has been deleted by Arkshine. Reason: nvm
eXist
Member
Join Date: Apr 2005
Old 09-07-2007 , 20:54   Re: Simple code to detect country
Reply With Quote #2

I think I found my problem. It is the read_argv command, it doesn't seem to be reading anything it all.

Is there a different command I should use to read chat, or something will read all the chat, and I can get the part I want?
eXist is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2007 , 20:59   Re: Simple code to detect country
Reply With Quote #3

You have to add after the reading : remove_quotes( args )

You should debug by yourself. Put a client_print() or whatever and see !
__________________
Arkshine is offline
Old 09-07-2007, 21:00
Lee
This message has been deleted by Lee.
eXist
Member
Join Date: Apr 2005
Old 09-07-2007 , 23:30   Re: Simple code to detect country
Reply With Quote #4

Quote:
Originally Posted by arkshine View Post
You have to add after the reading : remove_quotes( args )

You should debug by yourself. Put a client_print() or whatever and see !
I went through and debugged it all with client_print() before you posted this . Well yeah, I have it working at 100 %, but thanks for replying.

Everything has been fixed.
eXist is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 09-07-2007 , 23:34   Re: [Solved]Simple code to detect country
Reply With Quote #5

Since when could you read a print_chat?
X-Script 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 16:13.


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