AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   trigger on steamID connect. (https://forums.alliedmods.net/showthread.php?t=12493)

h4ns 04-16-2005 21:45

trigger on steamID connect.
 
Well this is a script by Bigballer but I want to rebuild it so that it only sais things when a certain people connect (like admin) it needs to be triggered by steamID but because of my lack of small-language I dont really know what to do :cry:

Code:
/* Admin join/leave message béta 1 by h4ns This lets the players now when admin is connected or disconnected to the server. Just upload this into your amxx/plugins folder add admin_ann.amxx in your amxx/plugins.ini Restart server or changemap AND ENJOY! Special thanks to BigBaller for the original script. */ #include <amxmodx> public plugin_init() {   register_plugin("Admin join/Leave Message", "beta 1","h4ns")   register_cvar("amx_join_message", "Beware %name% is connecting!")   register_cvar("amx_joined_message", "O NO! %name% is here!"   register_cvar("amx_leave_message", "Finally %name% is gone!") } public client_connect(id){     new user[32], len     user[0] = id     len = get_user_name(id,user[1],31)     set_task(2.0, "join_msg", 0, user,len + 2)     return PLUGIN_CONTINUE } public client_putinserver(id){     new user[32], len     user[0] = id     len = get_user_name(id,user[1],31)     set_task(2.0, "joined_msg", 0, user, len + 2)     return PLUGIN_CONTINUE } public client_disconnect(id){     new user[32], len     user[0] = id     len = get_user_name(id, user[1], 31)     set_task(2.0, "leave_msg", 0, user, len + 2) } public join_msg(user[]) {     if (get_cvar_num("amx_join_leave")==0){     return PLUGIN_HANDLED     }     if (get_cvar_num("amx_join_leave")==1){     new message[192]     get_cvar_string("amx_join_message", message, 191)     replace(message, 191, é%name", user[1])     set_hudmessage(0, 225, 0, 0.05, 0.45, 0, 6.0, 6.0, 0.5, 0.15, 3)     show_hudmessage(0, message)     return PLUGIN_CONTINUE     }     return PLUGIN CONTINUE } public joined_msg(user[]) {         if (get_cvar_num("amx_join_leave")==0){         return PLUGIN_HANDLED         }     if (get_cvar_num("amx_join_leave")==1){     new message[192]     get_cvar_string("amx_joined_message", message, 191)     replace(message, 191, "%name%", user[1])     set_hudmessage(0, 225, 0, 0.05, 0.45, 0, 6.0, 6.0, 0.5, 0.15, 3)     show_hudmessage(0, message)     return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public leave_msg(user[]) {         if (get_cvar_num("amx_join_leave")==0){         return PLUGIN_HANDLED         }     if (get_cvar_num("amx_join_leave")==1){     new message[192]     get_cvar_string("amx_leave_message", message, 191)     replace(message, 191, "%name%", user[1])     set_hudmessage(0, 225, 0, 0.05, 0.45, 0, 6.0, 6.0, 0.5, 0.15, 3)     show_hudmessage(0, message)     return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE }

That whas the smallcode if u can tell me what to change to get it working, that would be great. ONCE AGAIN: NEEDS TO BE TRIGGERED BY STEAMID ONLY!!! (so only if steamid 0_0:54684 connects)=>[EXAMPLE]

v3x 04-16-2005 21:58

Code:
new authID[33] get_user_authid(id,authID,32) if (authID) {     // .. }
:?:

Also, judging by all of the red in your code, that can't be good! :shock:

h4ns 04-16-2005 22:03

Quote:

if (authID) {
// ..
}
should the steam id's be placed before the //?

and im looking into that red part.

h4ns 04-16-2005 22:10

Code:
#include <amxmodx> public plugin_init() { new authID[33] get_user_authid(id,authID,32) if (authID) { STEAM_0:1:3229563    // h4ns } if   register_plugin("Admin join/Leave Message", "beta 1","h4ns")   register_cvar("amx_join_message", "Beware %name% is connecting!")   register_cvar("amx_joined_message", "O NO! %name% is here!"   register_cvar("amx_leave_message", "Finally %name% is gone!") }

like that?

v3x 04-16-2005 22:17

Damn .. :P

Code:
// This is a comment, it will not do anything within the plugin

Code:
#include <amxmodx> public plugin_init() {     register_plugin("Admin join/Leave Message", "beta 1","h4ns")     register_cvar("amx_join_message", "Beware %name% is connecting!")     register_cvar("amx_joined_message", "O NO! %name% is here!")     register_cvar("amx_leave_message", "Finally %name% is gone!") } public client_connect(id) {     new authID[33]     new steamID = get_user_authid(id,authID,32)     // If steamID returns as true     if (steamID) {         new joinMsg[164]         get_cvar_string("amx_join_message",joinMsg,163)         new name[33]         get_user_name(id,name,32)         replace(joinMsg,163,"%name%",name)                 // set_hudmessage(...)         show_hudmessage(0,"%s",joinMsg)     }     return PLUGIN_HANDLED }
I might be wrong.. :P

h4ns 04-16-2005 22:55

dont think u get me :?

I want it to trigger that message ONLY if the steamID turns out to be STEAM_0:1:3229563

and maybe some other id's to :lol:

v3x 04-16-2005 23:09

Code:
#include <amxmodx> public plugin_init() {     register_plugin("Admin join/Leave Message", "beta 1","h4ns")     register_cvar("amx_join_message", "Beware %name% is connecting!")     register_cvar("amx_joined_message", "O NO! %name% is here!")     register_cvar("amx_leave_message", "Finally %name% is gone!") } public client_connect(id) {     new authID[33]     get_user_authid(id,authID,32)     // If it matches your Steam ID     if (equal(authID,"STEAM_0:1:3229563")) {         new joinMsg[164]         get_cvar_string("amx_join_message",joinMsg,163)         new name[33]         get_user_name(id,name,32)         replace(joinMsg,163,"%name%",name)                 // set_hudmessage(...)         show_hudmessage(0,"%s",joinMsg)     }     return PLUGIN_HANDLED }
Wouldn't that be kind of dumb just displaying the message when YOU connect?

Code:
if (is_user_admin(id)) {     // .. }

h4ns 04-16-2005 23:13

no not really, want to warn players that admin is comming :D cause usually when I connected the players KEEP asking for admin while they saw me come in, so now they MUST see it :D

v3x 04-16-2005 23:16

So you're the only admin? :|

h4ns 04-16-2005 23:27

No im just head admin :D but the others dont need warning :D

Code:
/* Admin join/leave message béta 1 by h4ns This lets the players now when admin is connected or disconnected to the server. Just upload this into your amxx/plugins folder add admin_ann.amxx in your amxx/plugins.ini Restart server or changemap AND ENJOY! Special thanks to BigBaller for the original script. */ public plugin_init() {     register_plugin("Admin join/Leave Message", "beta 1","h4ns")     register_cvar("amx_join_message", "Beware %name% is connecting!")     register_cvar("amx_joined_message", "O NO! %name% is here!")     register_cvar("amx_leave_message", "Finally %name% is gone!") } public client_connect(id) {     new authID[33]     get_user_authid(id,authID,32)     // If it matches your Steam ID     if (equal(authID,"STEAM_0:1:3229563")) {         new joinMsg[164]         get_cvar_string("amx_join_message",joinMsg,163)         new name[33]         get_user_name(id,name,32)         replace(joinMsg,163,"%name%",name)                   // set_hudmessage(...)         show_hudmessage(0,"%s",joinMsg)     }     return PLUGIN_HANDLED } public client_putinserver(id){             new authID[31]         get_user_authid(id,authID,30)                     // If it matches your steam ID         if (equal(authID,"STEAM_0:1:3229563")) {                         new joinedMsg[163]             get_cvar_string("amx_joined_message",joinedMsg,162)                         new name[31]             get_user_name(id,name,30)                         replace(joinedMsg,162,"%name%",name)                         // set_hudmessage(...)             show_hudmessage(0,"%s",joinedMsg)     }         return PLUGIN_HANDLED } public client_disconnect(id){             new authID[29]         get_user_authid(id,authID,28)                 // If it matches your steam ID         if (equal(authID,"STEAM_0:1:3229563")) {                         new leaveMsg[161]             get_cvar_string("amx_leave_message",leaveMsg,160)                         new name[29]             get_user_name(id,name,28)                         replace(leaveMsg,160,^%name%",name)                         // set_hudmessage(...)             show_hudmessage(0,"%s",leaveMsg)     }         return PLUGIN_HANDLED }


All times are GMT -4. The time now is 10:00.

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