Jump to content
GIGN Forum

Recommended Posts

Nu šodien sadūšojos... bija labs garastāvoklis... un visu dienu nosēdēju pie plugina taisīšanas... psc... itkā strāda, bet tāda laža... :D

Shine tu tur kārtīgi visu pārbaudi un uzraksti, kur vajag pielabot, a to es protu visādus failus taisīt :)

tatad iekopejiet amxx.cfg:

// Counter-Strike monitor cvars

monitor_host localhost

monitor_uname pararam

monitor_upw pararam

monitor_dbname monitor

talak izveidojam datubazi:

71704413.png

iemetam pluginu... web failus attiecigi tur kur vajag un priecajamies... taja web part tika paradits, kas var tikt izvilkts, es neesmu nekads uber php ' eists (amxx ari svaki), bet php dalu taisiet pashi savus leetiskos skriptus :D ja kadam nebus zel, var izlikt savu web part skriptu...

a ja... vins adminus, kuriem ir ban acc uzrada zala krasa... to var izmainit sma faila (negribeju taisit cvaru)

#define ADMINCOLOR "green"

ja gribat nomainit krasu, tad skatieties, lai ta nebutu nebutu sarkana/zila/peleka, jo es to izmantoju web parta, lai apzimetu komandu... bet to var nonemt... karoch taisiet ka gribat... ja ir kadas kludas @ amxx part, sakiet

nu ta apmeram izskatas web part...

59202347.png

55002355.png

karoch, Shine apskati kodu :D

Edited by remix.cc
Link to comment
Share on other sites

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

Tu esi kekss, taču kodē saprotamāk, taisi atstarpes, netaisi jaunus globālos mainīgos koda vidū, mans method tev negāja, JO:

PHP

if(is_user_connected(i) || !is_user_bot(i) || !is_user_hltv(i))

>>

PHP

if(is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i))

Karoče, es nemeklēšu neko, ko optimizēt līdz tu neuzkodēsi visu smuki, lai var salasīt.

Edited by shine
Link to comment
Share on other sites

vispar nav nevajag && ... man vajag or... es nezinu, ka hltv var but gan hltv, gan bots un bots, gan bots gan hltv :D

tavs kods man negaja citu iemeslu del... tur saka viskautkadi sudi list lauka... tapec labak uzreiz player panemu... varbut velak to vietu paskatishos...

a un cmon... es kodeju saprotamak neka tu :D tu jau visu salaid viena chupa, ka neko nevar saprast :D:D:D

bet ok... kadam vispar plugins strada?

Link to comment
Share on other sites

PHP

if(is_user_connected(i) && !is_user_hltv(i) && !is_user_bot(i)) 

=

Ja(spēlētājs ir piekonektējies UN ja spēlētājs !NAV hltv UN ja spēlētājs !NAV bots)

Pameklē arī to par MAXPLAYERS. Mācies saprotami kodēt - mans pēdējais plugins(tur viss kods ir vienā čupā?):

