Raised This Month: $ Target: $400
 0% 

A lot of errors while compiling


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-13-2009 , 08:30   Re: A lot of errors while compiling
Reply With Quote #4

if you dont know how to coding, dont try
here i fixed it
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>                // For some Adminstuff
#include <engine>            // My most used module ;o
#include <cstrike>            // I need this to give somebody a nvg :(
#include <nvault>            // For top10
#include <fakemeta>

#define MAX_CPS 5             // MUST be greater than 2
#define NOBLOCK_DISTANCE 120.0        // Distance between 2 players - if distance is smaller -> semiclip
#define CP_DISTANCE 35.0        // Distance between player and checkpoint
#define KZ_LEVEL ADMIN_KICK        // Adminlevel
#define BUTTON_DISTANCE 70.0        // Distance between timer button and player

#define MENU_KEYS MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_0
#define MENU_KEYS_ADMIN MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0

new bool:noblock[32]

new 
Float:checkpoints[32][MAX_CPS][3]
new 
checkpointnum[32]

new 
bool:needhelp[32]
new 
helpcount[32]

new 
bool:timer_started[32]
new 
timer_time[32]
new 
bool:showtimer[32] = {true, ...};

new 
bhop[32]

new 
bool:usedbutton[32]

new 
bool:firstspawn[32]

// CVars (I like CVar pointers :o)
new kz_checkpoints
new kz_godmode
new kz_scout
new kz_help
new kz_semiclip
new kz_bhop
new kz_adminglow
new kz_cheatdetect
new kz_transparency

// Sprites
new Sbeam 0

// =================================================================================================

public plugin_init() {
    
register_plugin("prokreedzediting","1.0","p4ddY")
    
    
register_cvar("prokreedz_version","1.0",FCVAR_SERVER)
    
    
// CVars
    
kz_checkpoints register_cvar("kz_checkpoints","1")
    
kz_godmode register_cvar("kz_godmode","0")
    
kz_scout register_cvar("kz_scout","0")
    
kz_help register_cvar("kz_help","0")
    
kz_semiclip register_cvar("kz_semiclip","1")
    
kz_bhop register_cvar("kz_bhop","0")
    
kz_adminglow register_cvar("kz_adminglow","0")
    
kz_cheatdetect register_cvar("kz_cheatdetect","1")
    
kz_transparency register_cvar("kz_transparency","1")
    
    
// Cmds
    //register_clcmd("say .kreedz","kz_menu")
    //register_clcmd("say /kreedz","kz_menu")
    //register_clcmd("say .menu","kz_menu")
    //register_clcmd("say /menu","kz_menu")
    
    
register_clcmd("cp","checkpoint")
    
register_clcmd("checkpoint","checkpoint")
    
register_clcmd("say .cp","checkpoint")
    
register_clcmd("say /cp","checkpoint")
    
register_clcmd("say .checkpoint","checkpoint")
    
register_clcmd("say /checkpoint","checkpoint")
    
    
register_clcmd("tp","goto_checkpoint")
    
register_clcmd("gocheck","goto_checkpoint")
    
register_clcmd("say","goto_checkpoint_say")
    
    
register_clcmd("stuck","goto_stuck")
    
register_clcmd("unstuck","goto_stuck")
    
register_clcmd("say .stuck","goto_stuck")
    
register_clcmd("say /stuck","goto_stuck")
    
register_clcmd("say .unstuck","goto_stuck")
    
register_clcmd("say /unstuck","goto_stuck")
    
    
register_clcmd("say .help","help")
    
register_clcmd("say /help","help")
    
    
register_clcmd("say .reset","reset_checkpoints")
    
register_clcmd("say /reset","reset_checkpoints")
    
    
//register_clcmd("kz_unhelp","admin_unhelp",KZ_LEVEL)
    //register_clcmd("kz_showhelp","admin_showhelp",KZ_LEVEL)
    //register_clcmd("say .noclip","admin_noclip",KZ_LEVEL)
    //register_clcmd("say /noclip","admin_noclip",KZ_LEVEL)
    //register_clcmd("kz_laser","admin_laser",KZ_LEVEL,"[blue|yellow|green|red|orange]")
    
    // Some other admincmds
    //register_clcmd("kz_noclip","admin_noclip",KZ_LEVEL,"<name|#userid|steamid|@ALL> <on/off>")
    //register_clcmd("kz_teleport","admin_teleport",KZ_LEVEL,"<name|#userid|steamid> <name|#userid|steamid>")
    //register_clcmd("kz_gravity","admin_gravity",KZ_LEVEL,"<name|#userid|steamid|@ALL> <gravity>")
    
    
register_clcmd("say .amenu","kz_menu_admin_show",ADMIN_CVAR)
    
register_clcmd("say /amenu","kz_menu_admin_show",ADMIN_CVAR)
    
register_clcmd("say .adminmenu","kz_menu_admin_show",ADMIN_CVAR)
    
register_clcmd("say /adminmenu","kz_menu_admin_show",ADMIN_CVAR)
    
    
register_clcmd("say .respawn","respawn")
    
register_clcmd("say /respawn","respawn")
    
register_clcmd("say .spawn","respawn")
    
register_clcmd("say /spawn","respawn")
    
//register_clcmd("say .start","respawn")
    //register_clcmd("say /start","respawn")
    
    
register_clcmd("say .top10","topten_show")
    
register_clcmd("say /top10","topten_show")
    
register_clcmd("say .top15","topten_show")
    
register_clcmd("say /top15","topten_show")
    
    
// Events
    
register_event("DeathMsg","deathmsg","a")
    
register_event("ResetHUD","resethud","be")
    
//register_touch("player","func_button","button_touch") SUCKS!
    
    // Menue
    
register_menu("ProKreedz by p4ddY",MENU_KEYS,"menu_handler")
    
register_menu("Adminmenu",MENU_KEYS_ADMIN,"menu_handler_admin")
    
    
set_task(0.1,"noblock_task",1000,"",0,"ab")
    
set_task(1.0,"timer_task",2000,"",0,"ab")
    
    new 
kreedz_cfg[128], cfgdir[64]
    
    
get_configsdir(cfgdir,64)    
    
format(kreedz_cfg,128,"%s/kreedz.cfg",cfgdir)
    
    if(
file_exists(kreedz_cfg)) {
        
server_exec()
        
server_cmd("exec %s",kreedz_cfg)
    }
}

public 
plugin_precache() {
    
Sbeam precache_model("sprites/laserbeam.spr")
}

// =================================================================================================
// Global Functions
// =================================================================================================
stock _fm_set_entity_flags(indexflagonoff) {
    new 
flags pev(indexpev_flags)
    if ((
flags flag) > 0)
        return 
onoff == set_pev(indexpev_flagsflags flag)
    else
        return 
onoff == set_pev(indexpev_flagsflags flag)
    
    return 
0
    
}

public 
respawn(id) {
    new 
pid id 100 id id-100
    spawn
(pid)
}

delay_duck(id)
{
set_task(0.01"force_duck"id);
_fm_set_entity_flags(idFL_DUCKING1);
}

public 
force_duck(id)
{
_fm_set_entity_flags(idFL_DUCKING1);
}

