Raised This Month: $ Target: $400
 0% 

Hostname changer.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
.OM NOM NOM NOM
BANNED
Join Date: Dec 2009
Old 12-31-2009 , 05:36   Hostname changer.
Reply With Quote #1

Evening, would any of you kind gentelmen add a shuffle mode to this code?
I'll give you 's in return.


Code:
#include <amxmodx>
#include <amxmisc>
#define Plugin "Server Name Changer"
#define Version "1.0"
#define Author "Doombringer"
new time_to_change
new const name_file[] = "server_names.ini"
new server_names[100][180], num_of_names, current_name
public plugin_init()
{
register_plugin(Plugin, Version, Author)
time_to_change = register_cvar("NC_change_time", "120")

read_names()
set_task(get_pcvar_float(time_to_change), "change_name",_,_,_, "b")
}
public read_names()
{
new configsdir[64], dir[132]
get_configsdir(configsdir, 63)

format(dir, 131, "%s/%s", configsdir, name_file)
new file = fopen(dir, "rt")

if(!file)
{
server_print("Could not find the %s file", name_file)
return PLUGIN_CONTINUE
}

new text[180]

while(!feof(file))
{
fgets(file, text, 179)

if( (strlen(text) < 2) || (equal(text, "//", 2)) )
continue;

num_of_names++
server_names[num_of_names] = text

server_print("%s", server_names[num_of_names])
}

fclose(file)
server_print("Successfully added %d server names", num_of_names)

return PLUGIN_CONTINUE
}
public change_name()
{
if(current_name + 1 > num_of_names)
current_name = 0

current_name++
server_cmd("hostname ^"%s^"", server_names[current_name])
}
.OM NOM NOM NOM is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:15.


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