Raised This Month: $51 Target: $400
 12% 

Syn-Scripts Checkpoint (menu)


Post New Thread Reply   
 
Thread Tools Display Modes
Zenith77
Veteran Member
Join Date: Aug 2005
Old 09-11-2007 , 19:21   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #21

Quote:
Originally Posted by BlackMilk View Post
Right so I'll never post a positive comment about one of your plugins again?

Really, I haven't used a plugin like this before that allowed more than 1 checkpoints to be saved.

Sarcasm? Are you serious?
I didn't mean it in any offensive way =p. Sorry if I mis-read your message. Thank you for the comment!
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
BlackMilk
Veteran Member
Join Date: Jun 2007
Old 09-12-2007 , 03:52   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #22

But just lemme add how I like using menu's, anything that shaves off as few as 1 bind from my keyboard is very welcome
__________________
Mod:
User:
BlackMilk is offline
Chaos Llama
Senior Member
Join Date: Jul 2006
Old 11-18-2007 , 22:38   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #23

Any eta when the fixed version will be released?
Chaos Llama is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 06-26-2008 , 15:17   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #24

Hey, there is one big bug in your plugin, you can't overwrite checkpoint while in the air, but you can make another checkpoint when you're in air
naven is offline
tosiek
Member
Join Date: Dec 2007
Old 08-16-2008 , 08:45   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #25

when you try to translate the menu plugin stops working, why?
tosiek is offline
Send a message via ICQ to tosiek
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 08-20-2008 , 06:43   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #26

Tosiek I told you I have got translation ;] wal na gg(on nie odpisuje)
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
asdasdka
Junior Member
Join Date: Apr 2009
Old 08-18-2009 , 03:35   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #27

Can someone put the code: only admin can use this plugin i tried:
Code:
 register_clcmd("say /checkpoint", "CMD_CheckPoint", ADMIN_LEVEL_A, "- displays checkpoint menu");
 register_clcmd("say /cp", "CMD_CheckPoint", ADMIN_LEVEL_A, "- displays checkpoint menu");
 register_clcmd("say /cphelp", "CMD_Help", ADMIN_LEVEL_A, "- shows checkpoint help window");
but it isnt work
asdasdka is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 08-18-2009 , 04:29   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #28

asdasdka, use this:
Code:
/* 
Syn-Scripts Checkpoint
Copyright © Zenith77 & www.thesyndicated.com 2006

Description:
This was (we don't use it as of now), the offical checkpoint system of Team Syndicated.
It is a simple plugin, but unlike other less user-friendly checkpoint plugins, it uses a menu that allows ease of use
and quick access to multiple checkpoints. I decided to release this since it was just sitting
there in my folder collecting dust.

Commands:
say /checkpoint	- displays checkpoint menu
say /cp		- displays checkpoint menu
say /cphelp	- opens the checkpoint help window (MOTD style).

Using the menu:
Once you've opened your checkpoint menu you will see six options:
* Go to checkpoint - Goes to your last saved checkpoint
* Save checkpoint - Saves a checkpoint to your current poisition
* Create checkpoint - Creates a new checkpoint (Max Checkpoints: 5 [default])
* Erase checkpoint - Erases your current selected checkpoint
* Checkpoint # - Press this to go through your checkpoints in order to modify/teleport to them
* Exit - Exits the menu
	
NOTE: Some options may be blocked on certain conditions. These options will be "darkened/grayed" out.

CVars:
sv_checkpoint		- [default: 1]	Is checkpoint enabled on this server?
checkpoint_announce	- [default: 240] Display checkpoint every # of seconds, shows short help (set this to zero to disable).
checkpoint_wait		- [default: 5] How long does a player have to wait until he/she can teleport again?

Notes:
Very old and messy code :/.

All comments and suggestions welcomed.
*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Syn-Scripts Checkpoint"
#define VERSION "1.0"
#define AUTHOR "Zenith77"

#define MAX_CHECKPOINTS 5

new gCVAREnabled;
new gCVARAnnounce;
new gCVARWait;

new gCheckpoints[33];
new Float:gNextCheckpointTime[33];
new Float:gCheckpointVec[33][MAX_CHECKPOINTS][3];

new gMenuCheckpoint[33];

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	gCVAREnabled 	= register_cvar("sv_checkpoint", "1", FCVAR_SERVER);
	gCVARAnnounce 	= register_cvar("checkpoint_announce", "240");
	gCVARWait 	= register_cvar("checkpoint_wait", "5");
	
	register_clcmd("say /checkpoint", "CMD_CheckPoint", ADMIN_ALL, "- displays checkpoint menu");
	register_clcmd("say /cp", "CMD_CheckPoint", ADMIN_ALL, "- displays checkpoint menu");
	register_clcmd("say /cphelp", "CMD_Help", ADMIN_ALL, "- shows checkpoint help window");
	
	register_menucmd(register_menuid("Syn-Scripts Checkpoint Menu"), 1023, "PressedCheckpointMenu")
	
	set_task(float(get_pcvar_num(gCVARAnnounce)), "Task_Announce");
}

public client_connect(id)
{
	gCheckpoints[id] = -1;
	gNextCheckpointTime[id] = 0.0;
	gMenuCheckpoint[id] = 0;
	
	static i;
	static j;
	for (i = 0; i < MAX_CHECKPOINTS; i++)
		for (j = 0; j < 3; j++)
			gCheckpointVec[id][i][j] = 0.0;
}

/*
public client_putinserver(id)
	set_task(2.0, "PrintInfoToConsole", id + 555);

public PrintInfoToConsole(id)
{
	id -= 555;
	
	client_print(id, print_console, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
	client_print(id, print_console, ">>>	Checkpoint is enabled on this server:	>>>");
	client_print(id, print_console, ">>>	say /cphelp for more information!	>>>");
	client_print(id, print_console, ">>>	Sponsored by: www.efrigid.org		>>>");
	client_print(id, print_console, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
}
*/

