Here it is:
use /setend to set end position
use /delend if you want to delete end position
use /goend to go to end
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#pragma semicolon 1
new g_Mapname[64], g_Filename[128];
public plugin_init()
{
register_plugin("End position", "1.0", "mazmaajinsh");
register_clcmd("say /goend", "goEnd");
register_clcmd("say /setend", "setEnd", ADMIN_MAP, "");
register_clcmd("say /delend", "delEnd", ADMIN_MAP, "");
get_mapname(g_Mapname, 63);
format(g_Filename, 127, "addons/amxmodx/configs/end/%s.txt", g_Mapname);
}
public goEnd(id)
{
if (file_exists(g_Filename))
{
new temp[64], pos[3], str1[13], str2[13], str3[13];
new file = fopen(g_Filename, "rt");
while(!feof(file))
{
fgets(file, temp, 63);
parse(temp, str1, 12, str2, 12, str3, 12);
pos[0] = str_to_num(str1);
pos[1] = str_to_num(str2);
pos[2] = str_to_num(str3);
engfunc(EngFunc_SetOrigin, id, pos);
}
client_print(id, print_chat, "* You have been teleported to end");
fclose(file);
}
else
{
client_print(id, print_chat, "* No end position set");
}
}
public setEnd(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
{
client_print(id, print_chat, "* No access");
return PLUGIN_HANDLED;
}
if (file_exists(g_Filename))
{
client_print(id, print_chat, "* End position already set. Write /delend");
}
else
{
new i[3], temp[128];
pev(id, pev_origin, i);
format(temp, 127, "%d %d %d", i[0], i[1], i[2]);
write_file(g_Filename, temp, 0);
client_print(id, print_chat, "* End position set");
}
return PLUGIN_HANDLED;
}
public delEnd(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
{
client_print(id, print_chat, "* No acess");
return PLUGIN_HANDLED;
}
if (file_exists(g_Filename))
{
delete_file(g_Filename);
client_print(id, print_chat, "* End position deleted");
}
else
{
client_print(id, print_chat, "* No end position");
}
return PLUGIN_HANDLED;
}
oh and if it doesnt work try creating folder addons/amxmodx/configs/end/
but i have to warn you, if you use this at public server a lot of cheaters will have time about 1 second..
which kz mod are you using?
__________________