/*
Current Version: 0.7.0

- Description -

This plugin tries to simulate Counter-Strike: CZ singleplayer Career missions.
Imagine, now you can complete them in both Counter-Strike 1.6 and Condition Zero multiplayer!
You start at level 1. Every level missions get harder and harder.
As you gain levels you unlock new types of missions. Your level and current mission is automatically
saved and loaded on connect and disconnect. There is no max level where you have to stop and restart over.
To simulate CZ for CS 1.6 i made tutor support, it looks awesome. This plugin supports players without
tutor in CS 1.6 after the first connect. It'll show mission info in status text and chat messages.

- Missions -

There are five mission types for now:

* Kill players
* Plant bombs
* Defuse bombs
* Rescue Hostages
* Win rounds

There are several conditions for missions:

* Headshot - You must complete your mission killing players only in head. Only for Kill missions.
* Weapon - You must kill your enemies with a specific weapon. Only for Kill missions.
* In one round - You must do your mission in one round. Only for Kill and Hostage missions.
Sometimes you'll need to do one round missions several times to complete the actual mission.
* Survive - You must complete the mission and survive the round to fully complete the mission.
For every mission except win and defuse.
* Time - You must complete your mission in time. For all missions.

Conditions can be combined to make a different mission every time.

- Cvars -

amx_czsm_save_by < 1 / 2 > < 1 - IP | 2 - Steam ID. > < Def: 1 >
amx_czsm_use_tutor < 1 / 0 > < Use CZ Tutor. Note that players connecting first time without
Tutor in CS 1.6 wont see it until he restarts cs and connects to your server again. > < Def: 1 >

amx_czsm_min_kill_level < ## > < Min level for killing missions to become available to players.
I strongly suggest you to leave this to one, or if you change it
then change another missions type minimal level to 1. > < Def: 1 >
amx_czsm_min_killweapon_level < ## > < Min level for killing with weapons to become available to players. > < Def: 5 >
amx_czsm_min_plant_level < ## > < Min level for planting missions to become available to players. > < Def: 3 >
amx_czsm_min_defuse_level < ## > < Min level for defusing missions to become available to players. > < Def: 3 >
amx_czsm_min_win_level < ## > < Min level for winning missions to become available to players. > < Def: 7 >
amx_czsm_min_hostage_level < ## > < Min level for hostage rescuing missions to become available to players. > < Def: 10 >

amx_czsm_min_hs_level < ## > < Min level for headshot missions to become available to players. > < Def: 5 >
amx_czsm_min_round_level < ## > < Min level for round missions to become available to players. > < Def: 10 >
amx_czsm_min_survive_level < ## > < Min level for survive missions to become available to players. > < Def: 15 >
amx_czsm_min_time_level < ## > < Min level for time missions to become available to players. > < Def: 20 >

amx_czsm_roundtime_step < ## > < Time step for time missions. If timestep is 60 you can only get
time missions with times like - 60, 120, 180, 240.. etc. > < Def: 60 >

amx_czsm_max_in_round < 0 / ## > < Max players you have to shoot in one round.
Leave 0 to automatically set it to half of server maxplayer limit. 
If you have 16 slots and it's set to 0, you can have max 8 kills in one round for missions,
but if there less than 8 players on your opposing team, you cannot complete your mission. > < Def: 5 >

amx_czsm_autocorrect_missions < 0 / 1 > < If you join a cs_ map and your last mission was to defuse a bomb you'll
be given a new mission if this is set to 1. > < Def: 0 >

- Super Health, Gravity and Speed upgrades for levels -

I'm afraid - none.

- Future Upgrades -

MySQL and VIP escape and ES_ mission types. Maybe some more conditions for missions. NO ML.

- ScreenShots -

[url=http://img145.imageshack.us/img145/1460/czscr1.jpg]http://img145.imageshack.us/img145/1460/czscr1.jpg[/url]
[url=http://img141.imageshack.us/img141/4311/czscr2.jpg]http://img141.imageshack.us/img141/4311/czscr2.jpg[/url]
[url=http://img230.imageshack.us/img230/6761/czscr3.jpg]http://img230.imageshack.us/img230/6761/czscr3.jpg[/url]
[url=http://img228.imageshack.us/img228/1327/czscr4.jpg]http://img228.imageshack.us/img228/1327/czscr4.jpg[/url]
[url=http://img27.imageshack.us/img27/4048/czscr5.jpg]http://img27.imageshack.us/img27/4048/czscr5.jpg[/url]

- Change Log -

0.7.0
* Initial Release

*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <nvault>

#define VERSION    "0.7.0"

//Maxplayers
#define MAXPLAYERS 32 + 1

//Mission Types
#define MISSIONS 6

//Weapons
#define WEAPONS 30

//Sounds
#define SOUNDS 3

//Param count
#define MAXPARAMS 10

//Player tasks
#define TASK_TUTOR 1111
#define TASK_MISSION 2222

//Global Tasks
#define TASK_CHECKTIME 999990

//Map Types
#define MAP_DE (1<<1)
#define MAP_CS (1<<2)

//Difficulty
#define DIFFICULTY_VERYEASY 0.25
#define DIFFICULTY_EASY 0.5
#define DIFFICULTY_EASYNORMAL 0.75
#define DIFFICULTY_NORMAL 1.0
#define DIFFICULTY_HARDNORMAL 1.5
#define DIFFICULTY_HARD 2.0

//Cs Teams
enum
{
    TEAM_UNASS,
    TEAM_T,
    TEAM_CT,
    TEAM_SPEC
}

//Mission Types
enum
{
    KILL_NORMAL,
    KILL_WEAPON,
    PLANT,
    DEFUSE,
    WIN,
    HOSTAGE
}

//Params
enum
{
    PARAM_PLAYER,
    PARAM_CONST,
    PARAM_WEAPON,
    PARAM_HS,
    PARAM_ROUND,
    PARAM_SURVIVE,
    PARAM_TIME,
    PARAM_TIMEAMT,
    PARAM_ROUNDTIMES,
    PARAM_ROUNDTIME_COUNT
}

//Min & Max param
enum
{
    Float:PARAM_MIN,
    Float:PARAM_MAX
}

//Tutor color
enum
{
    RED = 1,
    BLUE,
    YELLOW,
    GREEN
}

//Mission status
enum
{
    STATUS_NORMAL,
    STATUS_FAILED
}

//Sounds
enum
{
    SOUND_LVLUP,
    SOUND_OBJ,
    SOUND_FAILED
}

//Mission description. Used to make missions TutorMsg/Chat Msg
new const g_MissionDesc[MISSIONS][] = { 
    "Kill enemies",
    "Kill enemies with",
    "Plant bombs",
    "Defuse bombs",
    "Win rounds",
    "Rescue hostages"
}

//Mission param Multipliers
new const Float:g_MissionParams[MISSIONS][2] = {
    {DIFFICULTY_NORMAL      ,  DIFFICULTY_HARD            },            //Kill
    {DIFFICULTY_NORMAL      ,  DIFFICULTY_NORMAL        },            //Kill Weapon
    {DIFFICULTY_NORMAL      ,  DIFFICULTY_HARDNORMAL    },            //Plant
    {DIFFICULTY_NORMAL      ,  DIFFICULTY_HARDNORMAL    },            //Defuse
    {DIFFICULTY_VERYEASY      ,  DIFFICULTY_EASYNORMAL    },            //Win
    {DIFFICULTY_VERYEASY      ,  DIFFICULTY_EASYNORMAL    }            //Hostage
}

//Weapon names
new g_WeaponNames[WEAPONS][] = {
    "weapon_p228",
    0,       
    "weapon_scout",        
    "weapon_hegrenade",
    "weapon_xm1014",
    0,
    "weapon_mac10",
    "weapon_aug",
    0,
    "weapon_elite",
    "weapon_fiveseven",
    "weapon_ump45",
    "weapon_sg550",
    "weapon_galil",
    "weapon_famas",
    "weapon_usp",
    "weapon_glock18",
    "weapon_awp",
    "weapon_mp5navy",
    "weapon_m249",
    "weapon_m3",
    "weapon_m4a1",
    "weapon_tmp",
    "weapon_g3sg1",
    0,
    "weapon_deagle",
    "weapon_sg552",
    "weapon_ak47",
    "weapon_knife",
    "weapon_p90"
}

//Sounds
new const g_Sounds[SOUNDS][] = {
    "czsm/levelup.wav",
    "plats/elevbell1.wav",
    "buttons/bell1.wav"
}

//Resources needed to precache for Tutors.
new const g_TutorPrecache[][] = {
    "gfx/career/icon_!.tga",
    "gfx/career/icon_!-bigger.tga",
    "gfx/career/icon_i.tga",
    "gfx/career/icon_i-bigger.tga",
    "gfx/career/icon_skulls.tga",
    "gfx/career/round_corner_ne.tga",
    "gfx/career/round_corner_nw.tga",
    "gfx/career/round_corner_se.tga",
    "gfx/career/round_corner_sw.tga",
    "resource/TutorScheme.res",
    "resource/UI/TutorTextWindow.res"
}

//Map parameters(MAP_DE,MAP_CS).
new g_MapParams

//Holds Hostage_Entity count(max hostages).
new g_MapParamsCount

//Hostages alive in game.
new g_GameHostages

//Handler entity ID.
new g_HandlerEnt

//Has anyone got a time mission?
new bool:g_TimerOn

//Server maxplayers
new g_MaxPlayers

//Roundtime in seconds. Used in time missions.
new g_RoundTimerStart

//Roundtime left(in seconds). Used in time missions.
new g_RoundTimer

//RoundTime Amount Checked every round. Used for Time missions.
new g_MaxRoundTimeAmt

//There variables hold the message id's.
new g_MsgSay,g_MsgTutor,g_MsgTutorClose
new g_MsgStatusText,g_MsgStatusValue

//Vault ID
new g_Vault

//Player level
new g_PlayerLevel[MAXPLAYERS]

//Player mission type(ex. Kill, plant bomb, defuse bomb e.c)
new g_PlayerMissionType[MAXPLAYERS]

//Mission Time status
new g_PlayerMissionTimeStatus[MAXPLAYERS]

//Can player complete his mission in the current round(for kills in round u.c?
new g_PlayerMissionStatus[MAXPLAYERS]

//Specific Mission params(like Hs/Survive round,Kill e.c).
new g_PlayerMissionParams[MAXPLAYERS][MAXPARAMS]

//Buttons player was holding last cmdstart frame.
new g_PlayerOldButtons[MAXPLAYERS]

//Player Holding IN_SCORE(TAB) button.
new g_PlayerInScore[MAXPLAYERS]

//Can show mission objectives through StatusText.
new bool:g_PlayerCanShow[MAXPLAYERS]

//Is an info message currently displayed to player?
new bool:g_PlayerInfoMsg[MAXPLAYERS]

//Tutur On for player | Player has tutor available.
new bool:g_PlayerHasTutor[MAXPLAYERS],bool:g_PlayerHasTutor2[MAXPLAYERS]

//Is true if player just connected and hasn't spawned.
new bool:g_PlayerJustConnected[MAXPLAYERS]

//Cvars
new /*c_save_type,*/c_save_by,c_use_tutor

new c_roundtime_step

new c_min_level[MISSIONS]

new c_min_hs_level,c_min_round_level,c_min_survive_level,c_min_time_level

new c_max_in_round

new c_autocorrect_missions

//Cvar Pointers
new cp_roundtime,cp_freezetime