public CMD_CheckPoint(id)
{
	if ( !(get_user_flags(id) & ADMIN_KICK) )
	return PLUGIN_HANDLED;
	if (!get_pcvar_num(gCVAREnabled))
	{
		client_print(id, print_chat, "[AMXX] Checkpoint is currently disabled.");
		return PLUGIN_HANDLED;
	}
	
	if (!is_user_alive(id))
	{
		client_print(id, print_chat, "[AMXX] Sorry, dead people can't use checkpoint!");
		return PLUGIN_HANDLED;
	}
	if (gCheckpoints[id] <= -1)
		gMenuCheckpoint[id] = -1;
	else
		gMenuCheckpoint[id] = 0;
		
	ShowCheckpointMenu(id);
	
	return PLUGIN_HANDLED;
}

public CMD_Help(id)
{
	new len = 1600
	new buffer[1601]
	new n = 0

	n += format(buffer[n],len-n,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><body><pre>^n");
	
	n += format(buffer[n],len-n,"<b>Commands</b>^n");
	n += format(buffer[n],len-n,"<li>say /checkpoint - displays checkpoint menu</li>^n");
	n += format(buffer[n],len-n,"<li>say /cp - displays checkpoint menu</li>^n");
	n += format(buffer[n],len-n,"<li>say /cphelp - displays this window</li>^n^n");
	
	n += format(buffer[n],len-n,"<b>How to use checkpoint</b>^n")
	n += format(buffer[n],len-n,"Once you've opened your checkpoint menu you will see six options:^n");
	n += format(buffer[n],len-n,"<li>Go to checkpoint - Goes to your last saved checkpoint</li>^n");
	n += format(buffer[n],len-n,"<li>Save checkpoint - Saves a checkpoint to your current poisition</li>^n");
	n += format(buffer[n],len-n,"<li>Create checkpoint - Creates a new checkpoint (Max Checkpoints: <b>%d</b>)</li>^n", MAX_CHECKPOINTS);
	n += format(buffer[n],len-n,"<li>Erase checkpoint - Erases your current selected checkpoint^n");
	n += format(buffer[n],len-n,"<li>Checkpoint #</li> - Press this to go through your checkpoints in order to modify/teleport to them^n");
	n += format(buffer[n],len-n,"<li>Exit - Exits the menu</li>^n^n");
	
	n += format(buffer[n],len-n,"<i>NOTE: Some options may be blocked on certain conditions. These options will be ^"darkened/grayed^" out.</i>^n^n");

	n += format(buffer[n],len-n,"<b>Status</b>^n");
	n += format(buffer[n],len-n,"Checkpoint is currently: <b>%s</b>^n^n", get_pcvar_num(gCVAREnabled) ? "ON" : "OFF");
	
	n += format(buffer[n],len-n,"<b>Other</b>^n");
	n += format(buffer[n],len-n,"Visit our offical website at: www.efrigid.org (www.thesyndicated.com)^n");
	n += format(buffer[n],len-n,"This plugin made by: syn.zenith");
	n += format(buffer[n],len-n,"</html>");
	
	show_motd(id, buffer, "Syn-Scripts Checkpoint Help");
	
	return PLUGIN_HANDLED;
}

public Task_Announce()
{
	// We set this any way since the cvar can be toggled on/off
	set_task(float(get_pcvar_num(gCVARAnnounce)), "Task_Announce");
	
	if (!get_pcvar_num(gCVAREnabled) || !get_pcvar_num(gCVARAnnounce))
		return;
	
	client_print(0, print_chat, "[AMXX] Checkpoint is currently enabled, say /cphelp for more information.");
}

#define MENU_SIZE 300

// I honestly hate my code from this point forward.
// I'm going to change it when I don't feel so lazy :/.
ShowCheckpointMenu(id)
{
	new menu[MENU_SIZE];
	new keys = MENU_KEY_0;
	new szColor[4];
	
	if (gCheckpoints[id] > -1)
	{
		keys |= MENU_KEY_1|MENU_KEY_2|MENU_KEY_4;
		
		if (gCheckpoints[id] >= 1)
			keys |= MENU_KEY_8;
		
		szColor[0] = 0;
	}
	else
		copy(szColor, 3, "\d");
	
	if (gCheckpoints[id] < MAX_CHECKPOINTS-1)
		keys |= MENU_KEY_3;

	new checkpoint = /*gCheckpoints[id] <= 0 ?*/ gMenuCheckpoint[id]+1 //: gCheckpoints[id];
		
	format(menu, MENU_SIZE-1, "\rSyn-Scripts Checkpoint Menu^n\yYou have %d checkpoints^n^n\w%s1. Go to checkpoint^n\w%s2. Save checkpoint^n%s3. Create new checkpoint^n\
		\w%s4. Erase checkpoint^n^n%s8. Checkpoint #%d^n^n\w0. Exit", gCheckpoints[id]+1, szColor, szColor, keys &MENU_KEY_3 ? "\w" : "\d", szColor, 
		keys &MENU_KEY_4 ? "\y" : "\d", checkpoint);
		
	show_menu(id, keys, menu);
}

public PressedCheckpointMenu(id, key)
{
	// new Float:velocity[3]
	new flags;
	
	// pev(id, pev_velocity, velocity);
	flags = pev(id, pev_flags);
	
	switch(key)
	{
		case 0:
		{
			if (get_gametime() < gNextCheckpointTime[id])
			{
				ShowCheckpointMenu(id);
				client_print(id, print_chat, "[AMXX] You cannot teleport that often!");
				
				return;
			}
			
			if (!(pev(id, pev_flags) &FL_ONGROUND) && !(flags &FL_INWATER))
			{
				ShowCheckpointMenu(id);
				client_print(id, print_chat, "[AMXX] You cannot teleport while you're off the ground!");
				
				return;
			}
			
			new Float:origin[3];
			pev(id, pev_origin, origin);
			
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
			write_byte(TE_TELEPORT);
			engfunc(EngFunc_WriteCoord, origin[0]);
			engfunc(EngFunc_WriteCoord, origin[1]);
			engfunc(EngFunc_WriteCoord, origin[2]);
			message_end();
			
			set_pev(id, pev_origin, gCheckpointVec[id][gMenuCheckpoint[id]]);
			
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
			write_byte(TE_TELEPORT);
			engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][0]);
			engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][1]);
			engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][2]);
			message_end();
			
			gNextCheckpointTime[id] = get_gametime() + float(get_pcvar_num(gCVARWait));
			
			ShowCheckpointMenu(id);
			//client_print(id, print_chat, "[Syn-Scripts] You have been teleported to checkpoint #%d", gMenuCheckpoint[id]);
	 	}
		
		case 1:
		{
			if (!(flags &FL_ONGROUND) && !(flags &FL_INWATER))
			{
				ShowCheckpointMenu(id);
				client_print(id, print_chat, "[AMXX] You cannot save a checkpoint while you're off the ground and/or in the water!");
				
				return;
			}
			
			pev(id, pev_origin, gCheckpointVec[id][gMenuCheckpoint[id]]);
			
			if (flags &FL_DUCKING)
				gCheckpointVec[id][gMenuCheckpoint[id]][2] += 30.0;
			
			client_print(id, print_chat, "[AMXX] Checkpoint #%d saved", gMenuCheckpoint[id] + 1);
			ShowCheckpointMenu(id);
		}
		
		case 2:
		{
			pev(id, pev_origin, gCheckpointVec[id][++gCheckpoints[id]]);
			
			gMenuCheckpoint[id] = gCheckpoints[id];
			client_print(id, print_chat, "[AMXX] Created checkpoint #%d", gCheckpoints[id]+1);
			
			ShowCheckpointMenu(id);
		}
			
		
		case 3:
		{
			new i;
			for (i = 0; i < 3; i++)
				gCheckpointVec[id][gMenuCheckpoint[id]][i] = 0.0;
			
			gMenuCheckpoint[id] = --gCheckpoints[id];
			
			client_print(id, print_chat, "[AMXX] Checkpoint erased");
			ShowCheckpointMenu(id);
		}
		
		case 7:
		{
			if (gMenuCheckpoint[id] == gCheckpoints[id])
				gMenuCheckpoint[id] = 0;
			else
				++gMenuCheckpoint[id];
			
			ShowCheckpointMenu(id);
		}

	}
	
}
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
asdasdka
Junior Member
Join Date: Apr 2009
Old 08-18-2009 , 06:56   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #29

