Raised This Month: $ Target: $400
 0% 

[REQ] Can someone help me?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wiggen94
Member
Join Date: Jul 2009
Location: Schweden
Old 06-21-2010 , 21:34   [REQ] Can someone help me?
Reply With Quote #1

hi!
can someone help me with this code?
i'd like it to be just like on kz maps, when you type .cp a checkpoint is made and if you type .tp i will teleport.
i don't want it to be /cp like it is now, and no menu is needed just .cp and .tp
PHP 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(PLUGINVERSIONAUTHOR)
    
    
gCVAREnabled     register_cvar("sv_checkpoint""1"FCVAR_SERVER);
    
gCVARAnnounce     register_cvar("checkpoint_announce""0");
    
gCVARWait     register_cvar("checkpoint_wait""0");
    
    
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 (
0MAX_CHECKPOINTSi++)
        for (
03j++)
            
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_pcvar_num(gCVAREnabled))
    {
        
client_print(idprint_chat"[AMXX] Checkpoint is currently disabled.");
        return 
PLUGIN_HANDLED;
    }
    
    if (!
is_user_alive(id))
    {
        
client_print(idprint_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 
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");
    
    
+= format(buffer[n],len-n,"<b>Commands</b>^n");
    
+= format(buffer[n],len-n,"<li>say /checkpoint - displays checkpoint menu</li>^n");
    
+= format(buffer[n],len-n,"<li>say /cp - displays checkpoint menu</li>^n");
    
+= format(buffer[n],len-n,"<li>say /cphelp - displays this window</li>^n^n");
    
    
+= format(buffer[n],len-n,"<b>How to use checkpoint</b>^n")
    
+= format(buffer[n],len-n,"Once you've opened your checkpoint menu you will see six options:^n");
    
+= format(buffer[n],len-n,"<li>Go to checkpoint - Goes to your last saved checkpoint</li>^n");
    
+= format(buffer[n],len-n,"<li>Save checkpoint - Saves a checkpoint to your current poisition</li>^n");
    
+= format(buffer[n],len-n,"<li>Create checkpoint - Creates a new checkpoint (Max Checkpoints: <b>%d</b>)</li>^n"MAX_CHECKPOINTS);
    
+= format(buffer[n],len-n,"<li>Erase checkpoint - Erases your current selected checkpoint^n");
    
+= format(buffer[n],len-n,"<li>Checkpoint #</li> - Press this to go through your checkpoints in order to modify/teleport to them^n");
    
+= format(buffer[n],len-n,"<li>Exit - Exits the menu</li>^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");

    
+= format(buffer[n],len-n,"<b>Status</b>^n");
    
+= format(buffer[n],len-n,"Checkpoint is currently: <b>%s</b>^n^n"get_pcvar_num(gCVAREnabled) ? "ON" "OFF");
    
    
+= format(buffer[n],len-n,"<b>Other</b>^n");
    
+= format(buffer[n],len-n,"Visit our offical website at: www.efrigid.org (www.thesyndicated.com)^n");
    
+= format(buffer[n],len-n,"This plugin made by: syn.zenith");
    
+= format(buffer[n],len-n,"</html>");
    
    
show_motd(idbuffer"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(0print_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(szColor3"\d");
    
    if (
gCheckpoints[id] < MAX_CHECKPOINTS-1)
        
keys |= MENU_KEY_3;

    new 
checkpoint /*gCheckpoints[id] <= 0 ?*/ gMenuCheckpoint[id]+//: gCheckpoints[id];
        
    
format(menuMENU_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]+1szColorszColorkeys &MENU_KEY_3 "\w" "\d"szColor
        
keys &MENU_KEY_4 "\y" "\d"checkpoint);
        
    
show_menu(idkeysmenu);
}

public 
PressedCheckpointMenu(idkey)
{
    
// new Float:velocity[3]
    
new flags;
    
    
// pev(id, pev_velocity, velocity);
    
flags pev(idpev_flags);
    
    switch(
key)
    {
        case 
0:
        {
            if (
get_gametime() < gNextCheckpointTime[id])
            {
                
ShowCheckpointMenu(id);
                
client_print(idprint_chat"[AMXX] You cannot teleport that often!");
                
                return;
            }
            
            if (!(
pev(idpev_flags) &FL_ONGROUND) && !(flags &FL_INWATER))
            {
                
ShowCheckpointMenu(id);
                
client_print(idprint_chat"[AMXX] You cannot teleport while you're off the ground!");
                
                return;
            }
            
            new 
Float:origin[3];
            
pev(idpev_originorigin);
            
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
            
write_byte(TE_TELEPORT);
            
engfunc(EngFunc_WriteCoordorigin[0]);
            
engfunc(EngFunc_WriteCoordorigin[1]);
            
engfunc(EngFunc_WriteCoordorigin[2]);
            
message_end();
            
            
set_pev(idpev_origingCheckpointVec[id][gMenuCheckpoint[id]]);
            
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
            
write_byte(TE_TELEPORT);
            
engfunc(EngFunc_WriteCoordgCheckpointVec[id][gMenuCheckpoint[id]][0]);
            
engfunc(EngFunc_WriteCoordgCheckpointVec[id][gMenuCheckpoint[id]][1]);
            
engfunc(EngFunc_WriteCoordgCheckpointVec[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(idprint_chat"[AMXX] You cannot save a checkpoint while you're off the ground and/or in the water!");
                
                return;
            }
            
            
pev(idpev_origingCheckpointVec[id][gMenuCheckpoint[id]]);
            
            if (
flags &FL_DUCKING)
                
gCheckpointVec[id][gMenuCheckpoint[id]][2] += 30.0;
            
            
client_print(idprint_chat"[AMXX] Checkpoint #%d saved"gMenuCheckpoint[id] + 1);
            
ShowCheckpointMenu(id);
        }
        
        case 
2:
        {
            
pev(idpev_origingCheckpointVec[id][++gCheckpoints[id]]);
            
            
gMenuCheckpoint[id] = gCheckpoints[id];
            
client_print(idprint_chat"[AMXX] Created checkpoint #%d"gCheckpoints[id]+1);
            
            
ShowCheckpointMenu(id);
        }
            
        
        case 
3:
        {
            new 
i;
            for (
03i++)
                
gCheckpointVec[id][gMenuCheckpoint[id]][i] = 0.0;
            
            
gMenuCheckpoint[id] = --gCheckpoints[id];
            
            
client_print(idprint_chat"[AMXX] Checkpoint erased");
            
ShowCheckpointMenu(id);
        }
        
        case 
7:
        {
            if (
gMenuCheckpoint[id] == gCheckpoints[id])
                
gMenuCheckpoint[id] = 0;
            else
                ++
gMenuCheckpoint[id];
            
            
ShowCheckpointMenu(id);
        }

    }
    

__________________
[IMG]http://img283.**************/img283/8743/tankausbl8.png[/IMG]
Wiggen94 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 14:52.


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