public plugin_init() {
    
    register_plugin("Advanced Condition Zero Style Career Missions",VERSION,"shine")
    
    register_cvar("czscm",VERSION,FCVAR_SERVER|FCVAR_SPONLY)
    
    //Debug
    register_clcmd("say /resetstats","CmdReset")
    
    //Cvars
    //In future releases
    //c_save_type = register_cvar("amx_czsm_save_type","1")         //1 - nVault, 2 - MySQL
    c_save_by = register_cvar("amx_czsm_save_by","1")         //1 - Ip, 2 - SteamID
    c_use_tutor = register_cvar("amx_czsm_use_tutor","1")
    
    c_roundtime_step = register_cvar("amx_czsm_roundtime_step","60") //Sec
    
    c_min_level[KILL_NORMAL] = register_cvar("amx_czsm_min_kill_level","1")
    c_min_level[KILL_WEAPON] = register_cvar("amx_czsm_min_killweapon_level","5")
    c_min_level[PLANT] = register_cvar("amx_czsm_min_plant_level","3")
    c_min_level[DEFUSE] = register_cvar("amx_czsm_min_defuse_level","3")
    c_min_level[WIN] = register_cvar("amx_czsm_min_win_level","7")
    c_min_level[HOSTAGE] = register_cvar("amx_czsm_min_hostage_level","10")
    
    c_min_hs_level = register_cvar("amx_czsm_min_hs_level","5")
    c_min_round_level = register_cvar("amx_czsm_min_round_level","10")
    c_min_survive_level = register_cvar("amx_czsm_min_survive_level","15")
    c_min_time_level = register_cvar("amx_czsm_min_time_level","20")
    
    c_max_in_round = register_cvar("amx_czsm_max_in_round","5") //0 - maxplayers / 2
    
    c_autocorrect_missions = register_cvar("amx_czsm_autocorrect_missions","0")
    
    //Cvar Pointers
    cp_roundtime = get_cvar_pointer("mp_roundtime")
    cp_freezetime = get_cvar_pointer("mp_freezetime")
    
    //Events
    register_event("DeathMsg","PlayerDeath","a")
    register_event("HLTV","RoundStart","a","1=0","2=0")
    register_event("TextMsg","HostageAliveCheck","b","1=4","2=#Killed_Hostage")
    
    register_logevent("RoundEnd",2,"1=Round_End")
    register_logevent("PlayerRescueHostage",3,"1=triggered","2=Rescued_A_Hostage")
    
    register_logevent("PlayerPlantedBomb",3,"2=Planted_The_Bomb")
    register_logevent("PlayerDefusedBomb",3,"2=Defused_The_Bomb")
    
    //Audio Events
    register_event("SendAudio","TerroristsWin","a","2=%!MRAD_terwin")
    register_event("SendAudio","CTWin","a","2=%!MRAD_ctwin")
    
    //Fakemeta Forwards
    register_forward(FM_CmdStart,"PlayerCmdStart")
    
    //Ham Forwards
    RegisterHam(Ham_Spawn,"player","PlayerSpawn",1)
    RegisterHam(Ham_Think,"info_target","HandlerThink")
    
    //Messages
    g_MsgSay = get_user_msgid("SayText")
    g_MsgTutor = get_user_msgid("TutorText")
    g_MsgTutorClose = get_user_msgid("TutorClose")
    
    g_MsgStatusText = get_user_msgid("StatusText")
    g_MsgStatusValue = get_user_msgid("StatusValue")
    
    //Hook Messages
    register_message(g_MsgStatusText,"BlockMessage")
    register_message(g_MsgStatusValue,"BlockMessage")
    
    //Open nVault
    g_Vault = nvault_open("czstyle_missions")
    
    //Get maxplayers
    g_MaxPlayers = get_maxplayers()
    
    //Make the time mission handler
    MakeHandler()
    
    //Check Map Params
    CheckMap()
    
    //Start Configs
    StartCfg()
}

public MakeHandler() {
    
    g_HandlerEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))    
    
    set_pev(g_HandlerEnt,pev_classname,"CZSMHandler")
    
    set_pev(g_HandlerEnt,pev_nextthink,get_gametime() + 1.0)
}

public CheckMap() {

    new tVar = -1
    
    if
    (
    engfunc(EngFunc_FindEntityByString,-1,"classname","info_bomb_target")
    ||
    engfunc(EngFunc_FindEntityByString,-1,"classname","func_bomb_target")
    ) {
        g_MapParams |= MAP_DE
    }
    
    while((tVar = engfunc(EngFunc_FindEntityByString,tVar,"classname","hostage_entity")) != 0) {
        
        if(!g_MapParamsCount) g_MapParams |= MAP_CS
        
        g_MapParamsCount++
    }
}

public StartCfg() {
    
    g_RoundTimerStart = floatround(get_pcvar_float(cp_roundtime) * 60.0)
    g_RoundTimer = g_RoundTimerStart
    
    g_GameHostages = g_MapParamsCount
    
    g_MaxRoundTimeAmt = floatround(get_pcvar_float(cp_roundtime) * 60) / get_pcvar_num(c_roundtime_step)
}

//Debug
public CmdReset(id) {
    
    new i
        
    g_PlayerLevel[id] = 0

    g_PlayerMissionType[id] = 0

    for(i = 0; i < 4; i++) g_PlayerMissionParams[id][i] = 0
    
    SaveMission(id)
}

public plugin_precache() {
    
    new i
    
    for(i = 0; i < sizeof g_TutorPrecache; i++) precache_generic(g_TutorPrecache[i])
    
    for(i = 0; i < sizeof g_Sounds; i++) precache_sound(g_Sounds[i])
}

public client_putinserver(id) {
    
    if(!is_user_bot(id)) {
        
        g_PlayerJustConnected[id] = true
        
        if(!get_pcvar_num(c_use_tutor)) g_PlayerHasTutor[id] = false
        
        set_task(0.3,"CheckPlayerInfo",id)
        
        LoadMission(id)
    }
}

public client_disconnect(id) {
    
    if(!is_user_bot(id)) {
        
        new i
        
        if(g_PlayerMissionParams[id][PARAM_ROUND]) {
            
            g_PlayerMissionParams[id][PARAM_PLAYER] = 0
        }
        
        SaveMission(id)
        
        g_PlayerLevel[id] = 0

        g_PlayerMissionType[id] = 0
        
        g_PlayerMissionStatus[id] = STATUS_NORMAL
        
        g_PlayerMissionTimeStatus[id] = STATUS_NORMAL
        
        g_PlayerInfoMsg[id] = false
        
        g_PlayerInScore[id] = false
        
        g_PlayerCanShow[id] = true
        
        for(i = 0; i < MAXPARAMS; i++) g_PlayerMissionParams[id][i] = 0
        
        remove_task(id + TASK_TUTOR)
        remove_task(id + TASK_MISSION)
    }
    
    CheckStatus()
}

public CheckPlayerInfo(id) {

    new Info[33]
    get_user_info(id,"cl_tutor",Info,32)
    
    if(Info[0] != '1') {

        client_cmd(id,"setinfo cl_tutor 1")
        
        g_PlayerHasTutor2[id] = false
    }
    else {
        
        g_PlayerHasTutor2[id] = true
    }
    
    if(get_pcvar_num(c_use_tutor) && g_PlayerHasTutor2[id]) {

        g_PlayerHasTutor[id] = true
    }
    else {
        
        g_PlayerHasTutor[id] = false
    }
}

public PlayerDeath() {
    
    new Killer = read_data(1)
    new Victim = read_data(2)
    
    RemoveTutor(Victim + TASK_TUTOR)
    
    if(g_PlayerMissionParams[Killer][PARAM_ROUND]) CheckPlayerMission(Killer,1)
    
    if(g_PlayerMissionTimeStatus[Killer] == STATUS_FAILED) return PLUGIN_CONTINUE
    
    if
    (
        Killer != Victim
        &&
        get_user_team(Killer) != get_user_team(Victim)
        && 
        (
            g_PlayerMissionType[Killer] == KILL_NORMAL
            ||
            g_PlayerMissionType[Killer] == KILL_WEAPON
        )
        &&
        !is_user_bot(Killer)
        &&
        is_user_alive(Killer)
    ) {
        
        if(g_PlayerMissionType[Killer] == KILL_NORMAL) {
            
            new HeadShot = read_data(3)
            
            if(g_PlayerMissionParams[Killer][PARAM_HS] && HeadShot || !g_PlayerMissionParams[Killer][PARAM_HS]) {
                
                g_PlayerMissionParams[Killer][PARAM_PLAYER]++
                
                client_cmd(Killer,"spk ^"%s^"",g_Sounds[SOUND_OBJ])
            
                if(!g_PlayerMissionParams[Killer][PARAM_SURVIVE]) {
                    
                    CheckPlayerMission(Killer,1)
                }
                else {
                    
                    CheckPlayerMission(Killer,0)
                }
            }
        }
        
        else if(g_PlayerMissionType[Killer] == KILL_WEAPON) {
            
            new Weapon[16],wWeapon[16],HeadShot
            
            read_data(4,Weapon,15)
            
            HeadShot = read_data(3)
            
            if(equal(Weapon,"grenade")) {
                
                formatex(wWeapon,15,"%s",g_WeaponNames[g_PlayerMissionParams[Killer][PARAM_WEAPON]][9])
            }
            else {
                
                formatex(wWeapon,15,"%s",g_WeaponNames[g_PlayerMissionParams[Killer][PARAM_WEAPON]][7])
            }

            if(equal(Weapon,wWeapon)) {
                
                if(g_PlayerMissionParams[Killer][PARAM_HS] && HeadShot || !g_PlayerMissionParams[Killer][PARAM_HS]) {
                
                    g_PlayerMissionParams[Killer][PARAM_PLAYER]++
                    
                    client_cmd(Killer,"spk ^"%s^"",g_Sounds[SOUND_OBJ])
                
                    if(!g_PlayerMissionParams[Killer][PARAM_SURVIVE]) {
                        
                        CheckPlayerMission(Killer,1)
                    }
                    else {
                    
                        CheckPlayerMission(Killer,0)
                    }
                }
            }
        }        
    }
    
    CheckStatus()
    
    return PLUGIN_CONTINUE
}