Quote:
Originally Posted by N A V E N View Post
asdasdka, use this:
Code:
/* 
Syn-Scripts Checkpoint
Copyright © Zenith77 & www.thesyndicated.com 2006
 
Description:
This was (we don't use it as of now), the offical checkpoint system of Team Syndicated.
It is a simple plugin, but unlike other less user-friendly checkpoint plugins, it uses a menu that allows ease of use
and quick access to multiple checkpoints. I decided to release this since it was just sitting
there in my folder collecting dust.
 
Commands:
say /checkpoint    - displays checkpoint menu
say /cp        - displays checkpoint menu
say /cphelp    - opens the checkpoint help window (MOTD style).
 
Using the menu:
Once you've opened your checkpoint menu you will see six options:
* Go to checkpoint - Goes to your last saved checkpoint
* Save checkpoint - Saves a checkpoint to your current poisition
* Create checkpoint - Creates a new checkpoint (Max Checkpoints: 5 [default])
* Erase checkpoint - Erases your current selected checkpoint
* Checkpoint # - Press this to go through your checkpoints in order to modify/teleport to them
* Exit - Exits the menu
 
NOTE: Some options may be blocked on certain conditions. These options will be "darkened/grayed" out.
 
CVars:
sv_checkpoint        - [default: 1]    Is checkpoint enabled on this server?
checkpoint_announce    - [default: 240] Display checkpoint every # of seconds, shows short help (set this to zero to disable).
checkpoint_wait        - [default: 5] How long does a player have to wait until he/she can teleport again?
 
Notes:
Very old and messy code :/.
 
All comments and suggestions welcomed.
*/
 
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
 
