AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with RATE checker (https://forums.alliedmods.net/showthread.php?t=13225)

fannymagnet 05-08-2005 16:30

Help with RATE checker
 
OK, I'm writing my first script but having problems. Here's the code >

Code:
#include <amxmodx> new PLUGIN[]="Rate_Checker" new AUTHOR[]="FannyMagnet" new VERSION[]="1.00" public plugin_init() {      register_plugin(PLUGIN, VERSION, AUTHOR)      register_concmd("amx_rc", "cmd_rc", ADMIN_SLAY, "<target> ") } public cmd_rc(id)   {     new user[32], rate[32], uid           read_argv(1,user,32) // Read first part after command     uid = find_player("bh",user) // Find user     get_user_info(uid, "rate", rate, 31) // Get the rate of the user from UID         client_print (id, print_chat, "Thier rate is %s",rate) // Print the result to the admin         return PLUGIN_HANDLED     }

However, when I run the command it just displays the name of the user. Or sometimes doesn't work at all. Can anyone point me in the right direction. I don't want you to finish it, just tell me where I'm going wrong so I can learn.

Is it something to do with strings and integers? Is the GET_USER_INFO returning an integer or string.

Also, can anyone explain the %s and %d in text outputs? I can't find anything on these but have seen them used, hense me using then in my script.

Thanks in advance.

v3x 05-08-2005 16:43

Hmm..
Code:
#include <amxmodx> #include <amxmisc> //This contains some useful functions #include <fun>     //This contains the function to change health new PLUGIN[]="Rate_Checker" new AUTHOR[]="FannyMagnet" new VERSION[]="1.00" public plugin_init() {      register_plugin(PLUGIN, VERSION, AUTHOR)      register_concmd("amx_rc", "cmd_rc", ADMIN_SLAY, "<target> ") } public cmd_rc(id,level,cid)    {     if(!cmd_access(id,level,cid,2)) { // If they don't have access         return PLUGIN_HANDLED     }     // command itself + the arg = 2     new user[32], rate[32]     // If the index for user is 32, then you want to     // put 32-1 (31) down here:         read_argv(1,user,31)     new uid = find_player("bh",user)     get_user_info(uid, "rate", rate, 31)         client_print (id, print_chat, "Their rate is %i",rate)     // %s - string     // %i - integer     // %d - decimal     // %f - float         return PLUGIN_HANDLED }

fannymagnet 05-08-2005 16:53

Cheers for that but I'm getting an error.

Now, when I enter amx_rc (the command) into the console it says Usage amx_rc <target> which is should. If I enter a username to execute the command on amx_rc username then nothing happens. When I check the logs it says

L 05/08/2005 - 21:49:05: [AMXX] Run time error 10 (native) (plugin "rates.amxx") - debug not enabled.

:?

When I declare the variable RATE (rate[32]) is this declared as a string? If so then it can't be printed as an interger can it until it's converted?

v3x 05-08-2005 17:32

Try
Code:
new uid = cmd_target(id,user,0) if(!uid) {     return PLUGIN_HANDLED }
Instead of the other one.

Yuri 05-08-2005 17:43

Why not

Code:
#include <amxmodx> #include <amxmisc> new PLUGIN[]="Rate_Checker" new AUTHOR[]="FannyMagnet" new VERSION[]="1.00" public plugin_init() {      register_plugin("PLUGIN,"VERSION,"AUTHOR")      register_concmd("amx_rc", "cmd_rc", ADMIN_SLAY, "<target> ") } public cmd_rc(id)    {     new user[32], rate[32], uid         read_argv(1,user,32) // Read first part after command     uid = find_player("bh",user) // Find user     get_user_info(uid, "rate", rate, 31) // Get the rate of the user from UID         client_print (id, print_chat, "Thier rate is %s",rate) // Print the result to the admin         return PLUGIN_HANDLED     } new uid = cmd_target(id,user,0) if(!uid) {     return PLUGIN_HANDLED }

v3x 05-08-2005 17:52

Just.. Shh.. :up:

Yuri 05-08-2005 17:54

Oh because you know mine's better?
wooo

v3x 05-08-2005 17:57

No, it isn't. Quit trying to get your post count up by posting useless crap. kthnx

Yuri 05-08-2005 18:51

:(

fannymagnet 05-09-2005 03:17

Guy, guys, can't we all just get along? :wink:

Thanks for your help lads. The script is essentially working, except it's not displaying the RATE properly. Instead of 20000 which it should be (for the person I'm checking) it's showing 72 all the time. I'll figure it out, thanks for helping again.


All times are GMT -4. The time now is 16:38.

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