public RoundEnd() {
    
    new i,TutorOn = get_pcvar_num(c_use_tutor)

    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_connected(i)) {
            
            if(TutorOn && g_PlayerHasTutor2[i]) g_PlayerHasTutor[i] = true
            else g_PlayerHasTutor[i] = false
            
            if(g_PlayerMissionParams[i][PARAM_SURVIVE] && is_user_alive(i)) CheckPlayerMission(i,1)
            
            if(g_PlayerMissionParams[i][PARAM_ROUND] || g_PlayerMissionParams[i][PARAM_SURVIVE]) {
                
                g_PlayerMissionParams[i][PARAM_PLAYER] = 0
            }
            
            g_PlayerMissionStatus[i] = STATUS_NORMAL
            
            g_PlayerMissionTimeStatus[i] = STATUS_NORMAL
        }
    }
}

public PlayerRescueHostage() {
    
    new LogArgs[128],Name[33],i
    
    read_logargv(0,LogArgs,127)
    
    parse_loguser(LogArgs,Name,32)
    
    new id = get_user_index(Name)
    
    if(g_PlayerMissionType[id] == HOSTAGE && !is_user_bot(id) && g_PlayerMissionTimeStatus[id] == STATUS_NORMAL) {
        
        g_PlayerMissionParams[id][PARAM_PLAYER]++
        
        client_cmd(id,"spk ^"%s^"",g_Sounds[SOUND_OBJ])
                
        if(!g_PlayerMissionParams[id][PARAM_SURVIVE]) {
                    
            CheckPlayerMission(id,1)
        }
        else {
                    
            CheckPlayerMission(id,0)
        }
    }
    
    g_GameHostages--
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(
        is_user_alive(i) &&
        !is_user_bot(i) &&
        g_PlayerMissionType[i] == HOSTAGE &&
        i != id &&
        g_GameHostages > g_PlayerMissionParams[i][PARAM_PLAYER] &&
        g_PlayerMissionParams[i][PARAM_ROUND]
        ) {
            
            if(g_PlayerMissionTimeStatus[i] == STATUS_NORMAL) client_cmd(i,"spk ^"%s^"",g_Sounds[SOUND_FAILED])
            
            g_PlayerMissionStatus[i] = STATUS_FAILED
            
            CheckPlayerMission(i,0)
        }
    }
}

public RoundStart() {
    
    g_TimerOn = false
    
    remove_task(TASK_CHECKTIME)
    
    set_task(get_pcvar_float(cp_freezetime),"CheckTimer",TASK_CHECKTIME)
}

public HostageAliveCheck() {
    
    new i
    
    g_GameHostages--
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i) && !is_user_bot(i) && g_PlayerMissionType[i] == HOSTAGE && g_GameHostages > g_PlayerMissionParams[i][PARAM_PLAYER] && g_PlayerMissionParams[i][PARAM_ROUND]) {
            
            if(g_PlayerMissionTimeStatus[i] == STATUS_NORMAL) client_cmd(i,"spk ^"%s^"",g_Sounds[SOUND_FAILED])
            
            g_PlayerMissionStatus[i] = STATUS_FAILED
            
            CheckPlayerMission(i,0)
        }
    }
}

public CheckTimer() {
    
    new bool:AnyoneHasTimer,i
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i) && g_PlayerMissionParams[i][PARAM_TIME]) {
            
            AnyoneHasTimer = true
            
            break
        }
    }
        
    if(AnyoneHasTimer) {
        
        g_RoundTimerStart = floatround(get_pcvar_float(cp_roundtime) * 60.0)
        g_RoundTimer = g_RoundTimerStart
        
        g_TimerOn = true
    }
    else {
        
        g_TimerOn = false
    }
}
    

public PlayerPlantedBomb() {
    
    new LogArgs[128],Name[33],i
    
    read_logargv(0,LogArgs,127)
    
    parse_loguser(LogArgs,Name,32)
    
    new id = get_user_index(Name)
    
    if(g_PlayerMissionType[id] == PLANT && !is_user_bot(id) && g_PlayerMissionTimeStatus[id] == STATUS_NORMAL) {
        
        g_PlayerMissionParams[id][PARAM_PLAYER]++
        
        client_cmd(id,"spk ^"%s^"",g_Sounds[SOUND_OBJ])
                
        if(!g_PlayerMissionParams[id][PARAM_SURVIVE]) {
                    
            CheckPlayerMission(id,1)
        }
        else {
                    
            CheckPlayerMission(id,0)
        }
    }
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i) && !is_user_bot(i) && g_PlayerMissionType[i] == PLANT && i != id) {
            
            if(g_PlayerMissionTimeStatus[i] == STATUS_NORMAL) client_cmd(i,"spk ^"%s^"",g_Sounds[SOUND_FAILED])
            
            g_PlayerMissionStatus[i] = STATUS_FAILED
            
            CheckPlayerMission(i,0)
        }
    }
}

public PlayerDefusedBomb() {
    
    new LogArgs[128],Name[33],i
    
    read_logargv(0,LogArgs,127)
    
    parse_loguser(LogArgs,Name,32)
    
    new id = get_user_index(Name)
    
    if(g_PlayerMissionType[id] == DEFUSE && !is_user_bot(id) && g_PlayerMissionTimeStatus[id] == STATUS_NORMAL) {
        
        g_PlayerMissionParams[id][PARAM_PLAYER]++
        
        client_cmd(id,"spk ^"%s^"",g_Sounds[SOUND_OBJ])
                
        if(!g_PlayerMissionParams[id][PARAM_SURVIVE]) {
                    
            CheckPlayerMission(id,1)
        }
        else {
                    
            CheckPlayerMission(id,0)
        }
    }
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i) && !is_user_bot(i) && g_PlayerMissionType[i] == DEFUSE && i != id) {
            
            if(g_PlayerMissionTimeStatus[i] == STATUS_NORMAL) client_cmd(i,"spk ^"%s^"",g_Sounds[SOUND_FAILED])
            
            g_PlayerMissionStatus[i] = STATUS_FAILED
            
            CheckPlayerMission(i,0)
        }
    }
}

public TerroristsWin() {
    
    new i
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i) && get_user_team(i) == TEAM_T && !is_user_bot(i) && g_PlayerMissionType[i] == WIN && g_PlayerMissionTimeStatus[i] == STATUS_NORMAL) {
            
            g_PlayerMissionParams[i][PARAM_PLAYER]++
            
            client_cmd(i,"spk ^"%s^"",g_Sounds[SOUND_OBJ])
                
            CheckPlayerMission(i,1)
        }
    }
}

public CTWin() {
    
    new i
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i) && get_user_team(i) == TEAM_CT && !is_user_bot(i) && g_PlayerMissionType[i] == WIN && g_PlayerMissionTimeStatus[i] == STATUS_NORMAL) {
            
            g_PlayerMissionParams[i][PARAM_PLAYER]++
                
            client_cmd(i,"spk ^"%s^"",g_Sounds[SOUND_OBJ])
            
            CheckPlayerMission(i,1)
        }
    }
}