#define PLUGIN "Syn-Scripts Checkpoint"
#define VERSION "1.0"
#define AUTHOR "Zenith77"
 
#define MAX_CHECKPOINTS 5
 
new gCVAREnabled;
new gCVARAnnounce;
new gCVARWait;
 
new gCheckpoints[33];
new Float:gNextCheckpointTime[33];
new Float:gCheckpointVec[33][MAX_CHECKPOINTS][3];
 
new gMenuCheckpoint[33];
 
public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
 
    gCVAREnabled     = register_cvar("sv_checkpoint", "1", FCVAR_SERVER);
    gCVARAnnounce     = register_cvar("checkpoint_announce", "240");
    gCVARWait     = register_cvar("checkpoint_wait", "5");
 
    register_clcmd("say /checkpoint", "CMD_CheckPoint", ADMIN_ALL, "- displays checkpoint menu");
    register_clcmd("say /cp", "CMD_CheckPoint", ADMIN_ALL, "- displays checkpoint menu");
    register_clcmd("say /cphelp", "CMD_Help", ADMIN_ALL, "- shows checkpoint help window");
 
    register_menucmd(register_menuid("Syn-Scripts Checkpoint Menu"), 1023, "PressedCheckpointMenu")
 
    set_task(float(get_pcvar_num(gCVARAnnounce)), "Task_Announce");
}
 
public client_connect(id)
{
    gCheckpoints[id] = -1;
    gNextCheckpointTime[id] = 0.0;
    gMenuCheckpoint[id] = 0;
 
    static i;
    static j;
    for (i = 0; i < MAX_CHECKPOINTS; i++)
        for (j = 0; j < 3; j++)
            gCheckpointVec[id][i][j] = 0.0;
}
 
/*
public client_putinserver(id)
    set_task(2.0, "PrintInfoToConsole", id + 555);
 
public PrintInfoToConsole(id)
{
    id -= 555;
 
    client_print(id, print_console, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
    client_print(id, print_console, ">>>    Checkpoint is enabled on this server:    >>>");
    client_print(id, print_console, ">>>    say /cphelp for more information!    >>>");
    client_print(id, print_console, ">>>    Sponsored by: www.efrigid.org        >>>");
    client_print(id, print_console, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
}
*/
 
public CMD_CheckPoint(id)
{
    if ( !(get_user_flags(id) & ADMIN_KICK) )
    return PLUGIN_HANDLED;
    if (!get_pcvar_num(gCVAREnabled))
    {
        client_print(id, print_chat, "[AMXX] Checkpoint is currently disabled.");
        return PLUGIN_HANDLED;
    }
 
    if (!is_user_alive(id))
    {
        client_print(id, print_chat, "[AMXX] Sorry, dead people can't use checkpoint!");
        return PLUGIN_HANDLED;
    }
    if (gCheckpoints[id] <= -1)
        gMenuCheckpoint[id] = -1;
    else
        gMenuCheckpoint[id] = 0;
 
    ShowCheckpointMenu(id);
 
    return PLUGIN_HANDLED;
}
 
