Raised This Month: $ Target: $400
 0% 

Announce + Client Information


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
broertje
Senior Member
Join Date: Mar 2005
Old 03-01-2006 , 16:38   Announce + Client Information
Reply With Quote #1

My first plugin,i didn't tested it out,but i wan't some comments ...
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Announce + Client info" #define VERSION "1.0" #define AUTHOR "Broertje" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /myinfo","mi",ADMIN_ALL,"Shows Clients Information") } public client_putinserver(id)     {     new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))         {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)         show_hudmessage(0, "%s has joined the n00bs",name)                   return PLUGIN_HANDLED     }           set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"Welcome %s. Have fun here!",name)           return PLUGIN_HANDLED } public client_disconnect(id)     {     new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))         {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)         show_hudmessage(0, "%s has left the house",name)                   return PLUGIN_HANDLED     }           set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"%s has left. Goodbye!",name)           return PLUGIN_HANDLED } public mi(id)     {       new ping, loss, curtime     get_user_ping(id,ping, loss)       get_user_time(id,curtime)       if(is_user_alive(id))           if(is_user_connected(id))           {           client_print(id, print_chat, "Your ping is: %s , You've been playing: %s on server.",ping,curtime)       }    }
broertje is offline
Des12
Senior Member
Join Date: Jan 2005
Old 03-01-2006 , 17:42   Re: Announce + Client Information
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Announce + Client info" #define VERSION "1.0" #define AUTHOR "Broertje" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /myinfo","mi",ADMIN_ALL,"Shows Clients Information") } public client_putinserver(id)     {     new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))         {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)         show_hudmessage(0, "%s has joined the n00bs",name)                   return PLUGIN_HANDLED     }           set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"Welcome %s. Have fun here!",name)           return PLUGIN_HANDLED } public client_disconnect(id)     {     new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))         {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)         show_hudmessage(0, "%s has left the house",name)                   return PLUGIN_HANDLED     }           set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"%s has left. Goodbye!",name)           return PLUGIN_HANDLED } public mi(id)     {       new ping, loss, curtime     get_user_ping(id,ping, loss)       get_user_time(id,curtime)       if(is_user_alive(id))           if(is_user_connected(id))           {           client_print(id, print_chat, "Your ping is: %i , You've been playing: %i on server.",ping,curtime)       }    }
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
broertje
Senior Member
Join Date: Mar 2005
Old 03-02-2006 , 06:27  
Reply With Quote #3

errr...
Yes?
broertje is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 03-02-2006 , 20:18  
Reply With Quote #4

Quote:
Originally Posted by broertje
errr...
Yes?
He fixed your variables in the strings at the end from %s to %i.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
broertje
Senior Member
Join Date: Mar 2005
Old 03-03-2006 , 09:56  
Reply With Quote #5

Oh thx,can u explain why it need to be %i and not %s
broertje is offline
DataMatrix
Senior Member
Join Date: Aug 2005
Location: UK, Liverpool
Old 03-03-2006 , 09:59  
Reply With Quote #6

%i = Integer (Number)
%s = String (Word)
%d = Delimiter (minus, plus, etc. I think)

I think that's what they are.
DataMatrix is offline
Send a message via MSN to DataMatrix
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-03-2006 , 10:44  
Reply With Quote #7

Those are printf-like format specifiers; google for printf to know more (although I think the new optimized format in the upcoming AMXx release doesn't support all of the format type characters)

Anyway:

%d or %i -> Prints a signed number in base 10 (decimal)
%u -> Prints an unsigned (=always positive) number in base 10
%x -> Prints an unsigned number in base 16 (hexadecimal)
%c -> Prints a character (say you'd pass 'a' as parameter, then it would print an a)
%f -> Prints a decimal floating point number (something like 3.14)
%g is used as %f; I always use %f because I don't know the difference.
%s -> Prints a string (like "hello pm" )

There's also flags, width and precision; like %02d will alway output 2 digits at least; if it would print only one digit a 0 will be appended on the left side.
__________________
hello, i am pm
PM 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 20:20.


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