public PlayerCmdStart(id,Uc_Handle,Seed) {

    static Buttons
    
    Buttons = get_uc(Uc_Handle,UC_Buttons)
    
    if(Buttons & IN_SCORE && !(g_PlayerOldButtons[id] & IN_SCORE)) {
        
        g_PlayerInScore[id] = true
        
        if(!g_PlayerInfoMsg[id]) {

            CheckPlayerMission(id,0)
        }
    }
    else if(!(Buttons & IN_SCORE) && g_PlayerOldButtons[id] & IN_SCORE) {
        
        g_PlayerInScore[id] = false
        
        if(!g_PlayerInfoMsg[id]) {
            
            if(g_PlayerHasTutor[id]) {
            
                RemoveTutor(id + TASK_TUTOR)
            }
            else {
                
                HideStatusText(id)
            }
        }
    }
    
    g_PlayerOldButtons[id] = Buttons
    
    return FMRES_IGNORED
}

public PlayerSpawn(id) {
    
    if(!is_user_alive(id) || is_user_bot(id)) return HAM_IGNORED
    
    CheckStatus()
    
    //RemoveTutor(id +TASK_TUTOR)
        
    if(g_PlayerJustConnected[id]) {
        
        g_PlayerJustConnected[id] = false
    
        new Text[192],Level[4]
        
        formatex(Level,3,"%d",g_PlayerLevel[id])
        
        if(g_PlayerHasTutor[id]) {
            
            formatex(Text,191,"Welcome to CZ Style Missions Mod!^n^n%s%s.",g_PlayerLevel[id] == 0 ?
            "Hello there Newb. Is this the first time you play here?^nDon't worry! Just complete missions displayed here to level up" :
            "Welcome back! You're on level ",
            g_PlayerLevel[id] == 0 ? "" : Level
            
            )
            
            g_PlayerInfoMsg[id] = true
            
            MakeTutor(id,Text,YELLOW,10.0)
        }
        else {
            
            formatex(Text,191,"^x04[AMXX]^x01 Welcome to CZ Style Missions Mod!")
            
            ColorPrint(id,Text)
            
            formatex(Text,191,"^x04[AMXX]^x01 %s%s.",g_PlayerLevel[id] == 0 ?
            "Hello there Newb. Is this the first time you play here?^nDon't worry! Just complete missions displayed in chat to level up" :
            "Welcome back! You're on level ",
            g_PlayerLevel[id] == 0 ? "" : Level
            )
            
            g_PlayerInfoMsg[id] = false
            
            ColorPrint(id,Text)
        }
        
        if(!g_PlayerLevel[id]) {
            
            g_PlayerLevel[id] = 1
            
            MakeMission(id,g_PlayerLevel[id],0)
        }
        else {
            
            if
            (
                (
                    (
                        (
                            g_PlayerMissionType[id] == PLANT || g_PlayerMissionType[id] == DEFUSE
                        )
                        &&
                        !(g_MapParams & MAP_DE)
                    )
                    ||
                    (
                        g_PlayerMissionType[id] == HOSTAGE
                        &&
                        !(g_MapParams & MAP_CS)
                    )
                )
                &&
                get_pcvar_num(c_autocorrect_missions)    
            ) {
                
                MakeMission(id,g_PlayerLevel[id])
            }
            
            if(g_PlayerMissionType[id] == HOSTAGE && g_PlayerMissionParams[id][PARAM_ROUND] && g_PlayerMissionParams[id][PARAM_CONST] > g_MapParamsCount && get_pcvar_num(c_autocorrect_missions)) {
                
                g_PlayerMissionParams[id][PARAM_CONST] = g_MapParamsCount
            }
            
            if(g_PlayerMissionParams[id][PARAM_TIMEAMT] > g_MaxRoundTimeAmt) g_PlayerMissionParams[id][PARAM_TIMEAMT] = g_MaxRoundTimeAmt
        }
        
        set_task(10.1,"CheckPlayerMissionT",id + TASK_MISSION)
            
        return HAM_IGNORED
    }
    
    if(g_PlayerMissionParams[id][PARAM_TIMEAMT] > g_MaxRoundTimeAmt) g_PlayerMissionParams[id][PARAM_TIMEAMT] = g_MaxRoundTimeAmt

    g_PlayerInScore[id] = false
    
    //remove_task(id + TASK_TUTOR)
    
    if(!task_exists(id + TASK_MISSION)) CheckPlayerMission(id,0)
    
    return HAM_IGNORED
}

public HandlerThink(Ent) {
    
    if(Ent == g_HandlerEnt) {
        
        if(g_TimerOn && g_RoundTimer) {
            
            g_RoundTimer--
            
            static i,TimePassed,PlayerTimeLeft
            
            TimePassed = g_RoundTimerStart - g_RoundTimer
            
            for(i = 0; i < MAXPLAYERS; i++) {
                
                if
                (
                    is_user_alive(i)
                    &&
                    !is_user_bot(i)
                    &&
                    g_PlayerMissionParams[i][PARAM_TIME]
                    &&
                    g_PlayerMissionTimeStatus[i] == STATUS_NORMAL
                ) {
                    
                    PlayerTimeLeft = (g_PlayerMissionParams[i][PARAM_TIMEAMT] * 60) - TimePassed
                    
                    if(PlayerTimeLeft <= 0) {
                        
                        if(g_PlayerMissionParams[i][PARAM_PLAYER] < g_PlayerMissionParams[i][PARAM_CONST]) {

                            g_PlayerMissionTimeStatus[i] = STATUS_FAILED
                            
                            CheckPlayerMission(i,0)
                        }
                    }
                    else {
                        
                        set_hudmessage(255,255,255,-1.0,0.90,0,6.0,1.0)
                        show_hudmessage(i, "Mission Time: %d seconds.",PlayerTimeLeft)
                    }
                }
            }
        }
        
        set_pev(Ent,pev_nextthink,get_gametime() + 1.0)
    }
    
    return HAM_IGNORED
}

public BlockMessage(MsgID,MsgDest,id) {
    
    if(!g_PlayerHasTutor[id] && g_PlayerInScore[id]) {
        
        new Args[3]
        get_msg_arg_string(2,Args,2)
        
        if(Args[0] != 'L' || Args[1] != 'v' || Args[2] != 'l') {
        
            return PLUGIN_HANDLED
        }
    }
    
    return PLUGIN_CONTINUE
}