public CMD_Help(id)
{
    new len = 1600
    new buffer[1601]
    new n = 0
 
    n += format(buffer[n],len-n,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><body><pre>^n");
 
    n += format(buffer[n],len-n,"<b>Commands</b>^n");
    n += format(buffer[n],len-n,"<li>say /checkpoint - displays checkpoint menu</li>^n");
    n += format(buffer[n],len-n,"<li>say /cp - displays checkpoint menu</li>^n");
    n += format(buffer[n],len-n,"<li>say /cphelp - displays this window</li>^n^n");
 
    n += format(buffer[n],len-n,"<b>How to use checkpoint</b>^n")
    n += format(buffer[n],len-n,"Once you've opened your checkpoint menu you will see six options:^n");
    n += format(buffer[n],len-n,"<li>Go to checkpoint - Goes to your last saved checkpoint</li>^n");
    n += format(buffer[n],len-n,"<li>Save checkpoint - Saves a checkpoint to your current poisition</li>^n");
    n += format(buffer[n],len-n,"<li>Create checkpoint - Creates a new checkpoint (Max Checkpoints: <b>%d</b>)</li>^n", MAX_CHECKPOINTS);
    n += format(buffer[n],len-n,"<li>Erase checkpoint - Erases your current selected checkpoint^n");
    n += format(buffer[n],len-n,"<li>Checkpoint #</li> - Press this to go through your checkpoints in order to modify/teleport to them^n");
    n += format(buffer[n],len-n,"<li>Exit - Exits the menu</li>^n^n");
 
    n += format(buffer[n],len-n,"<i>NOTE: Some options may be blocked on certain conditions. These options will be ^"darkened/grayed^" out.</i>^n^n");
 
    n += format(buffer[n],len-n,"<b>Status</b>^n");
    n += format(buffer[n],len-n,"Checkpoint is currently: <b>%s</b>^n^n", get_pcvar_num(gCVAREnabled) ? "ON" : "OFF");
 
    n += format(buffer[n],len-n,"<b>Other</b>^n");
    n += format(buffer[n],len-n,"Visit our offical website at: www.efrigid.org (www.thesyndicated.com)^n");
    n += format(buffer[n],len-n,"This plugin made by: syn.zenith");
    n += format(buffer[n],len-n,"</html>");
 
    show_motd(id, buffer, "Syn-Scripts Checkpoint Help");
 
    return PLUGIN_HANDLED;
}
 
public Task_Announce()
{
    // We set this any way since the cvar can be toggled on/off
    set_task(float(get_pcvar_num(gCVARAnnounce)), "Task_Announce");
 
    if (!get_pcvar_num(gCVAREnabled) || !get_pcvar_num(gCVARAnnounce))
        return;
 
    client_print(0, print_chat, "[AMXX] Checkpoint is currently enabled, say /cphelp for more information.");
}
 
#define MENU_SIZE 300
 
// I honestly hate my code from this point forward.
// I'm going to change it when I don't feel so lazy :/.
ShowCheckpointMenu(id)
{
    new menu[MENU_SIZE];
    new keys = MENU_KEY_0;
    new szColor[4];
 
    if (gCheckpoints[id] > -1)
    {
        keys |= MENU_KEY_1|MENU_KEY_2|MENU_KEY_4;
 
        if (gCheckpoints[id] >= 1)
            keys |= MENU_KEY_8;
 
        szColor[0] = 0;
    }
    else
        copy(szColor, 3, "\d");
 
    if (gCheckpoints[id] < MAX_CHECKPOINTS-1)
        keys |= MENU_KEY_3;
 
    new checkpoint = /*gCheckpoints[id] <= 0 ?*/ gMenuCheckpoint[id]+1 //: gCheckpoints[id];
 
    format(menu, MENU_SIZE-1, "\rSyn-Scripts Checkpoint Menu^n\yYou have %d checkpoints^n^n\w%s1. Go to checkpoint^n\w%s2. Save checkpoint^n%s3. Create new checkpoint^n\
        \w%s4. Erase checkpoint^n^n%s8. Checkpoint #%d^n^n\w0. Exit", gCheckpoints[id]+1, szColor, szColor, keys &MENU_KEY_3 ? "\w" : "\d", szColor, 
        keys &MENU_KEY_4 ? "\y" : "\d", checkpoint);
 
    show_menu(id, keys, menu);
}
 
public PressedCheckpointMenu(id, key)
{
    // new Float:velocity[3]
    new flags;
 
    // pev(id, pev_velocity, velocity);
    flags = pev(id, pev_flags);
 
    switch(key)
    {
        case 0:
        {
            if (get_gametime() < gNextCheckpointTime[id])
            {
                ShowCheckpointMenu(id);
                client_print(id, print_chat, "[AMXX] You cannot teleport that often!");
 
                return;
            }
 
            if (!(pev(id, pev_flags) &FL_ONGROUND) && !(flags &FL_INWATER))
            {
                ShowCheckpointMenu(id);
                client_print(id, print_chat, "[AMXX] You cannot teleport while you're off the ground!");
 
                return;
            }
 
            new Float:origin[3];
            pev(id, pev_origin, origin);
 
            message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
            write_byte(TE_TELEPORT);
            engfunc(EngFunc_WriteCoord, origin[0]);
            engfunc(EngFunc_WriteCoord, origin[1]);
            engfunc(EngFunc_WriteCoord, origin[2]);
            message_end();
 
            set_pev(id, pev_origin, gCheckpointVec[id][gMenuCheckpoint[id]]);
 
            message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
            write_byte(TE_TELEPORT);
            engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][0]);
            engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][1]);
            engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][2]);
            message_end();
 
            gNextCheckpointTime[id] = get_gametime() + float(get_pcvar_num(gCVARWait));
 
            ShowCheckpointMenu(id);
            //client_print(id, print_chat, "[Syn-Scripts] You have been teleported to checkpoint #%d", gMenuCheckpoint[id]);
         }
 
        case 1:
        {
            if (!(flags &FL_ONGROUND) && !(flags &FL_INWATER))
            {
                ShowCheckpointMenu(id);
                client_print(id, print_chat, "[AMXX] You cannot save a checkpoint while you're off the ground and/or in the water!");
 
                return;
            }
 
            pev(id, pev_origin, gCheckpointVec[id][gMenuCheckpoint[id]]);
 
            if (flags &FL_DUCKING)
                gCheckpointVec[id][gMenuCheckpoint[id]][2] += 30.0;
 
            client_print(id, print_chat, "[AMXX] Checkpoint #%d saved", gMenuCheckpoint[id] + 1);
            ShowCheckpointMenu(id);
        }
 
        case 2:
        {
            pev(id, pev_origin, gCheckpointVec[id][++gCheckpoints[id]]);
 
            gMenuCheckpoint[id] = gCheckpoints[id];
            client_print(id, print_chat, "[AMXX] Created checkpoint #%d", gCheckpoints[id]+1);
 
            ShowCheckpointMenu(id);
        }
 
 
        case 3:
        {
            new i;
            for (i = 0; i < 3; i++)
                gCheckpointVec[id][gMenuCheckpoint[id]][i] = 0.0;
 
            gMenuCheckpoint[id] = --gCheckpoints[id];
 
            client_print(id, print_chat, "[AMXX] Checkpoint erased");
            ShowCheckpointMenu(id);
        }
 
        case 7:
        {
            if (gMenuCheckpoint[id] == gCheckpoints[id])
                gMenuCheckpoint[id] = 0;
            else
                ++gMenuCheckpoint[id];
 
            ShowCheckpointMenu(id);
        }
 
    }
 
}
Thank you! Works perfectly ^^
asdasdka is offline
Old 08-18-2009, 10:52
asdasdka
This message has been deleted by asdasdka. Reason: fiexed
pizzahut
Senior Member
Join Date: Oct 2004
Old 08-20-2009 , 12:49   Re: Syn-Scripts Checkpoint (menu)
Reply With Quote #30

