Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- #define PLUGIN "Steam Slot"
- #define VERSION "1.0"
- #define AUTHOR "raizo"
- #pragma tabsize 0
- #pragma compress 1
- new slot_flags;
- new configsDir[64]
- new SlotName[] = "Slot Steam"
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- slot_flags = register_cvar("flag_for_slot", "b")
- get_configsdir(configsDir, 63)
- formatex(configsDir, 63, "%s/users.ini", configsDir)
- }
- public client_connect(id)
- {
- new auth[32], Comment[33];
- if(is_user_steam(id))
- {
- get_user_name(id, Comment, sizeof(Comment)-1)
- get_user_authid(id, auth, 31)
- Addslot(id, auth, Comment)
- }
- }
- Addslot(id, auth[], comment[]="")
- {
- new configsDir[64],string_steam[20]
- get_pcvar_string(slot_flags,string_steam,19)
- get_configsdir(configsDir, 63)
- format(configsDir, 63, "%s/users.ini", configsDir)
- if (!file_exists(configsDir))
- {
- console_print(id, "[%s] File ^"%s^" doesn't exist.", SlotName, configsDir)
- return
- }
- new line = 0, textline[256], len
- const SIZE = 63
- new line_steamid[SIZE + 1], line_password[SIZE + 1], line_accessflags[SIZE + 1], line_flags[SIZE + 1], parsedParams
- while ((line = read_file(configsDir, line, textline, 255, len)))
- {
- if (len == 0 || equal(textline, ";", 1))
- continue
- parsedParams = parse(textline, line_steamid, SIZE, line_password, SIZE, line_accessflags, SIZE, line_flags, SIZE)
- if (parsedParams != 4)
- continue
- if (equal(line_steamid, auth))
- {
- server_print("[%s] Steam %s already exists!", SlotName, auth)
- return
- }
- }
- new linetoadd[512]
- if (comment[0]==0)
- {
- formatex(linetoadd, 511, "^r^"%s^" ^"^" ^"%s^" ^"ce^"", auth, string_steam)
- }
- else
- {
- formatex(linetoadd, 511, "^r^"%s^" ^"^" ^"%s^" ^"ce^" ;^%s", auth, string_steam, comment)
- }
- console_print(id, "Adding:^n%s", linetoadd)
- if (!write_file(configsDir, linetoadd))
- console_print(id, "[%s] Failed writing to %s!", SlotName, configsDir)
- }
- stock bool:is_user_steam(id)
- {
- static dp_pointer
- if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
- {
- server_cmd("dp_clientinfo %d", id)
- server_exec()
- return (get_pcvar_num(dp_pointer) == 2) ? true : false
- }
- return false
- }
Add Comment
Please, Sign In to add comment