// IF YOU USE THIS FOR YOUR OWN PLUGIN, PLEASE CREDIT ME! thanks
public noblock_task() {
if(
get_pcvar_num(kz_semiclip) > -1) {
    new 
bool:solid[32]
    new 
Float:origin[3]
    new 
Float:vorigin[3]
    for(new 
x=1;x<=get_maxplayers();x++) {
        if(
is_user_connected(x) && is_user_alive(x)) {
            if(
get_pcvar_num(kz_semiclip) == || noblock[x-1]) {
                
entity_get_vector(x,EV_VEC_origin,origin)
                for(new 
i=1;i<=get_maxplayers();i++) {
                    if(
!= && is_user_connected(i) && is_user_alive(i)) {
                        
entity_get_vector(i,EV_VEC_origin,vorigin)
                        if(
get_distance_f(origin,vorigin) <= NOBLOCK_DISTANCE) {
                            
entity_set_int(x,EV_INT_solid,SOLID_NOT)
                            
entity_set_int(i,EV_INT_solid,SOLID_NOT)
                            
                            if(
get_pcvar_num(kz_transparency) == 1) {
                                
set_rendering(x,kRenderFxNone,255,255,255,kRenderTransAdd,60)
                                
set_rendering(i,kRenderFxNone,255,255,255,kRenderTransAdd,60)
                            }
                            
                            
solid[x-1] = true
                            solid
[i-1] = true
                        
}
                        else if(!
solid[i-1]) {
                            
entity_set_int(i,EV_INT_solid,SOLID_BBOX)
                            
glow(i)
                        }
                    }
                }
            }
            else if(!
solid[x-1]) {
                
entity_set_int(x,EV_INT_solid,SOLID_BBOX)
                
glow(x)
            }
        }
    }
}
else {
    for(new 
i=1;i<=get_maxplayers();i++) {
        if(
is_user_connected(i) && is_user_alive(i)) {
            
entity_set_int(i,EV_INT_solid,SOLID_BBOX)
            
glow(i)
        }
    }
}
}

// =================================================================================================

public timer_task() {
    for(new 
i=1;i<=get_maxplayers();i++) {
        if(
is_user_connected(i) && is_user_alive(i) && (get_user_team(i) == 2) && showtimer[i-1] && timer_started[i-1]) {
            new 
kreedztime get_systime() - timer_time[i-1], imin
            
if((kreedztime 60.0) >= 1) {
                
imin floatround(kreedztime 60.0,floatround_floor)
                
kreedztime -= (floatround(kreedztime 60.0,floatround_floor) * 60)
            }
            
set_hudmessage(255255255, -1.00.0500.01.10.00.01);
            
show_hudmessage(i" %d min%s %d sec%s | %i CP "imin,imin == "" "s",kreedztime,kreedztime == "" "s"checkpointnum[i-1]); 

        }
    }
}

// =================================================================================================

public glow(id) {
    new 
colors[3]
    if(
needhelp[id-1] && get_pcvar_num(kz_help) == 1)
        
colors = {255,0,0}
    else if(
access(id,KZ_LEVEL) && get_pcvar_num(kz_adminglow) == 1)
        
colors = {170,255,0}
    else
        
colors = {0,0,0}
    
    
set_rendering(id,kRenderFxGlowShell,colors[0],colors[1],colors[2],kRenderNormal,25)
}

// =================================================================================================

public detect_cheat(id,reason[]) { // I saw this feature in kz_mulitplugin :o
    
if(timer_started[id-1] && get_pcvar_num(kz_cheatdetect) == 1) {
        
set_hudmessage(id0255, -1.0, -1.006.05.0)
        
show_hudmessage(id"Detected %s - Timer terminated",reason)  
        
timer_started[id-1] = false
    
}
}

// =================================================================================================
// Cmds
// =================================================================================================