Here's a version I made for games/mods that
- don't support HTML MOTD
- don't support coloured menu text
E.g. TFC. This should work with all games/mods. However I simply removed the unsupported features. So it won't look as pretty as the original on games/mods that do support these features.
Code:
/* 
Syn-Scripts Checkpoint
Copyright © Zenith77 & www.thesyndicated.com 2006

Colour and HTML code removed by pizzahut on 2009-03-01

Description:
This was (we don't use it as of now), the offical checkpoint system of Team Syndicated.
It is a simple plugin, but unlike other less user-friendly checkpoint plugins, it uses a menu that allows ease of use
and quick access to multiple checkpoints. I decided to release this since it was just sitting
there in my folder collecting dust.

Commands:
say /checkpoint	- displays checkpoint menu
say /cp		- displays checkpoint menu
say /cphelp	- opens the checkpoint help window (MOTD style).

Using the menu:
Once you've opened your checkpoint menu you will see six options:
* Go to checkpoint - Goes to your last saved checkpoint
* Save checkpoint - Saves a checkpoint to your current poisition
* Create checkpoint - Creates a new checkpoint (Max Checkpoints: 5 [default])
* Erase checkpoint - Erases your current selected checkpoint
* Checkpoint # - Press this to go through your checkpoints in order to modify/teleport to them
* Exit - Exits the menu
	
NOTE: Some options may be blocked on certain conditions. These options will be "darkened/grayed" out.

CVars:
sv_checkpoint		- [default: 1]	Is checkpoint enabled on this server?
checkpoint_announce	- [default: 240] Display checkpoint every # of seconds, shows short help (set this to zero to disable).
checkpoint_wait		- [default: 5] How long does a player have to wait until he/she can teleport again?

Notes:
Very old and messy code :/.

All comments and suggestions welcomed.
*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Syn-Scripts Checkpoint"
#define VERSION "1.0.1"
#define AUTHOR "Zenith77,pizzahut"

#define MAX_CHECKPOINTS 5

new gCVAREnabled;
new gCVARAnnounce;
new gCVARWait;

new gCheckpoints[33];
new Float:gNextCheckpointTime[33];
new Float:gCheckpointVec[33][MAX_CHECKPOINTS][3];

new gMenuCheckpoint[33];

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	gCVAREnabled 	= register_cvar("sv_checkpoint", "1", FCVAR_SERVER);
	gCVARAnnounce 	= register_cvar("checkpoint_announce", "240");
	gCVARWait 	= register_cvar("checkpoint_wait", "5");
	
	register_clcmd("say /checkpoint", "CMD_CheckPoint", ADMIN_ALL, "- displays checkpoint menu");
	register_clcmd("say /cp", "CMD_CheckPoint", ADMIN_ALL, "- displays checkpoint menu");
	register_clcmd("say /cphelp", "CMD_Help", ADMIN_ALL, "- shows checkpoint help window");
	
	register_menucmd(register_menuid("Syn-Scripts Checkpoint Menu"), 1023, "PressedCheckpointMenu")
	
	set_task(float(get_pcvar_num(gCVARAnnounce)), "Task_Announce");
}

public client_connect(id)
{
	gCheckpoints[id] = -1;
	gNextCheckpointTime[id] = 0.0;
	gMenuCheckpoint[id] = 0;
	
	static i;
	static j;
	for (i = 0; i < MAX_CHECKPOINTS; i++)
		for (j = 0; j < 3; j++)
			gCheckpointVec[id][i][j] = 0.0;
}

/*
public client_putinserver(id)
	set_task(2.0, "PrintInfoToConsole", id + 555);

public PrintInfoToConsole(id)
{
	id -= 555;
	
	client_print(id, print_console, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
	client_print(id, print_console, ">>>	Checkpoint is enabled on this server:	>>>");
	client_print(id, print_console, ">>>	say /cphelp for more information!	>>>");
	client_print(id, print_console, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
}
*/