MakeMission(id,Level,UpdateTutor = 1) {
    
    new i,Weapon = -1,Float:DifficultyMulti = DIFFICULTY_NORMAL
    
    g_PlayerMissionType[id] = RandomMission(Level)
    
    if(g_PlayerMissionType[id] < 0) return 1
        
    for(i = 0; i < MAXPARAMS; i++) g_PlayerMissionParams[id][i] = 0
    
    if(g_PlayerMissionType[id] == KILL_WEAPON) {
        
        while(Weapon < 0) {
            
            Weapon = random_num(0,WEAPONS - 1)
            
            if(g_WeaponNames[Weapon][0] == 0) Weapon = -1
        
        }
        
        g_PlayerMissionParams[id][PARAM_WEAPON] = Weapon
        
        if(Weapon != CSW_HEGRENADE - 1) {
            
            if(get_pcvar_num(c_min_hs_level) <= Level) g_PlayerMissionParams[id][PARAM_HS] = random_num(0,1)
            
            if(get_pcvar_num(c_min_round_level) <= Level) {
                
                g_PlayerMissionParams[id][PARAM_ROUND] = random_num(0,1)
            }
        }
    }
    else if(g_PlayerMissionType[id] == KILL_NORMAL) {
        
        if(Weapon != CSW_HEGRENADE - 1) {
            
            if(get_pcvar_num(c_min_hs_level) <= Level) g_PlayerMissionParams[id][PARAM_HS] = random_num(0,1)
            
            if(get_pcvar_num(c_min_round_level) <= Level) g_PlayerMissionParams[id][PARAM_ROUND] = random_num(0,1)
        }
    }
    
    if(g_PlayerMissionType[id] == HOSTAGE ) {
    
        if(get_pcvar_num(c_min_round_level) <= Level) g_PlayerMissionParams[id][PARAM_ROUND] = random_num(0,1)
    }
        
        
    if(g_PlayerMissionType[id] != DEFUSE && g_PlayerMissionType[id] != WIN && get_pcvar_num(c_min_survive_level) <= Level) {
        
        g_PlayerMissionParams[id][PARAM_SURVIVE] = random_num(0,1)
        
        if(g_PlayerMissionParams[id][PARAM_SURVIVE]) {
            
            DifficultyMulti *= DIFFICULTY_EASYNORMAL
        }
    }
    
    if(!g_PlayerMissionParams[id][PARAM_ROUND] && g_PlayerMissionType[id] != DEFUSE && get_pcvar_num(c_min_time_level) <= Level) {
        
        g_PlayerMissionParams[id][PARAM_TIME] = random_num(0,1)
        
        if(g_PlayerMissionParams[id][PARAM_TIME]) {
            
            i = random_num(1,g_MaxRoundTimeAmt)
            
            g_PlayerMissionParams[id][PARAM_TIMEAMT] = i
            
            DifficultyMulti *= DIFFICULTY_NORMAL / 4 * i
        }
    }

    //Yes, i'm making variables.
    static Float:Rand,Float:Lvl,MaxInRound
    
    Rand = random_float
    (
            g_MissionParams[g_PlayerMissionType[id]][PARAM_MIN],
            g_MissionParams[g_PlayerMissionType[id]][PARAM_MAX]
    )
    
    Lvl = float(Level)
    
    g_PlayerMissionParams[id][PARAM_CONST] = floatround(Rand * Lvl * DifficultyMulti)
    
    if(g_PlayerMissionParams[id][PARAM_CONST] < 1) g_PlayerMissionParams[id][PARAM_CONST] = 1
    
    if(g_PlayerMissionParams[id][PARAM_CONST] < 2 && g_PlayerMissionParams[id][PARAM_ROUND]) g_PlayerMissionParams[id][PARAM_CONST] = 2
    
    MaxInRound = get_pcvar_num(c_max_in_round) ? get_pcvar_num(c_max_in_round) : g_MaxPlayers / 2
    
    if(g_PlayerMissionParams[id][PARAM_ROUND] || g_PlayerMissionParams[id][PARAM_TIME]) {
        
        if(g_PlayerMissionParams[id][PARAM_CONST] > MaxInRound && (g_PlayerMissionType[id] == KILL_NORMAL || g_PlayerMissionType[id] == KILL_WEAPON)) {
        
            g_PlayerMissionParams[id][PARAM_ROUNDTIMES] = g_PlayerMissionParams[id][PARAM_CONST] / MaxInRound + ((g_PlayerMissionParams[id][PARAM_CONST] % MaxInRound > 0) ? 1 : 0)
            g_PlayerMissionParams[id][PARAM_CONST] = MaxInRound
        }
        else if(g_PlayerMissionParams[id][PARAM_CONST] > g_MapParamsCount && g_PlayerMissionType[id] == HOSTAGE) {
        
            g_PlayerMissionParams[id][PARAM_ROUNDTIMES] = g_PlayerMissionParams[id][PARAM_CONST] / g_MapParamsCount + ((g_PlayerMissionParams[id][PARAM_CONST] % g_MapParamsCount != 0) ? 1 : 0)
            g_PlayerMissionParams[id][PARAM_CONST] = g_MapParamsCount
        }
    }
    
    new Plrs[3]
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i)) {
            
            switch(get_user_team(i)) {
                
                case TEAM_T : Plrs[TEAM_T]++
                
                case TEAM_CT : Plrs[TEAM_CT]++
            }
        }
    }
        
    if((g_PlayerMissionType[id] == KILL_NORMAL || g_PlayerMissionType[id] == KILL_WEAPON) && g_PlayerMissionParams[id][PARAM_ROUND]) {
            
        if(
        g_PlayerMissionParams[id][PARAM_CONST] - g_PlayerMissionParams[id][PARAM_PLAYER] >
        Plrs[get_user_team(id) == TEAM_CT ? TEAM_T : TEAM_CT]
        ) {
            if(g_PlayerMissionTimeStatus[id] == STATUS_NORMAL) client_cmd(id,"spk ^"%s^"",g_Sounds[SOUND_FAILED])
            
            g_PlayerMissionStatus[id] = STATUS_FAILED
        }
        else {
            
            g_PlayerMissionStatus[id] = STATUS_NORMAL
        }
    }
    
    if(UpdateTutor) CheckPlayerMission(id,0)
    
    return 1
}

public CheckPlayerMissionT(taskID) {
    
    new id = taskID - TASK_MISSION
    
    CheckPlayerMission(id,0)
}

public CheckPlayerMission(id,CheckWin) {
    
    static Text[256],sMission[33],TimeStr[16],RoundTimeStr[33]
    
    if(g_PlayerMissionParams[id][PARAM_PLAYER] > g_PlayerMissionParams[id][PARAM_CONST]) {
        
        g_PlayerMissionParams[id][PARAM_PLAYER] = g_PlayerMissionParams[id][PARAM_CONST]
    }
    
    if
    (
        g_PlayerMissionParams[id][PARAM_PLAYER] == g_PlayerMissionParams[id][PARAM_CONST]
        &&
        g_PlayerMissionParams[id][PARAM_CONST]
        &&
        CheckWin
    ) {
        
        if(g_PlayerMissionParams[id][PARAM_ROUNDTIMES] > 0) {
            
            g_PlayerMissionParams[id][PARAM_ROUNDTIME_COUNT]++
            
            g_PlayerMissionParams[id][PARAM_PLAYER] = 0
        }
        
        if(g_PlayerMissionParams[id][PARAM_ROUNDTIMES] == g_PlayerMissionParams[id][PARAM_ROUNDTIME_COUNT]) {
        
            static i
            
            g_PlayerLevel[id]++
            
            formatex(Text,191,"%sMission Complete! You're now on level %s%d%s!",
            g_PlayerHasTutor[id] == false ? "^x04[Mission]^x01 " : "",
            g_PlayerHasTutor[id] == false ? "^x03" : "",
            g_PlayerLevel[id],
            g_PlayerHasTutor[id] == false ? "^x01" : "",
            g_PlayerHasTutor[id] == false ? "^x03" : ""
            )
            
            if(g_PlayerHasTutor[id]) {
                
                g_PlayerInfoMsg[id] = true
                
                MakeTutor(id,Text,GREEN,4.9)

            }
            else {
                
                ColorPrint(id,Text)
            }
            
            g_PlayerMissionType[id] = 0
            
            for(i = 0; i < MAXPARAMS; i++) g_PlayerMissionParams[id][i] = 0
            
            MakeMission(id,g_PlayerLevel[id],0)
            
            set_task(5.0,"CheckPlayerMissionT",id + TASK_MISSION)
            
            client_cmd(id,"spk ^"%s^"",g_Sounds[SOUND_LVLUP])
        }
            
        return PLUGIN_CONTINUE
    }
    
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    
    if(g_PlayerMissionType[id] == KILL_WEAPON) {

        formatex(sMission,32,"%s ",g_WeaponNames[g_PlayerMissionParams[id][PARAM_WEAPON]][7])
    }
    
    if(g_PlayerMissionParams[id][PARAM_TIME]) {
        
        formatex(TimeStr,15,"in %d seconds ",g_PlayerMissionParams[id][PARAM_TIMEAMT] * 60)
    }
    
    if(g_PlayerMissionParams[id][PARAM_ROUNDTIMES] > 0) {
        
        formatex(RoundTimeStr,32," and do it %d/%d times",g_PlayerMissionParams[id][PARAM_ROUNDTIME_COUNT],g_PlayerMissionParams[id][PARAM_ROUNDTIMES])
    }
    else {
        
        RoundTimeStr[0] = 0
    }
    
    //                         Line               In Time
    //                                                    Weapon    Survive
    //                                Level              Desc   ROUND
    //              Level Text                  D  W HS        P/C
    formatex(Text,255,"%s: %d%s[Mission] %s %s%s%s%s%s- %d/%d%s.",
    g_PlayerHasTutor[id] == true ? "Current Level" : "Lvl",
    g_PlayerLevel[id],
    g_PlayerHasTutor[id] == true ? "^n" : " -- ",
    g_MissionDesc[g_PlayerMissionType[id]],
    g_PlayerMissionType[id] == KILL_WEAPON ? sMission : "",
    g_PlayerMissionParams[id][PARAM_HS] == 1 ? "with headshot " : "",
    g_PlayerMissionParams[id][PARAM_ROUND] == 1 ? "in one round " : "",
    g_PlayerMissionParams[id][PARAM_TIME] == 1 ? TimeStr : "",
    g_PlayerMissionParams[id][PARAM_SURVIVE] == 1 ? "and survive " : "",
    g_PlayerMissionParams[id][PARAM_PLAYER],
    g_PlayerMissionParams[id][PARAM_CONST],
    RoundTimeStr
    )

    if(g_PlayerHasTutor[id]) {
        
        static Color
        
        if(g_PlayerMissionStatus[id] == STATUS_FAILED || g_PlayerMissionTimeStatus[id] == STATUS_FAILED) Color = RED
        else if(g_PlayerMissionParams[id][PARAM_PLAYER] == 0) Color = BLUE
        else if(g_PlayerMissionParams[id][PARAM_PLAYER] == g_PlayerMissionParams[id][PARAM_CONST]) Color = GREEN
        else Color = YELLOW

        if(g_PlayerInScore[id]) {
            
            MakeTutor(id,Text,Color)
        }
    }
    else {
        
        if(g_PlayerInScore[id]) {
            
            MakeStatusText(id,Text)
        }
    }
    
    return PLUGIN_CONTINUE
}