public checkpoint(id) {
    if(
get_pcvar_num(kz_checkpoints) == 1) {
        if(
is_user_alive(id)) {
            
            for(new 
i=MAX_CPS-1;i>0;i--) {
                
checkpoints[id-1][i][0] = checkpoints[id-1][i-1][0]
                
checkpoints[id-1][i][1] = checkpoints[id-1][i-1][1]
                
checkpoints[id-1][i][2] = checkpoints[id-1][i-1][2]
            }
            new 
Float:origin[3]
            
entity_get_vector(id,EV_VEC_origin,origin)
            
checkpoints[id-1][0][0] = origin[0]
            
checkpoints[id-1][0][1] = origin[1]
            
checkpoints[id-1][0][2] = origin[2]
            
            if(
checkpointnum[id-1] > 0) {
                
//client_print(id,print_chat,"[ProKreedz] Checkpoint no. %d created, distance to the previous one: %dm",checkpointnum[id-1]+1,floatround(get_distance_f(checkpoints[id-1][1],origin) / 20,floatround_round))
                
set_hudmessage(id0255, -1.0, -1.006.05.0)
                
show_hudmessage(id"Checkpoint nr. %d created",checkpointnum[id-1]+1)
            } else {
                
set_hudmessage(id0255, -1.0, -1.006.05.0)
                
show_hudmessage(id"Checkpoint nr. 1 created")
            }
            
checkpointnum[id-1]++
        } else {
            
set_hudmessage(id0255, -1.0, -1.006.05.0)
            
show_hudmessage(id"You must be alive")
        }
    } else {
        
set_hudmessage(id0255, -1.0, -1.006.05.0)
        
show_hudmessage(id"Checkpoints are disabled")
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public goto_checkpoint(id) {
    if(
get_pcvar_num(kz_checkpoints) == 1) {
        if(
is_user_alive(id)) {
            if(
checkpointnum[id-1] > 0) {
                if(
read_argc() == 2) {
                    new 
szcp[8], cpnum
                    read_argv
(1,szcp,8)
                    
cpnum str_to_num(szcp) - 1
                    
                    
if(cpnum >= && cpnum MAX_CPS) {
                        if(
cpnum checkpointnum[id-1])
                            
goto_cp(id,cpnum)
                        else {
                            
set_hudmessage(id0255, -1.0, -1.006.05.0)
                            
show_hudmessage(id"Not enough checkpoints")
                        }
                    }
                    else
                        
goto_cp(id,0)
                }
                else {
                    
goto_cp(id,0)
                }
            }
            else {
                
//client_print(id,print_chat,"[ProKreedz] First you have to create a checkpoint")
                
set_hudmessage(id0255, -1.0, -1.006.05.0)
                
show_hudmessage(id"Create checkpoint first")
            }
        }
        else {
            
//client_print(id,print_chat,"[ProKreedz] You must be alive to use this function")
            
set_hudmessage(id0255, -1.0, -1.006.05.0)
            
show_hudmessage(id"You must be alive")
        }
    }
    else {
        
//client_print(id,print_chat,"[ProKreedz] Checkpoints are disabled")
        
set_hudmessage(id0255, -1.0, -1.006.05.0)
        
show_hudmessage(id"Checkpoints are disabled")
    }
    
    return 
PLUGIN_HANDLED
}

public 
goto_checkpoint_say(id) {
    if(
read_argc() == 2) {
        new 
szarg1[32], args1[16], args2[16]
        
read_argv(1,szarg1,32)
        
copyc(args1,16,szarg1,32)
        
copy(args2,16,szarg1[strlen(args1)+1])
        if(
equal(args1,".tp") || equal(args1,"/tp") || equal(args1,".gocheck") || equal(args1,"/gocheck")) {
            if(
get_pcvar_num(kz_checkpoints) == 1) {
                if(
is_user_alive(id)) {
                    if(
checkpointnum[id-1] > 0) {
                        new 
cpnum str_to_num(args2) - 1
                        
if(cpnum >= && cpnum MAX_CPS) {
                            if(
cpnum checkpointnum[id-1])
                                
goto_cp(id,cpnum)
                            else {
                                
//client_print(id,print_chat,"[ProKreedz] You have not created enough checkpoints")
                                
set_hudmessage(id0255, -1.0, -1.006.05.0)
                                
show_hudmessage(id"Not enough checkpoints")
                            }
                        }
                        else
                            
goto_cp(id,0)    
                    }
                    else {
                        
//client_print(id,print_chat,"[ProKreedz] First you have to create a checkpoint")
                        
set_hudmessage(id0255, -1.0, -1.006.05.0)
                        
show_hudmessage(id"Create checkpoint first")
                    }
                }
                else {
                    
//client_print(id,print_chat,"[ProKreedz] You have to be alive to use this function")
                    
set_hudmessage(id0255, -1.0, -1.006.05.0)
                    
show_hudmessage(id"You must be alive")
                }
            }
            else {
                
//client_print(id,print_chat,"[ProKreedz] Checkpoints are disabled")
                
set_hudmessage(id0255, -1.0, -1.006.05.0)
                
show_hudmessage(id"Checkpoints are disabled")
            }
            
            return 
PLUGIN_HANDLED
        
}
    }
    
    return 
PLUGIN_CONTINUE
}

public 
goto_stuck(id) {
    if(
get_pcvar_num(kz_checkpoints) == 1) {
        if(
is_user_alive(id)) {
            if(
checkpointnum[id-1] > 1)
                
goto_cp(id,1)
            else {
                
//client_print(id,print_chat,"[ProKreedz] You have not created enough checkpoints")
                
set_hudmessage(id0255, -1.0, -1.006.05.0)
                
show_hudmessage(id"Not enough checkpoints")
            }
        }
        else {
            
//client_print(id,print_chat,"[ProKreedz] You have to be alive to use this function")
            
set_hudmessage(id0255, -1.0, -1.006.05.0)
            
show_hudmessage(id"You must be alive")
        }
    }
    else {
        
//client_print(id,print_chat,"[ProKreedz] Checkpoints are disabled")
        
set_hudmessage(id0255, -1.0, -1.006.05.0)
        
show_hudmessage(id"Checkpoints are disabled")
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public goto_cp(id,cp) {
    new 
semiclip get_pcvar_num(kz_semiclip)
    if(
semiclip == -|| (!noblock[id-1] && semiclip == 0)) {
        new 
Float:origin[3]
        for(new 
i=1;i<=get_maxplayers();i++) {
            if(
id != && is_user_connected(i) && is_user_alive(id)) {
                if(
semiclip == -|| (!noblock[i-1] && semiclip == 0)) {
                    
entity_get_vector(i,EV_VEC_origin,origin)
                    if(
get_distance_f(checkpoints[id-1][cp],origin) <= CP_DISTANCE) {
                        
//client_print(id,print_chat,"[ProKreedz] Somebody is too close to your checkpoint")
                        
set_hudmessage(id0255, -1.0, -1.006.05.0)
                        
show_hudmessage(id"Somebody is too close to your checkpoint")
                        return 
false
                    
}
                }
            }
        }
    }
    
    
delay_duck(id)
    
entity_set_origin(id,checkpoints[id-1][cp])
    
entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0})
    
spawnsprite(checkpoints[id-1][cp])
    
set_user_gravity(id// to fix the low gravity bug on kz_man_redrock (thanks to NoEx)
    
noblock_task()
    
    return 
true
}

// =================================================================================================

public spawnsprite(Float:origin[3]) {
    new 
iorigin[3]
    
iorigin[0] = floatround(origin[0],floatround_ceil)
    
iorigin[1] = floatround(origin[1],floatround_ceil)
    
iorigin[2] = floatround(origin[2],floatround_ceil)
    
    
write_byte(11)
    
write_coord(iorigin[0])
    
write_coord(iorigin[1])
    
write_coord(iorigin[2])
    
message_end()
}

// =================================================================================================

public reset_checkpoints(id) {
    
checkpointnum[id-1] = 0
    timer_started
[id-1] = false
    
//client_print(id,print_chat,"[ProKreedz] Timer and checkpoints resetted")
    
set_hudmessage(id0255, -1.0, -1.006.05.0)
    
show_hudmessage(id"Timer and checkpoints resetted")
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public help(id) {
    if(
get_pcvar_num(kz_help) == 1) {
        new 
name[32]
        
get_user_name(id,name,32)
        if(
needhelp[id-1]) {
            
needhelp[id-1] = false
            
//client_print(0,print_chat,"[ProKreedz] %s does not need help anymore",name)
            
set_hudmessage(00255, -1.0, -1.006.05.0)
            
show_hudmessage(0" %s does not need help anymore",name)
        }
        else {
            
needhelp[id-1] = true
            helpcount
[id-1]++
            
//client_print(0,print_chat,"[ProKreedz] %s needs help",name)
            
set_hudmessage(00255, -1.0, -1.006.05.0)
            
show_hudmessage(0" %s needs help",name)
            
            
//client_print(id,print_chat,"[ProKreedz] Type '.help' again if you do not need help anymore")
            
set_hudmessage(id0255, -1.0, -1.006.05.0)
            
show_hudmessage(id" Type .help again if you do not need help anymore")
        }
    }
    
glow(id)
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================
// AdminCmds
// =================================================================================================

public admin_unhelp(id,level,cid) {
    new 
name[32]
    
get_user_name(id,name,32)
    
    if(
read_argc() == 2) {
        if(!
cmd_access(id,level,cid,2))
            return 
PLUGIN_HANDLED
        
        
new sztarget[32]
        
read_argv(1,sztarget,32)
        if(
equal(sztarget,"@ALL")) {
            for(new 
i=1;i<=get_maxplayers();i++) {
                if(
is_user_connected(i)) {
                    if(
needhelp[i-1]) {
                        
needhelp[i-1] = false
                        
//client_print(i,print_chat,"[ProKreedz] Admin %s has helped you",name)
                        
set_hudmessage(i0255, -1.0, -1.006.05.0)
                        
show_hudmessage(i"Admin %s has helped you",name)
                    }
                    
glow(i)
                }
            }
        }
        else {
            new 
target cmd_target(id,sztarget,2)
            if(
target 0) {    
                if(
needhelp[target-1]) {
                    
needhelp[target-1] = false
                    
//client_print(target,print_chat,"[ProKreedz] Admin %s has helped you",name)
                    
set_hudmessage(target0255, -1.0, -1.006.05.0)
                    
show_hudmessage(target"Admin %s has helped you",name)
                }
                
glow(target)
                
            }
        }
    }
    else {
        if(!
cmd_access(id,level,cid,1))
            return 
PLUGIN_HANDLED
        
        
new aimidbody
        get_user_aiming
(id,aimid,body)
        if(
aimid && aimid 33) {
            
needhelp[aimid-1] = false
            glow
(aimid)
            
//client_print(aimid,print_chat,"[ProKreedz] Admin %s has helped you",name)
            
set_hudmessage(aimid0255, -1.0, -1.006.05.0)
            
show_hudmessage(aimid"Admin %s has helped you",name)
        }
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public admin_showhelp(id,level,cid) {
    if(!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED
    
    
for(new i=1;i<=get_maxplayers();i++) {
        if(
is_user_connected(i) && is_user_alive(i) && needhelp[i-1]) {
            
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
            
write_byte(8)            // TE_BEAMENTS
            
write_short(id)            // start entity
            
write_short(i)            // end entity
            
write_short(Sbeam)        // sprite to draw (precached below)
            
write_byte(0)            // starting frame
            
write_byte(0)            // frame rate
            
write_byte(100)            // life in 0.1s
            
write_byte(3)            // line width in 0.1u
            
write_byte(0)            // noise in 0.1u
            
write_byte(255)            // R
            
write_byte(0)            // G
            
write_byte(0)            // B
            
write_byte(200)            // brightness
            
write_byte(2)            // scroll speed
            
message_end()
        }
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public admin_noclip(id,level,cid) {
    if(
read_argc() == || read_argc() == 2) {
        if(!
cmd_access(id,level,cid,1)) {
            
set_user_noclip(id,0)
            return 
PLUGIN_HANDLED
        
}
        
        
set_user_noclip(id,get_user_noclip(id) == 1)
        if(
get_user_noclip(id) == 1)
            
detect_cheat(id,"Noclip")
    }
    else if(
read_argc() == 3) {
        if(!
cmd_access(id,level,cid,3))
            return 
PLUGIN_HANDLED
        
        
new name[32]
        
get_user_name(id,name,32)
        
        new 
szarg1[32], szarg2[8], bool:mode
        read_argv
(1,szarg1,32)
        
read_argv(2,szarg2,32)
        if(
equal(szarg2,"on"))
            
mode true
        
        
if(equal(szarg1,"@ALL")) {
            for(new 
i=1;i<=get_maxplayers();i++) {
                if(
is_user_connected(i) && is_user_alive(i)) {
                    
set_user_noclip(i,mode 0)
                    
client_print(i,print_chat,"[ProKreedz] Admin %s %s noclip",name,mode "gave you" "removed your")
                    
client_print(i,print_chat,"[ProKreedz] Type '.noclip' to remove it")
                    if(
mode)
                        
detect_cheat(i,"Noclip")
                }
            }
        }
        else {
            new 
pid cmd_target(id,szarg1,2)
            if(
pid && is_user_alive(pid)) {
                
set_user_noclip(pid,mode 0)
                
client_print(pid,print_chat,"[ProKreedz] Admin %s %s noclip",name,mode "gave you" "removed your")
                
client_print(pid,print_chat,"[ProKreedz] Type '.noclip' to remove it")
                if(
mode)
                    
detect_cheat(pid,"Noclip")
            }
        }
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public admin_teleport(id,level,cid) {
    new 
name[32]
    
get_user_name(id,name,32)
    
    if(
read_argc() == 3) {
        if(!
cmd_access(id,level,cid,3))
            return 
PLUGIN_HANDLED
        
        
new szarg1[32], szarg2[32]
        
read_argv(1,szarg1,32)
        
read_argv(2,szarg2,32)
        
        new 
id1 cmd_target(0,szarg1,1&4), id2 cmd_target(0,szarg2,4)
        if(
id1 && id2 0) {
            new 
targetname[32]
            
get_user_name(id2,targetname,32)
            
            new 
Float:origin[3]
            
entity_get_vector(id2,EV_VEC_origin,origin)
            
delay_duck(id)
            
entity_set_origin(id1,origin)
            
            
//client_print(id1,print_chat,"[ProKreedz] Admin %s has teleported you to %s",name,targetname)
            
set_hudmessage(id10255, -1.0, -1.006.05.0)
            
show_hudmessage(id1"Admin %s has teleported you to %s",name,targetname)
            
detect_cheat(id1,"Teleport")
        }
    }
    else {
        if(!
cmd_access(id,level,cid,5))
            return 
PLUGIN_HANDLED
        
        
new szarg1[32]
        
read_argv(1,szarg1,32)
        
        new 
target cmd_target(0,szarg1,1&4)
        if(
target 0) {
            new 
szargx[8], szargy[8], szargz[8]
            
read_argv(2,szargx,8)
            
read_argv(3,szargy,8)
            
read_argv(4,szargz,8)
            
            new 
Float:origin[3]
            
origin[0] = str_to_float(szargx)
            
origin[1] = str_to_float(szargy)
            
origin[2] = str_to_float(szargz)
            
            
delay_duck(id)
            
entity_set_origin(target,origin)
            
//client_print(target,print_chat,"[ProKreedz] Admin %s has teleported you",name)
            
set_hudmessage(target0255, -1.0, -1.006.05.0)
            
show_hudmessage(target"Admin %s has teleported you",name)
            
detect_cheat(target,"Teleport")
        }
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public admin_gravity(id,level,cid) {
    if(!
cmd_access(id,level,cid,3))
        return 
PLUGIN_HANDLED
    
    
new name[32]
    
get_user_name(id,name,32)
    
    new 
szarg1[32], szarg2[8], gravityFloat:fgravity
    read_argv
(1,szarg1,32)
    
read_argv(2,szarg2,8)
    
gravity str_to_num(szarg2)
    
fgravity gravity float(get_cvar_num("sv_gravity"))
    
    if(
equal(szarg1,"@ALL")) {
        for(new 
i=1;i<=get_maxplayers();i++) {
            if(
is_user_connected(i)) {
                
set_user_gravity(i,fgravity)
                
//client_print(i,print_chat,"[ProKreedz] Admin %s has set your gravity to %d",name,gravity)
                
set_hudmessage(i0255, -1.0, -1.006.05.0)
                
show_hudmessage(i"Admin %s has set your gravity to %d",name,gravity)
                if(
fgravity != 1.0)
                    
detect_cheat(i,"Gravity")
            }
        }
    }
    else {
        new 
target cmd_target(0,szarg1,2)
        if(
target 0) {
            
set_user_gravity(target,fgravity)
            
//client_print(target,print_chat,"[ProKreedz] Admin %s has set your gravity to %d",name,gravity)
            
set_hudmessage(id1382320.030.806.03.0)
            
show_hudmessage(target"Admin %s has set your gravity to %d",name,gravity)
            if(
fgravity != 1.0)
                
detect_cheat(target,"Gravity")
        }
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public admin_laser(id,level,cid) {
    if(!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED
    
    
new colors[3]
    if(
read_argc() > 1) {
        new 
szcolor[8]
        
read_argv(1,szcolor,8)
        if(
equal(szcolor,"red"))
            
colors = {255,0,0}
        else if(
equal(szcolor,"blue"))
            
colors = {0,0,255}
        else if(
equal(szcolor,"yellow"))
            
colors = {255,255,0}
        else if(
equal(szcolor,"orange"))
            
colors = {255,150,0}
        else if(
equal(szcolor,"green"))
            
colors = {0,255,0}
        else
            
colors = {255,255,255}
    }
    else
        
colors = {255,255,255}
    
    new 
origin[3], aimorigin[3]
    
get_user_origin(id,origin)
    
get_user_origin(id,aimorigin,3)
    
    
message_begin(MSG_ALL,SVC_TEMPENTITY)
    
write_byte(0)            // TE_BEAMPOINTS
    
write_coord(origin[0])        // start point
    
write_coord(origin[1])
    
write_coord(origin[2])
    
write_coord(aimorigin[0])    // end point
    
write_coord(aimorigin[1])
    
write_coord(aimorigin[2])
    
write_short(Sbeam)        // sprite to draw (precached below)
    
write_byte(0)            // starting frame
    
write_byte(0)            // frame rate
    
write_byte(100)            // life in 0.1s
    
write_byte(3)            // line width in 0.1u
    
write_byte(0)            // noise in 0.1u
    
write_byte(colors[0])        // R
    
write_byte(colors[1])        // G
    
write_byte(colors[2])        // B
    
write_byte(200)            // brightness
    
write_byte(2)            // scroll speed
    
message_end()
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================
// Events / Forwards
// =================================================================================================

public resethud(id) {
    if(
get_pcvar_num(kz_godmode) == 1)
        
set_user_godmode(id,1)
    else
        
set_user_godmode(id)
    
    if(
get_pcvar_num(kz_scout) == && !user_has_weapon(id,CSW_SCOUT))
        
give_item(id,"weapon_scout")
    if(!
user_has_weapon(id,CSW_KNIFE))
        
give_item(id,"weapon_knife")
    
    
glow(id)
    
    
cs_set_user_nvg(id)
    
    if(
firstspawn[id-1]) {
        
//client_print(id,print_chat,"[ProKreedz] Type '.menu' to open the menu")
        
if(get_pcvar_num(kz_checkpoints) == 1) {
            
//client_print(id,print_chat,"[ProKreedz] Type '.cp' to create a checkpoint and '.tp' to go to your last one")
            
set_hudmessage(id1382320.030.806.03.0)
            
show_hudmessage(id"Type '.cp' to create a checkpoint and '.tp' to go to your last one")
        
        } else {
            
//client_print(id,print_chat,"[ProKreedz] Checkpoints are disabled")
            
set_hudmessage(id1382320.030.806.03.0)
            
show_hudmessage(id"Checkpoints are disabled")
        }
    }
    
firstspawn[id-1] = false
}

// =================================================================================================

public client_disconnect(id) {
    
checkpointnum[id-1] = 0
    needhelp
[id-1] = false
    helpcount
[id-1] = 0
    
    timer_started
[id-1] = false
    showtimer
[id-1] = true;
    
    
usedbutton[id-1] = false
    firstspawn
[id-1] = true
    
    bhop
[id-1] = 0
    
    noblock
[id-1] = true
}

public 
client_putinserver(id) {
    
checkpointnum[id-1] = 0
    needhelp
[id-1] = false
    helpcount
[id-1] = 0
    
    timer_started
[id-1] = false
    showtimer
[id-1] = true;
    
    
usedbutton[id-1] = false
    firstspawn
[id-1] = true
    
    bhop
[id-1] = 0
    
    noblock
[id-1] = true
}

// =================================================================================================

public deathmsg() {
    new 
victim read_data(2)
    
set_task(0.5,"respawn",100+victim)
}

// =================================================================================================
// Menu
// =================================================================================================

public kz_menu(id) {
    new 
menu[512], szbhop[64], sznoblock[64]
    
    if(
get_pcvar_num(kz_semiclip) == -1)
        
format(sznoblock,64,"\r01. Semiclip disabled by server\w")
    else if(
get_pcvar_num(kz_semiclip) == 1)
        
format(sznoblock,64,"\r01. Semiclip enabled by server\w")
    else {
        if(
noblock[id-1])
            
format(sznoblock,64,"\w01. Semiclip\w")
        else
            
format(sznoblock,64,"\d01. Semiclip\w")
    }
    
// muh
    
if(get_pcvar_num(kz_bhop) == 0)
        
format(szbhop,64,"\r03. Bhop disabled by server\w")
    else if(
get_pcvar_num(kz_bhop) == 1) {
        if(
bhop[id-1] == 0)
            
format(szbhop,64,"\d03. Bhop\w")
        else
            
format(szbhop,64,"\w03. Bhop - No Slowdown\w")
    }
    else if(
get_pcvar_num(kz_bhop) == 2) {
        if(
bhop[id-1] == 2)
            
format(szbhop,64,"\w03. Bhop - Autojump\w")
        else if(
bhop[id-1] == 1)
            
format(szbhop,64,"\w03. Bhop - No Slowdown\w")
        else
            
format(szbhop,64,"\d03. Bhop\w")
    }
    
    
format(menu,512,"^n^n^n\yProKreedz by p4ddY^n^n%s^n%s^n%s^n^n04. Respawn^n05. Reset^n^n00. Close",sznoblock,showtimer[id-1] ? "\w02. Show Timer" "\d02. Show Timer\w",szbhop)
    
show_menu(id,MENU_KEYS,menu)
}

public 
menu_handler(id,key) {
    switch(
key) {
        case 
0:{
            if(
get_pcvar_num(kz_semiclip) != -&& get_pcvar_num(kz_semiclip) != 1)
                
noblock[id-1] = (noblock[id-1] == false)
            
            
kz_menu(id)
        }
        case 
1:{
            
showtimer[id-1] = (showtimer[id-1] == false)
            
kz_menu(id)
        }
        case 
2:{
            if(
get_pcvar_num(kz_bhop) == 1) {
                if(
bhop[id-1] == 0)
                    
bhop[id-1] = 1
                
else
                    
bhop[id-1] = 0
            
}
            else if(
get_pcvar_num(kz_bhop) == 2) {
                if(
bhop[id-1] == 0)
                    
bhop[id-1] = 1
                
else if(bhop[id-1] == 1)
                    
bhop[id-1] = 2
                
else
                    
bhop[id-1] = 0
            
}
            
kz_menu(id)
        }
        case 
3:{
            
respawn(id)
        }
        case 
4:{
            
reset_checkpoints(id)
        }
        case 
9:{
            
show_menu(id,0,"")
        }
    }
}

// =================================================================================================

public kz_menu_admin_show(id,level,cid) {
    if(!
cmd_access(id,level,cid,2))
        return 
PLUGIN_HANDLED
    
    kz_menu_admin
(id)
    
    return 
PLUGIN_HANDLED
}

public 
kz_menu_admin(id) {
    new 
menu[512], szcheckpoints[32], szgodmode[32], szhelp[32], szscout[32], szadminglow[32], sznoblock[32], sztransparency[32], szcheatdetect[32], szbhop[32]
    
// this is the onliest fucking way.. else pawn tells me that the line is too long :o
    
    
if(get_pcvar_num(kz_checkpoints) == 1)
        
format(szcheckpoints,32,"\w01. Checkpoints\w")
    else
        
format(szcheckpoints,32,"\r01. Checkpoints\w")
    
    if(
get_pcvar_num(kz_godmode) == 1)
        
format(szgodmode,32,"\w02. Godmode\w")
    else
        
format(szgodmode,32,"\r02. Godmode\w")
    
    if(
get_pcvar_num(kz_help) == 1)
        
format(szhelp,32,"\w03. Help\w")
    else
        
format(szhelp,32,"\r03. Help\w")
    
    if(
get_pcvar_num(kz_scout) == 1)
        
format(szscout,32,"\w04. Scout\w")
    else
        
format(szscout,32,"\r04. Scout\w")
    
    if(
get_pcvar_num(kz_adminglow) == 1)
        
format(szadminglow,32,"\w05. Adminglow\w")
    else
        
format(szadminglow,32,"\r05. Adminglow\w")
    
    if(
get_pcvar_num(kz_semiclip) == -1)
        
format(sznoblock,32,"\r06. Semiclip\w")
    else if(
get_pcvar_num(kz_semiclip) == 1)
        
format(sznoblock,32,"\w06. Semiclip\w")
    else
        
format(sznoblock,32,"\w06. Semiclip - Client\w")
    
    if(
get_pcvar_num(kz_bhop) == 0)
        
format(szbhop,32,"\r07. Bhop\w")
    else if(
get_pcvar_num(kz_bhop) == 1)
        
format(szbhop,32,"\w07. Bhop - No Slowdown\w")
    else if(
get_pcvar_num(kz_bhop) == 2)
        
format(szbhop,32,"\w07. Bhop - Autojump\w")
    
    if(
get_pcvar_num(kz_transparency) == 1)
        
format(sztransparency,32,"\w08. Transparency\w")
    else
        
format(sztransparency,32,"\r08. Transparency\w")
    
    if(
get_pcvar_num(kz_cheatdetect) == 1)
        
format(szcheatdetect,32,"\w09. Cheatdetect\w")
    else
        
format(szcheatdetect,32,"\r09. Cheatdetect\w")
    
    
format(menu,512,"^n^n^n\yProKreedz by p4ddY - Adminmenu^n^n%s^n%s^n%s^n%s^n%s^n%s^n%s^n%s^n%s^n^n00. Close",szcheckpoints,szgodmode,szhelp,szscout,szadminglow,sznoblock,szbhop,sztransparency,szcheatdetect)
    
show_menu(id,MENU_KEYS_ADMIN,menu)
}

public 
menu_handler_admin(id,key) {
    switch(
key) {
        case 
0:{
            if(
get_cvar_num("kz_checkpoints") == 0) {
                
set_cvar_num("kz_checkpoints",1)
                
//client_print(0,print_chat,"[ProKreedz] Checkpoints are enabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Checkpoints are enabled now")
                
//client_print(0,print_chat,"[ProKreedz] Type '.cp' to create a checkpoint and '.tp' to go to your last one")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Type '.cp' to create a checkpoint and '.tp' to go to your last one")
            }
            else {
                
set_cvar_num("kz_checkpoints",0)
                
//client_print(0,print_chat,"[ProKreedz] Checkpoints are disabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Checkpoints are disabled now")
                
            }
            
kz_menu_admin(id)
        }
        case 
1:{
            if(
get_cvar_num("kz_godmode") == 0) {
                
set_cvar_num("kz_godmode",1)
                
//client_print(0,print_chat,"[ProKreedz] Godmode is enabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Godmode is enabled now")
                
                for(new 
i=1;i<=get_maxplayers();i++) {
                    if(
is_user_connected(i))
                        
set_user_godmode(id,1)
                }
            }
            else {
                
set_cvar_num("kz_godmode",0)
                
//client_print(0,print_chat,"[ProKreedz] Godmode is disabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Godmode is disabled now")
                
                for(new 
i=1;i<=get_maxplayers();i++) {
                    if(
is_user_connected(i))
                        
set_user_godmode(id,0)
                }
            }
            
kz_menu_admin(id)
        }
        case 
2:{
            if(
get_cvar_num("kz_help") == 0) {
                
set_cvar_num("kz_help",1)
                
//client_print(0,print_chat,"[ProKreedz] Backup is enabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Backup is enabled now")
                
//client_print(0,print_chat,"[ProKreedz] Type '.help' if you need help")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Type '.help' if you need help")
                for(new 
i=1;i<=get_maxplayers();i++) {
                    if(
is_user_connected(i))
                        
glow(i)
                }
            }
            else {
                
set_cvar_num("kz_help",0)
                
//client_print(0,print_chat,"[ProKreedz] Backup is disabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Backup is disabled")
                for(new 
i=1;i<=get_maxplayers();i++) {
                    if(
is_user_connected(i))
                        
glow(i)
                }
            }
            
kz_menu_admin(id)
        }
        case 
3:{
            if(
get_cvar_num("kz_scout") == 0) {
                
set_cvar_num("kz_scout",1)
                
//client_print(0,print_chat,"[ProKreedz] You will get a scout after respawn")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"You will get a scout after respawn")
            }
            else {
                
set_cvar_num("kz_scout",0)
                
//client_print(0,print_chat,"[ProKreedz] You will no longer get a scout")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"You will no longer get a scout")
            }
            
kz_menu_admin(id)
        }
        case 
4:{
            if(
get_cvar_num("kz_adminglow") == 0) {
                
set_cvar_num("kz_adminglow",1)
                
//client_print(0,print_chat,"[ProKreedz] Admins glow green now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Admins glow now")
                
                for(new 
i=1;i<=get_maxplayers();i++) {
                    if(
is_user_connected(i))
                        
glow(i)
                }
            }
            else {
                
set_cvar_num("kz_adminglow",0)
                
//client_print(0,print_chat,"[ProKreedz] Admins are no longer glowing")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Admins are no longer glowing")
                
                for(new 
i=1;i<=get_maxplayers();i++) {
                    if(
is_user_connected(i))
                        
glow(i)
                }
            }
            
kz_menu_admin(id)
        }
        case 
5:{
            if(
get_cvar_num("kz_semiclip") == -1) {
                
set_cvar_num("kz_semiclip",0)
                
//client_print(0,print_chat,"[ProKreedz] Semiclip is enabled now. Type '.menu' to enable/disable it")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Semiclip is enabled now")
            }
            else if(
get_cvar_num("kz_semiclip") == 0) {
                
set_cvar_num("kz_semiclip",1)
                
//client_print(0,print_chat,"[ProKreedz] Semiclip is enabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Semiclip is enabled now")
            }
            else {
                
set_cvar_num("kz_semiclip",-1)
                
//client_print(0,print_chat,"[ProKreedz] Semiclip is disabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Semiclip is disabled now")
            }
            
kz_menu_admin(id)
        }
        case 
6:{
            if(
get_cvar_num("kz_bhop") == 0) {
                
set_cvar_num("kz_bhop",1)
                
//client_print(0,print_chat,"[ProKreedz] Bhop (No Slowdown) is enabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Bhop (No Slowdown) is enabled now")
            }
            else if(
get_cvar_num("kz_bhop") == 1) {
                
set_cvar_num("kz_bhop",2)
                
//client_print(0,print_chat,"[ProKreedz] Bhop (Autojump) is enabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Bhop (Autojump) is enabled now")
            }
            else {
                
set_cvar_num("kz_bhop",0)
                
//client_print(0,print_chat,"[ProKreedz] Bhop is disabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Bhop is disabled now")
            }
            
kz_menu_admin(id)
        }
        case 
7:{
            if(
get_cvar_num("kz_transparency") == 0) {
                
set_cvar_num("kz_transparency",1)
                
//client_print(0,print_chat,"[ProKreedz] If someone activates semiclip he will be transparent")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"If someone activates semiclip he will be transparent")
            }
            else {
                
set_cvar_num("kz_transparency",0)
                
//client_print(0,print_chat,"[ProKreedz] If someone activates semiclip he won't appear transparent any longer")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"If someone activates semiclip he won't appear transparent any longer")
            }
            
kz_menu_admin(id)
        }
        case 
8:{
            if(
get_cvar_num("kz_cheatdetect") == 0) {
                
set_cvar_num("kz_cheatdetect",1)
                
//client_print(0,print_chat,"[ProKreedz] Anti-Cheat is enabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Anti-Cheat is enabled now")
            }
            else {
                
set_cvar_num("kz_cheatdetect",0)
                
//client_print(0,print_chat,"[ProKreedz] Anti-Cheat is disabled now")
                
set_hudmessage(00255, -1.0, -1.006.05.0)
                
show_hudmessage(0"Anti-Cheat is disabled now")
            }
            
kz_menu_admin(id)
        }
        case 
9:{
            
show_menu(id,0,"")
        }
    }
}

// =================================================================================================
// Timersystem
// =================================================================================================

public client_PreThink(id) {
    if(
get_pcvar_num(kz_bhop) > && bhop[id-1] > 0)
        
entity_set_float(id,EV_FL_fuser2,0.0)
    
    new 
buttons get_user_button(id)
    
    if(
get_pcvar_num(kz_bhop) == && bhop[id-1] == 2) {
        if(
buttons&IN_JUMP) { // Credits to ts2do (cs13 plugin)
            
new flags entity_get_int(id,EV_INT_flags)
            if(
flags&FL_ONGROUND && flags|FL_WATERJUMP && entity_get_int(id,EV_INT_waterlevel)<2) {
                new 
Float:velocity[3]
                
entity_get_vector(id,EV_VEC_velocity,velocity)
                
velocity[2] += 260.0
                entity_set_vector
(id,EV_VEC_velocity,velocity)
                
entity_set_int(id,EV_INT_gaitsequence,6// Play the Jump Animation
            
}
        }
    }
    
    if(
buttons&IN_USE) {
        if(!
usedbutton[id-1]) {
            new 
aimidbody
            
if(get_user_aiming(id,aimid,body) != 0.0) {
                new 
Float:origin[3]
                
entity_get_vector(id,EV_VEC_origin,origin)
                if(
find_ent_in_sphere(aimid-1,origin,BUTTON_DISTANCE) == aimid) { // This sucks, but i was not able, to get EV_VEC_origin of the button
                    
new entname[32]
                    
entity_get_string(aimid,EV_SZ_target,entname,32)
                    
//client_print(id,print_chat,"[Debug] Entityname: %s",entname)
                    
if((equal(entname,"counter_start") || equal(entname,"clockstartbutton") || equal(entname,"firsttimerelay")) && reset_checkpoints(id) && !timer_started[id-1]) { // Man hat den Startbutton gedrueckt
                        
if(checkpointnum[id-1] < 1) {
                            new 
bool:clean true
                            
if(get_pcvar_num(kz_cheatdetect) == 1) {
                                if(
get_user_noclip(id) == 1) {
                                    
//client_print(id,print_chat,"[ProKreedz] You can not start the timer because of noclip")
                                    
set_hudmessage(id0255, -1.0, -1.006.05.0)
                                    
show_hudmessage(id"You can not start the timer because of noclip")
                                    
clean false
                                
}
                                else if(
get_user_gravity(id) != 1.0) {
                                    
//client_print(id,print_chat,"[ProKreedz] You can not start the timer because of gravity")
                                    
set_hudmessage(id0255, -1.0, -1.006.05.0)
                                    
show_hudmessage(id"You can not start the timer because of gravity")
                                    
clean false
                                
}
                                else { 
// Now we check, whether the client uses hook or is grabbed :o
                                    
if(callfunc_begin("is_hooked","prokreedz_hook.amxx") == 1) {
                                        
callfunc_push_int(id)
                                        if(
callfunc_end()) {
                                            
clean false
                                            
//client_print(id,print_chat,"[ProKreedz] You can not start the timer because of hook")
                                            
set_hudmessage(id0255, -1.0, -1.006.05.0)
                                            
show_hudmessage(id"You can not start the timer because of hook")
                                        }
                                    }
                                    else if(
callfunc_begin("is_user_grabbed","prokreedz_grab.amxx") == 1) { // maybe it doesn't work Oo
                                        
callfunc_push_int(id)
                                        if(
callfunc_end() != -1) {
                                            
clean false
                                            
//client_print(id,print_chat,"[ProKreedz] You can not start the timer because of grab")
                                            
set_hudmessage(id0255, -1.0, -1.006.05.0)
                                            
show_hudmessage(id"You can not start the timer because of grab")
                                        }
                                    }
                                }
                            }
                            if(
clean) {
                                
//client_print(id,print_chat,"[ProKreedz] Timer started, let's go :)")
                                
set_hudmessage(id0255, -1.0, -1.006.05.0)
                                
show_hudmessage(id"Timer started")
                                
timer_started[id-1] = true
                                timer_time
[id-1] = get_systime()
                            }
                        }
                        else {
                            
//client_print(id,print_chat,"[ProKreedz] You already created checkpoints. Type '.reset' to reset them")
                            
set_hudmessage(id0255, -1.0, -1.006.05.0)
                            
show_hudmessage(id"GO! GO! GO!")
                        }
                    }
                    if((
equal(entname,"counter_off") || equal(entname,"clockstopbutton") || equal(entname,"clockstop")) && timer_started[id-1]) { // Man hat den Stopbutton gedrueckt
                        
new name[32], imin
                        get_user_name
(id,name,32)
                        
//format_time(sztime,16,"%M:%S",get_systime() - timer_time[id-1]) this sucks!
                        
new kreedztime get_systime() - timer_time[id-1]
                        if((
kreedztime 60.0) >= 1) {
                            
imin floatround(kreedztime 60.0,floatround_floor)
                            
kreedztime -= (floatround(kreedztime 60.0,floatround_floor) * 60)
                        }
                        
                        
client_print(0,print_chat,"[ProKreedz] %s has been reached the target in %d minutes and %d seconds with %d checkpoint%s.",name,imin,kreedztime,checkpointnum[id-1],checkpointnum[id-1] == "" "s"// kreedztime ist in diesem Fall die uebrigen Sekunden
                        
timer_started[id-1] = false
                        topten_update
(id)
                    }
                }
            }
            
usedbutton[id-1] = true
        
}
    }
    else
        
usedbutton[id-1] = false
}

// =================================================================================================
// Top10
// =================================================================================================

getTopTenPlace(id) {
    
    new 
currentMap[32];
    
get_mapname(currentMap32);
    
    new 
topTenVault[64];
    
format(topTenVault64"pk_%s"currentMap);
    
    new 
kzTime;
    
kzTime get_systime() - timer_time[id-1];
    
    new 
vault nvault_open(topTenVault);
    new 
vaultKey[8];
    new 
vaultReturn[128];
    new 
arg1[32], arg2[8];
    
    new 
ret;
    
    if(
vault != INVALID_HANDLE) {
        
        for(new 
1<= 10i++) {
            
            
format(vaultKey8"%d"i);
            
            
nvault_get(vaultvaultKeyvaultReturn128);
            
            if(
parse(vaultReturnarg132arg28) != 0) {
                
                if(
kzTime str_to_num(arg2)) {
                    
                    
ret i;
                    break;
                    
                    } else {
                    
                    
ret 0;
                    
                }
                
                } else {
                
                
ret i;
                break;
                
            }
            
        }
        
    }
    
    
nvault_close(vault);
    
    return 
ret;
}

// ==================

isPlayerInTopTen(id) {
    
    new 
userName[32];
    
get_user_name(iduserName32);
    
    new 
currentMap[32];
    
get_mapname(currentMap32);
    
    new 
topTenVault[64];
    
format(topTenVault64"pk_%s"currentMap);
    
    new 
vault nvault_open(topTenVault);
    new 
vaultKey[8];
    new 
vaultReturn[128];
    new 
arg1[32], arg2[8];
    
    new 
ret;
    
    if(
vault != INVALID_HANDLE) {
        
        for(new 
1<= 10i++) {
            
            
format(vaultKey8"%d"i);
            
            
nvault_get(vaultvaultKeyvaultReturn128);
            
            if(
parse(vaultReturnarg132arg28) != && equal(userNamearg1)) {
                
                
ret i;
                break;
                
                } else {
                
                
ret 0;
                
            }
            
        }
        
    }
    
    
nvault_close(vault);
    
    return 
ret;
}

// ==================

showTime(idnewPlace) {
    
    new 
userName[32];
    
get_user_name(iduserName32);
    
    new 
kzTime;
    
kzTime get_systime() - timer_time[id-1];
    
    new 
minutesseconds
    
    
if((kzTime 60.0) >= 1) {
        
        
minutes floatround(kzTime 60.0,floatround_floor);
        
kzTime -= (floatround(kzTime60.0,floatround_floor) * 60);
        
seconds kzTime;
        
        } else {
        
        
minutes 0;
        
seconds kzTime;
        
    }
    
    
set_hudmessage(255255255, -1.0, -1.0);
    
    if(
newPlace == 1) {
        
        
show_hudmessage(0"%s finished the map in %d min %d sec and established a new record"userNameminutesseconds);
        
        } else if(
newPlace == 0) {
        
        
show_hudmessage(0"%s finished the map in %d min %d sec"userNameminutesseconds);
        
        } else {
        
        
show_hudmessage(0"%s finished the map in %d min %d sec and established a new Top10 time"userNameminutesseconds);
        
    }
    
}

// ==================

public topten_update(id) {
    
    new 
newPlace getTopTenPlace(id);
    
    new 
oldPlace isPlayerInTopTen(id);
    
    new 
userName[32];
    
get_user_name(iduserName32);
    
    new 
currentMap[32];
    
get_mapname(currentMap32);
    
    new 
kzTime;
    
kzTime get_systime() - timer_time[id-1];
    
    new 
vaultEntry[128];
    
format(vaultEntry128"^"%s^" ^"%d^" ^"%d^""userNamekzTimecheckpointnum[id-1]);
    
    new 
topTenVault[64];
    
format(topTenVault64"pk_%s"currentMap);
    
    new 
vault nvault_open(topTenVault);
    
    if(
oldPlace 0) {
        
        if(
newPlace ) {
            
            new 
key[8];
            
            if(
newPlace oldPlace) {
                
                
format(key8"%d"oldPlace);
                
nvault_remove(vaultkey);
                
                for(new 
oldPlace10i++) {
                    
                    new 
temp[128], tempKey[8]
                    
format(tempKey,8,"%d",i+1)
                    
nvault_get(vault,tempKey,temp,128)
                    
                    if(!
equal(temp,"")) {
                        
format(tempKey,8,"%d",i)
                        
nvault_pset(vault,tempKey,temp)
                    }
                    
                }
                
                for(new 
10newPlacei--) {
                    
                    new 
temp[128], tempKey[8]
                    
format(tempKey,8,"%d",i-1)
                    
nvault_get(vault,tempKey,temp,128)
                    
                    if(!
equal(temp,"")) {
                        
format(tempKey,8,"%d",i)
                        
nvault_pset(vault,tempKey,temp)
                    }
                    
                }
                
                
format(key8"%d"newPlace);
                
nvault_pset(vaultkeyvaultEntry);
                
                } else if(
newPlace == oldPlace) {
                
                
format(key8"%d"oldPlace);
                
nvault_remove(vaultkey);
                
format(key8"%d"newPlace);
                
nvault_pset(vaultkeyvaultEntry);
                
            }
            
            
showTime(idnewPlace);
            
            
        }
        
        } else {
        
        if(
newPlace 0) {
            
            for(new 
10newPlacei--) {
                
                new 
temp[128], tempKey[8]
                
format(tempKey,8,"%d",i-1)
                
nvault_get(vault,tempKey,temp,128)
                
                if(!
equal(temp,"")) {
                    
format(tempKey,8,"%d",i)
                    
nvault_pset(vault,tempKey,temp)
                }
                
            }
            
            new 
key[8];
            
            
format(key8"%d"newPlace);
            
nvault_pset(vaultkeyvaultEntry);
            
            
showTime(idnewPlace);
            
        }
        
    }
    
    
nvault_close(vault);
    
}

public 
topten_show(id) {
    new 
motd[2048]
    new 
szvault[64], szmap[32]
    
get_mapname(szmap,32)
    
format(szvault,64,"pk_%s",szmap)
    
    new 
vault nvault_open(szvault)
    if(
vault != -1) {
        
add(motd,2048,"<html><head><style>")
        
add(motd,2048,"body { background-color:#000000; font-family:Tahoma; font-size:10px; color:#FFFFFF; }")
        
add(motd,2048,".tabel { border-style:solid; border-width:1px; border-color:#FFFFFF; font-family:Tahoma; font-size:10px; color:#FFFFFF; }")
        
add(motd,2048,".header { background-color:#292929; font-family:Tahoma; font-size:10px; color:#FFFFFF; font-weight:800; }")
        
add(motd,2048,"</style></head><body>")
        
add(motd,2048,"<br><br><table border=0 cellspacing=0 cellpadding=1 width=90% align=center class=tabel>")
        
        
add(motd,2048,"<tr><td class=header>#</td><td class=header>Name</td><td class=header>Time</td><td class=header>Checkpoints</td></tr>")
        new 
szkey[8]
        for(new 
i=1;i<=10;i++) {
            new 
szreturn[128]
            
format(szkey,8,"%d",i)
            
nvault_get(vault,szkey,szreturn,128)
            
            new 
arg1[32], arg2[8], arg3[8]
            if(
parse(szreturn,arg1,32,arg2,8,arg3,8) != 0) {
                new 
sztime[32]
                new 
iminkreedztime str_to_num(arg2)
                if((
kreedztime 60.0) >= 1) {
                    
imin floatround(kreedztime 60.0,floatround_floor)
                    
kreedztime -= (floatround(kreedztime 60.0,floatround_floor) * 60)
                }
                
format(sztime,32,"%d minutes and %d seconds",imin,kreedztime)
                
add(motd,2048,"<tr><td>")
                
add(motd,2048,szkey)
                
add(motd,2048,"</td><td>")
                
add(motd,2048,arg1)
                
add(motd,2048,"</td><td>")
                
add(motd,2048,sztime)
                
add(motd,2048,"</td><td>")
                
add(motd,2048,arg3)
                
add(motd,2048,"</td></tr>")
            }
        }
        
        
nvault_close(vault)
        
        
add(motd,2048,"</table></body></html>")
        
show_motd(id,motd,"ProKreedz Top10")
    }
}

// You reached the end of file
// This plugin was made by p4ddY :) 
__________________
xPaw 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 16:57.


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