public CMD_CheckPoint(id)
{
	if (!get_pcvar_num(gCVAREnabled))
	{
		client_print(id, print_chat, "[AMXX] Checkpoint is currently disabled.");
		return PLUGIN_HANDLED;
	}
	
	if (!is_user_alive(id))
	{
		client_print(id, print_chat, "[AMXX] Sorry, dead people can't use checkpoint!");
		return PLUGIN_HANDLED;
	}
	if (gCheckpoints[id] <= -1)
		gMenuCheckpoint[id] = -1;
	else
		gMenuCheckpoint[id] = 0;
		
	ShowCheckpointMenu(id);
	
	return PLUGIN_HANDLED;
}

public CMD_Help(id)
{
	new len = 1600
	new buffer[1601]
	new n = 0

	n += format(buffer[n],len-n,"Commands^n");
	n += format(buffer[n],len-n," say /checkpoint - displays checkpoint menu^n");
	n += format(buffer[n],len-n," say /cp - displays checkpoint menu^n");
	n += format(buffer[n],len-n," say /cphelp - displays this window^n^n");
	
	n += format(buffer[n],len-n,"How to use checkpoint^n")
	n += format(buffer[n],len-n,"Once you've opened your checkpoint menu you will see six options:^n");
	n += format(buffer[n],len-n," Go to checkpoint - Goes to your last saved checkpoint^n");
	n += format(buffer[n],len-n," Save checkpoint - Saves a checkpoint to your current poisition^n");
	n += format(buffer[n],len-n," Create checkpoint - Creates a new checkpoint (Max Checkpoints: %d)^n", MAX_CHECKPOINTS);
	n += format(buffer[n],len-n," Erase checkpoint - Erases your current selected checkpoint^n");
	n += format(buffer[n],len-n," Checkpoint # - Press this to go through your checkpoints in order to modify/teleport to them^n");
	n += format(buffer[n],len-n," Exit - Exits the menu^n^n");
	
	n += format(buffer[n],len-n,"NOTE: Some options may be blocked on certain conditions. These options will have a # instead of a number.^n^n");

	n += format(buffer[n],len-n,"Status^n");
	n += format(buffer[n],len-n,"Checkpoint is currently: %s^n^n", get_pcvar_num(gCVAREnabled) ? "ON" : "OFF");
	
	n += format(buffer[n],len-n,"Other^n");
	n += format(buffer[n],len-n,"This plugin made by: syn.zenith^n");
	n += format(buffer[n],len-n,"Modified for TFC by: pizzahut");
	
	show_motd(id, buffer, "Syn-Scripts Checkpoint Help");
	
	return PLUGIN_HANDLED;
}

public Task_Announce()
{
	// We set this any way since the cvar can be toggled on/off
	set_task(float(get_pcvar_num(gCVARAnnounce)), "Task_Announce");
	
	if (!get_pcvar_num(gCVAREnabled) || !get_pcvar_num(gCVARAnnounce))
		return;
	
	client_print(0, print_chat, "[AMXX] Checkpoint is currently enabled, say /cphelp for more information.");
}

#define MENU_SIZE 300