public CheckStatus() {
    
    new Plrs[3],i
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if(is_user_alive(i)) {
            
            switch(get_user_team(i)) {
                
                case TEAM_T : Plrs[TEAM_T]++
                
                case TEAM_CT : Plrs[TEAM_CT]++
            }
        }
    }
    
    for(i = 0; i < MAXPLAYERS; i++) {
        
        if((g_PlayerMissionType[i] == KILL_NORMAL || g_PlayerMissionType[i] == KILL_WEAPON) && g_PlayerMissionParams[i][PARAM_ROUND] && is_user_alive(i)) {
            
            if(
            g_PlayerMissionParams[i][PARAM_CONST] - g_PlayerMissionParams[i][PARAM_PLAYER] >
            Plrs[get_user_team(i) == TEAM_CT ? TEAM_T : TEAM_CT]
            ) {
                if(g_PlayerMissionTimeStatus[i] == STATUS_NORMAL) client_cmd(i,"spk ^"%s^"",g_Sounds[SOUND_FAILED])
                
                g_PlayerMissionStatus[i] = STATUS_FAILED
            }
            else {
                
                g_PlayerMissionStatus[i] = STATUS_NORMAL
            }
        }
    }
}

//Stocks

RandomMission(Level) {
    
    new Nums[MISSIONS] = {-1,...},i,x
    
    for(i = 0; i < MISSIONS; i++) {
        
        if
        (
            get_pcvar_num(c_min_level[i]) > Level
            ||
            (
                (
                    (
                        i == PLANT || i == DEFUSE
                    )
                    && !(g_MapParams & MAP_DE)
                )
                ||
                (
                    i == HOSTAGE && !(g_MapParams & MAP_CS)
                )
            )
        ) {
            
            continue
        }

        Nums[x] = i
            
        x++
    }
    
    if(Nums[0] == -1) {

        return -1
    }
    else {
        
        return Nums[random_num(0,x - 1)]
    }
    
    return -1
}
        

MakeTutor(id,Text[],Color,Float:Time = 0.0) {
    
    message_begin(MSG_ONE_UNRELIABLE,g_MsgTutor,_,id)
    write_string(Text)
    write_byte(0)
    write_short(0)
    write_short(0)
    write_short(1<<Color)
    message_end()
    
    if(Time != 0.0) {
        
        set_task(Time,"RemoveTutor",id + TASK_TUTOR)
    }
}

MakeStatusText(id,Text[]) {
    
    message_begin(MSG_ONE_UNRELIABLE,g_MsgStatusText,_,id)
    write_byte(0)
    write_string(Text)
    message_end()
}

HideStatusText(id) {
    
    message_begin(MSG_ONE_UNRELIABLE,g_MsgStatusText,_,id)
    write_byte(0)
    write_string("1 %c1: %p2^n2  %h: %i3%%")
    message_end()
    
    message_begin(MSG_ONE_UNRELIABLE,g_MsgStatusValue,_,id)
    write_byte(2)
    write_short(1)
    message_end()
}

public RemoveTutor(taskID) {
    
    new id = taskID - TASK_TUTOR
    
    g_PlayerInfoMsg[id] = false
    
    message_begin(MSG_ONE_UNRELIABLE,g_MsgTutorClose,_,id)
    message_end()
}

ColorPrint(id,Text[]) {
    
    message_begin(MSG_ONE_UNRELIABLE,g_MsgSay,_,id)
    write_byte(id)
    write_string(Text)
    message_end()
}

//Vault
public SaveMission(Player) {
    
    new SteamID_IP[33],Key[64],Data[256]
    
    get_pcvar_num(c_save_by) == 1 ? get_user_ip(Player,SteamID_IP,32,1) : get_user_authid(Player,SteamID_IP,32)
    
    formatex(Key,63,"%s_msn",SteamID_IP)
    
    formatex(Data,255,"%d %d %d %d %d %d %d %d %d %d %d %d",
    g_PlayerLevel[Player],
    g_PlayerMissionType[Player],
    g_PlayerMissionParams[Player][PARAM_PLAYER],
    g_PlayerMissionParams[Player][PARAM_CONST],
    g_PlayerMissionParams[Player][PARAM_WEAPON],
    g_PlayerMissionParams[Player][PARAM_HS],
    g_PlayerMissionParams[Player][PARAM_ROUND],
    g_PlayerMissionParams[Player][PARAM_SURVIVE],
    g_PlayerMissionParams[Player][PARAM_TIME],
    g_PlayerMissionParams[Player][PARAM_TIMEAMT],
    g_PlayerMissionParams[Player][PARAM_ROUNDTIMES],
    g_PlayerMissionParams[Player][PARAM_ROUNDTIME_COUNT]
    )

    nvault_set(g_Vault,Key,Data) 
}

public LoadMission(Player) {
    
    new SteamID_IP[33],Key[64],Data[256],tStr[MAXPARAMS + 2][6]
    
    get_pcvar_num(c_save_by) == 1 ? get_user_ip(Player,SteamID_IP,32,1) : get_user_authid(Player,SteamID_IP,32)
    
    formatex(Key,63,"%s_msn",SteamID_IP)  
    
    nvault_get(g_Vault,Key,Data,255)
    
    parse
    (
        Data,
        tStr[0],5,
        tStr[1],5,
        tStr[2],5,
        tStr[3],5,
        tStr[4],5,
        tStr[5],5,
        tStr[6],5,
        tStr[7],5,
        tStr[8],5,
        tStr[9],5,
        tStr[10],5,
        tStr[11],5
    )
    
    g_PlayerLevel[Player] = str_to_num(tStr[0])
    g_PlayerMissionType[Player] = str_to_num(tStr[1])
    
    g_PlayerMissionParams[Player][PARAM_PLAYER] = str_to_num(tStr[2])
    g_PlayerMissionParams[Player][PARAM_CONST] = str_to_num(tStr[3])
    g_PlayerMissionParams[Player][PARAM_WEAPON] = str_to_num(tStr[4])
    
    g_PlayerMissionParams[Player][PARAM_HS] = str_to_num(tStr[5])
    g_PlayerMissionParams[Player][PARAM_ROUND] = str_to_num(tStr[6])
    g_PlayerMissionParams[Player][PARAM_SURVIVE] = str_to_num(tStr[7])
    g_PlayerMissionParams[Player][PARAM_TIME] = str_to_num(tStr[8])
    g_PlayerMissionParams[Player][PARAM_TIMEAMT] = str_to_num(tStr[9])
    g_PlayerMissionParams[Player][PARAM_ROUNDTIMES] = str_to_num(tStr[10])
    g_PlayerMissionParams[Player][PARAM_ROUNDTIME_COUNT] = str_to_num(tStr[11])
}

