AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   quotes? (https://forums.alliedmods.net/showthread.php?t=22603)

Sonic7145 12-30-2005 19:50

quotes?
 
pruned

v3x 12-31-2005 01:33

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "AMX PM" #define VERSION "1.0" #define AUTHOR "Sonic" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("amx_pm", "send_message", 0, "<player> <message> - user sends a message to another user.") } // You forgot level, cid public send_message(id, level, cid) {     // change the # of args to 3 because you have the command+<player>+<message>           if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED         new user[32], uid     read_argv(1, user, 31) // change length to 31 (32 - 1 = 31)     new message[256]     read_argv(2, message, 255) // change length to 255 (256 - 1 = 255)     new sendername[32]     get_user_name(id, sendername, 31)         uid = find_player("bh", user)     new name[32]     get_user_name(uid, name, 31)         if (uid == 0) {         console_print(id, "[AMXX] Unable to find player with that name.")         return PLUGIN_HANDLED     }     console_print(id,  "[AMXX] Message sent to %s!", name)     console_print(uid, "** [AMXX] You've recieved a message from %s! **", sendername)     client_print(uid, print_chat, "** Message from %s: %s **", sendername, message)     return PLUGIN_HANDLED }
Additionally, you might want to check if one of the players is dead and trying to talk to someone that's alive.
Code:
if((!is_user_alive(id) && is_user_alive(uid)) || (!is_user_alive(uid) && is_user_alive(id))) {     console_print(id, "[AMXX] You cannot talk to the %s", (is_user_alive(id)) ? "dead" : "living");     return PLUGIN_HANDLED; }

VEN 12-31-2005 03:27

It was done before.


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

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