PDA

View Full Version : Can Anyone pls edit this plugin? And Change Steamid to name?


aashiriftikhar
03-12-2013, 03:37
Please edit this plugin steamid system into the name system the tags.ini file contains steam ids "tag" then the tag but i want "Player Nick" "tag" in tags.ini pls help and work on it.....coz many peoples wants this type of plugin

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Tags"
#define VERSION "1.0"
#define AUTHOR "Khalid"

#define MAX_TAG_CHARACTERS 20

new Trie:gTrie

new g_szTag[33][MAX_TAG_CHARACTERS + 1]

new const FILE[] = "addons/amxmodx/configs/tags.ini"



public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say", "HookSaid")

gTrie = TrieCreate()

ReadFile()

register_concmd("amx_reload_tags", "AdminReloadTags", ADMIN_RCON)
register_concmd("amx_add_tag", "AdminAddTag", ADMIN_RCON, "<name> <tag> - Adds a tag for a player")
}

public client_putinserver(id)
{
new szAuthId[35]; get_user_authid(id, szAuthId, charsmax(szAuthId))

if(TrieKeyExists(gTrie, szAuthId))
TrieGetString(gTrie, szAuthId, g_szTag[id], charsmax(g_szTag[]))
}

public client_disconnect(id)
g_szTag[id][0] = '^0'

public AdminAddTag(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED

new szName[32], szAuthId[35], iPlayer
read_argv(1, szName, 31); read_argv(2, g_szTag[iPlayer], charsmax(g_szTag[]))

if( !( iPlayer = cmd_target(id, szName, CMDTARGET_ALLOW_SELF) ) )
{
console_print(id, "Player must be connected")
return PLUGIN_HANDLED
}

if(g_szTag[id][0])
{
console_print(id, "Player already have a tag")
return PLUGIN_HANDLED
}

get_user_authid(iPlayer, szAuthId, charsmax(szAuthId))
get_user_name(iPlayer, szName, charsmax(szName))

new f = fopen(FILE, "w")
fseek(f, 0, SEEK_END)

fprintf(f, "^"%s^" ^"%s^"", szAuthId, g_szTag[iPlayer])
fclose(f)

TrieSetString(gTrie, szAuthId, g_szTag[iPlayer])

console_print(id, "Successfully added tag %s for player %s", g_szTag[iPlayer], szName)
return PLUGIN_HANDLED
}

public AdminReloadTags(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED

TrieClear(gTrie)

for(new i; i < sizeof(g_szTag); i++)
{
g_szTag[i][0] = '^0'
}

console_print(id, "Successfully reloaded file")
ReadFile()

new iPlayers[32], iNum, szAuthId[35], iPlayer
get_players(iPlayers, iNum, "ch")

for(new i; i < iNum; i++)
{
iPlayer = iPlayers[i]
get_user_authid(iPlayer, szAuthId, charsmax(szAuthId))
if(TrieKeyExists(gTrie, szAuthId))
{
TrieGetString(gTrie, szAuthId, g_szTag[iPlayer], charsmax(g_szTag[]))
}
}

return PLUGIN_HANDLED
}

ReadFile()
{
new szLine[100]
if(!file_exists(FILE))
{
write_file(FILE, "; Tags File -> By Khalid :)")
write_file(FILE, "; Any line starting with ; is a comment")
write_file(FILE, "; How to put tags?")
write_file(FILE, "; ^"STEAMID^" ^"TAG^"")
formatex(szLine, charsmax(szLine), "; TAG CAN BE ONLY %d CHARACTERS!", MAX_TAG_CHARACTERS)
write_file(FILE, szLine)

return;
}

new f = fopen(FILE, "r")
new szAuthId[32], szTag[MAX_TAG_CHARACTERS + 1]

while(!feof(f))
{
fgets(f, szLine, 99)

replace(szLine, charsmax(szLine), "^n", "")

if(!szLine[0] || szLine[0] == ';')
continue;

strbreak(szLine, szAuthId, charsmax(szAuthId), szTag, charsmax(szTag))

remove_quotes(szAuthId)
remove_quotes(szTag)

TrieSetString(gTrie, szAuthId, szTag)
}

fclose(f)
}

public HookSaid(id)
{
if(!g_szTag[id][0])
return PLUGIN_CONTINUE

static szMessage[191], szLastFormat[200], szName[32]
new iAlive

read_argv(1, szMessage, charsmax(szMessage))

if(!szMessage[0])
return PLUGIN_CONTINUE

get_user_name(id, szName, 31)
formatex(szLastFormat, charsmax(szLastFormat), "%s^4%s ^3%s ^1: %s", ( ( iAlive = is_user_alive(id) ) ? "" : ( get_user_team(id) == 3 ? "^1*SPEC* " : "^1*DEAD* ") ), g_szTag[id], szName, szMessage)

server_print("get_user_team(id) = %d", get_user_team(id))
Print(id, szLastFormat, iAlive)

return PLUGIN_HANDLED_MAIN
}

Print(id, Message[], iAlive)
{
static SayText

if(!SayText)
SayText = get_user_msgid("SayText")

new players[32], iNum

get_players(players, iNum, iAlive ? "ach" /* Skip Dead */ : "bch" /* Skip Alive */)

for(new i; i < iNum; i++)
{
message_begin(MSG_ONE, SayText,_, players[i])
write_byte(id)
write_string(Message)
message_end()
}
}

Podarok
03-12-2013, 03:45
No, because its non-steam. Non-steam is extremely bad for your life and health. :crab:

aashiriftikhar
03-12-2013, 03:54
No, because its non-steam. Non-steam is extremely bad for your life and health. :crab:
I Have Non Steam Cs PLs Help

xfirestorm
03-12-2013, 04:09
https://forums.alliedmods.net/showthread.php?t=143137

aashiriftikhar
03-12-2013, 05:31
https://forums.alliedmods.net/showthread.php?t=143137

Thank You

Podarok
03-12-2013, 06:38
I will remake it when i have free time…