// I honestly hate my code from this point forward.
// I'm going to change it when I don't feel so lazy :/.
ShowCheckpointMenu(id)
{
	new menu[MENU_SIZE];
	new keys = MENU_KEY_0;
	if (gCheckpoints[id] > -1)
	{
		keys |= MENU_KEY_1|MENU_KEY_2|MENU_KEY_4;
		if (gCheckpoints[id] >= 1)
			keys |= MENU_KEY_8;
	}
	if (gCheckpoints[id] < MAX_CHECKPOINTS-1)
		keys |= MENU_KEY_3;
	new checkpoint = /*gCheckpoints[id] <= 0 ?*/ gMenuCheckpoint[id]+1 //: gCheckpoints[id];
	format(menu, MENU_SIZE-1,
"Syn-Scripts Checkpoint Menu^n\
You have %d checkpoints^n^n\
%s. Go to checkpoint^n\
%s. Save checkpoint^n\
%s. Create new checkpoint^n\
%s. Erase checkpoint^n^n\
%s. Checkpoint #%d^n^n\
0. Exit",
	gCheckpoints[id]+1, keys &MENU_KEY_1 ? "1" : "#", keys &MENU_KEY_2 ? "2" : "#", keys &MENU_KEY_3 ? "3" : "#", keys &MENU_KEY_4 ? "4" : "#", keys &MENU_KEY_8 ? "8" : "#", checkpoint);
	show_menu(id, keys, menu);
}

public PressedCheckpointMenu(id, key)
{
	// new Float:velocity[3]
	new flags;
	
	// pev(id, pev_velocity, velocity);
	flags = pev(id, pev_flags);
	
	switch(key)
	{
		case 0:
		{
			if (get_gametime() < gNextCheckpointTime[id])
			{
				ShowCheckpointMenu(id);
				client_print(id, print_chat, "[AMXX] You cannot teleport that often!");
				
				return;
			}
			
			if (!(pev(id, pev_flags) &FL_ONGROUND) && !(flags &FL_INWATER))
			{
				ShowCheckpointMenu(id);
				client_print(id, print_chat, "[AMXX] You cannot teleport while you're off the ground!");
				
				return;
			}
			
			new Float:origin[3];
			pev(id, pev_origin, origin);
			
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
			write_byte(TE_TELEPORT);
			engfunc(EngFunc_WriteCoord, origin[0]);
			engfunc(EngFunc_WriteCoord, origin[1]);
			engfunc(EngFunc_WriteCoord, origin[2]);
			message_end();
			
			set_pev(id, pev_origin, gCheckpointVec[id][gMenuCheckpoint[id]]);
			
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
			write_byte(TE_TELEPORT);
			engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][0]);
			engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][1]);
			engfunc(EngFunc_WriteCoord, gCheckpointVec[id][gMenuCheckpoint[id]][2]);
			message_end();
			
			gNextCheckpointTime[id] = get_gametime() + float(get_pcvar_num(gCVARWait));
			
			ShowCheckpointMenu(id);
			//client_print(id, print_chat, "[Syn-Scripts] You have been teleported to checkpoint #%d", gMenuCheckpoint[id]);
	 	}
		
		case 1:
		{
			if (!(flags &FL_ONGROUND) && !(flags &FL_INWATER))
			{
				ShowCheckpointMenu(id);
				client_print(id, print_chat, "[AMXX] You cannot save a checkpoint while you're off the ground and/or in the water!");
				
				return;
			}
			
			pev(id, pev_origin, gCheckpointVec[id][gMenuCheckpoint[id]]);
			
			if (flags &FL_DUCKING)
				gCheckpointVec[id][gMenuCheckpoint[id]][2] += 30.0;
			
			client_print(id, print_chat, "[AMXX] Checkpoint #%d saved", gMenuCheckpoint[id] + 1);
			ShowCheckpointMenu(id);
		}
		
		case 2:
		{
			pev(id, pev_origin, gCheckpointVec[id][++gCheckpoints[id]]);
			
			gMenuCheckpoint[id] = gCheckpoints[id];
			client_print(id, print_chat, "[AMXX] Created checkpoint #%d", gCheckpoints[id]+1);
			
			ShowCheckpointMenu(id);
		}
			
		
		case 3:
		{
			new i;
			for (i = 0; i < 3; i++)
				gCheckpointVec[id][gMenuCheckpoint[id]][i] = 0.0;
			
			gMenuCheckpoint[id] = --gCheckpoints[id];
			
			client_print(id, print_chat, "[AMXX] Checkpoint erased");
			ShowCheckpointMenu(id);
		}
		
		case 7:
		{
			if (gMenuCheckpoint[id] == gCheckpoints[id])
				gMenuCheckpoint[id] = 0;
			else
				++gMenuCheckpoint[id];
			
			ShowCheckpointMenu(id);
		}

	}
	
}
__________________
My AMXX plugins (content date 2007-03-29, link check 2017-04-26)

Plugins for the Royston Vasey TFC server - These are UNSUPPORTED, except those which have been published at AMX Mod X.
pizzahut is offline
Reply



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 13:51.


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