Edited by shine
Link to comment
Share on other sites

Es uzliku un viss strādā, tikai ir brīži, kad pēkšņi plugins tā teikt iestrēgst un tikai pēc mapes nomaiņas viss sakārtojas...

shine piesējās par pawn, es atkal piesiešos par web risinājumu...

Kā var vienam tekstam izveidot divas krāsas??? Ideja kā tāda strādā, kur uzrādās admins, bet domājot par to vien metas šermuļi. Iesaku labāk definēt uzreiz krāsu admin nikam, krāsu t nikam un krāsu ct nikam... Tad nevajadzētu raksties nekādām problēmām.

Godīgi sakot nezinu ar ko īpaši šis plugins atšķiras no pirms laba laika ievietotā? Nu ok, admins ir citā krāsā, bet to var mierīgi panāk arī savādāk. IP? Nu un ko īpašu tas dod? Nevajag visādiem jampampiņiem zināt citu IP. Vairāk nekas īpašs tur nav... (nu ok, mysql tabulas izveidojas automātiski, bet nevajag taču visiem visu pasniegt uz paplātes. Vai tad nepietiek mums te ar visiem tiem 7,8,9gadīgo serveriem?)

Link to comment
Share on other sites

scorpion... izlasi 1 postu:

Lūdzu palīdziet lasiju jau tā topika komentārus bet tur tāpat netika izspriezts kā pareizi visu izdarīt , jo es nebiju vienīgais kam šo rāda ! Liels paldies ka veltijāt šim uzmanību cerams visu sapratāt un spēsiet palīdzēt !

This post has been edited by Dr.Inokentijs: May 10 2009, 10:22

tas plugins tika nonemts, jo daudziem kaut kas ar vinu negaja, es uztaisiju jaunu

tikai ir brīži, kad pēkšņi plugins tā teikt iestrēgst un tikai pēc mapes nomaiņas viss sakārtojas

pie kadiem procesiem tas notiek?

Link to comment
Share on other sites

Kaut kad jau biju lasījis šo topiku. Sākumā man arī nezināmu iemeslu dēļ tas plugins meta tādus pašus gļukus un nestrādāja, bet pēc kāda laika, kad mēģināju likt vēlreiz viss aizgāja un šobrīd nekādas problēmas vēl nav radušās...

Nepateikšu pie kuriem procesiem kaut kas nočakarējās, bet pēkšņi pamanīju, lai arī mape jau gandrīz galā, monitors rāda, ka atlikušas vēl 18 min un ar spēlētājiem arī kaut kāds gļuks... āāāā. tas varēja būt apmēram pēc tam, kad admins ieradās....

Šobrīd arī ir kaut kāds gļuks un rāda spēlētajus ar 0 kills, 0 deaths, un arī timeleft = maxtime = 30 min, bet pagājušas jau 5 min no mapes sākuma (viens admins ir serverī)(spēlētājus, kas šobrīd ir online uzrāda precīzi un viņu daudzums mainās)...

P.S. Neko daudz no pawn nesaprotu, bet vajadzētu tā, ka pēc katra kill monitora dati atjaunojas (iekš mysql) un ja, piemēram, spēlētāju nav, tad ik pa 10 sekundēm, piemēram.

P.S.S. Paņemšu pāris labas idejas no tava plugina, no iepriekš veidotā monitora plugina un būs man pašam savs ekskluzīvs monitors.

Edited by SCORPIONS
Link to comment
Share on other sites

monitora dati atjaunojas katru raundu, ja nav speletaju var protams uztaisit, ka vairak, bet pec katra killa bus diezgan traki :D ... xm...

varetu uztaisit tasku, kurs visu laiku atkartojas pec kadam 30 sekundem... rit paskatishos...

P.S. Neko daudz no pawn nesaprotu

P.S.S. Paņemšu pāris labas idejas no tava plugina, no iepriekš veidotā monitora plugina un būs man pašam savs ekskluzīvs monitors.

:D velu veiksmi

a ja scorpion... cik skatos tev ir kads projekts, uz kura tu uzliki monitoru... vari man atsutit pm ar projekta web'u, lai es pats paskatitos, ka tas monitors strada...

Link to comment
Share on other sites

Access denied for user 'root'@'localhost' using password yes

šo man raksta pie tava plugina kad uzrakstu amx_plugins un visus iestatījumus itkā esmu pareizi sarakstījis

Localhost

root

parole

monitor

Edited by Ins1d3r
Link to comment
Share on other sites

replace_all(pl_name, 55, "<", "<")
replace_all(pl_name, 55, ">", ">")

Šito mierīgi var darīt pie izvades, nevis ievades.

Nezinu vai sqlx modulis nodrošina automātisku kveriju eskeipošanu, bet ja nē, tad pie tā arī vajadzētu piedomāt.

Link to comment
Share on other sites

Šito mierīgi var darīt pie izvades, nevis ievades.

kā izvades? es to daru, lai tie, kuri sev niku pārtaisa par, piem., <font color=brown>remix.cc ; servera monitora neparādās ar brūnu krāsu, bet pats vēlāk, ja spēlētājs ir admins pielieku vinam to < fontu...>, protams to "<" pie nika varētu arī ar php palīdzību novērst, bet es to neprotu, un, to, vai speletajs ir admins, var uztaisīt jaunu table un tur salikt +/- ...

Nezinu vai sqlx modulis nodrošina automātisku kveriju eskeipošanu, bet ja nē, tad pie tā arī vajadzētu piedomāt.

Nesapratu...

Link to comment
Share on other sites

Saliec atstarpes(paskaties uz manu pluginu), liec visus kodus blokos un indento kodu. Lūdzu. Ieteicams arī komentēt, ko tu kur dari, lai tādi, kas pirmo reizi iebrauc tavā kodā arī kaut ko saprastu, neštukojot 10 minūtes. Variables(mainīgos) ieteicams izmantot nosaukumus, kuri ļautu saprast, ko viņi dara neskatoties uz pārējo kodu.

Piemēram:

new bool:g_GameRestarted - uzreiz var saprast, ka viņš ir true, ja spēle ir restartējusies.

Raksti visus mainīgo nosaukumus tā, lai var saprast.

Neraksti:

plrgunamtinoneround

Raksti vainu šādi:

PlayerGunAmountInOneRound

Vai arī šādi:

player_gun_amount_in_one_round

Liec g_ priekšā globālajiem mainīgajiem, c_ cvariem, cp_ cvar pointeriem utt.

Edited by shine
Link to comment
Share on other sites

Nu tad ar to, ka noņem ' (quotes) pietiek, lai nenonestu visu datubāzi???

INFO to remix.cc

Problēma, kas rodas, ir tāda, ka ja admins ieiet serverī, viņš uzrādās kā administrators (respektīvi remix pluginā zaļā krāsā), bet, ja administrators nomaina niku, viņš vienalga uzrādīsies zaļā krāsā...

Link to comment
Share on other sites

scorpion, es to zinu.. es to speciali ta atstaju... :D vai tad tas, ka tu mani niku, maina tavu statusu? :D

Edit, tip ta? vismaz @ amxx side... php es neko tik un ta nesaprotu...

Edited by remix.cc
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share


×
×
  • Create New...