Parasiutas vipams

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Parasiutas vipams

Post by nuodas159 »

Code: Select all

#include <amxmodx>#include <fakemeta>#include <engine> new PLUGIN_NAME[]   = "Parasiutas"new PLUGIN_AUTHOR[]     = "`GuM"new PLUGIN_VERSION[]    = "1.0" new const parachute_model[] = "models/parachute.mdl" new bool:has_parachute[33]new para_ent[33]new parachute_FallSpeed, parachute_Detachpublic plugin_init() {    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)     parachute_FallSpeed = register_cvar("parachute_fallspeed", "30")    parachute_Detach = register_cvar("parachute_detach", "1")     register_forward(FM_PlayerPreThink,"PlayerPree_Think");}public plugin_precache()    engfunc(EngFunc_PrecacheModel, parachute_model)public item_enabled(id) {    has_parachute[id] = true}public client_connect(id) {    parachute_reset(id)    has_parachute[id] = false} parachute_reset(id){    if (para_ent[id] > 0)     {        if ( pev_valid(para_ent[id]) )             engfunc(EngFunc_RemoveEntity, para_ent[id])    }     has_parachute[id] = true    para_ent[id] = 0}public PlayerPree_Think(id){     if (!is_user_alive(id) || !has_parachute[id] )        return     new Float:fallspeed = get_pcvar_float(parachute_FallSpeed) * -1.0    new Float:frame     new button = pev(id, pev_button)    new oldbutton = pev(id, pev_oldbuttons)    new flags = pev(id, pev_flags)     if (para_ent[id] > 0 && (flags & FL_ONGROUND))     {        set_view(id, CAMERA_NONE)                if (get_pcvar_num(parachute_Detach))         {            if ( pev(para_ent[id],pev_sequence) != 2 )             {                set_pev(para_ent[id], pev_sequence, 2)                set_pev(para_ent[id], pev_gaitsequence, 1)                set_pev(para_ent[id], pev_frame, 0.0)                set_pev(para_ent[id], pev_fuser1, 0.0)                set_pev(para_ent[id], pev_animtime, 0.0)                return            }                        pev(para_ent[id],pev_fuser1, frame)            frame += 2.0            set_pev(para_ent[id],pev_fuser1,frame)            set_pev(para_ent[id],pev_frame,frame)                        if ( frame > 254.0 )            {                engfunc(EngFunc_RemoveEntity, para_ent[id])                para_ent[id] = 0            }        }        else         {            engfunc(EngFunc_RemoveEntity, para_ent[id])            para_ent[id] = 0        }        return    }     if (button & IN_USE && get_user_team(id) == 2)     {        new Float:velocity[3]        pev(id, pev_velocity, velocity)                if (velocity[2] < 0.0)         {            if(para_ent[id] <= 0)             {                para_ent[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))                                if(para_ent[id] > 0)                 {                    set_pev(para_ent[id],pev_classname,"parachute")                    set_pev(para_ent[id], pev_aiment, id)                    set_pev(para_ent[id], pev_owner, id)                    set_pev(para_ent[id], pev_movetype, MOVETYPE_FOLLOW)                    engfunc(EngFunc_SetModel, para_ent[id], parachute_model)                    set_pev(para_ent[id], pev_sequence, 0)                    set_pev(para_ent[id], pev_gaitsequence, 1)                    set_pev(para_ent[id], pev_frame, 0.0)                    set_pev(para_ent[id], pev_fuser1, 0.0)                }            }                        if (para_ent[id] > 0)             {                set_pev(id, pev_sequence, 3)                set_pev(id, pev_gaitsequence, 1)                set_pev(id, pev_frame, 1.0)                set_pev(id, pev_framerate, 1.0)                            velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed                set_pev(id, pev_velocity, velocity)                                if (pev(para_ent[id],pev_sequence) == 0)                 {                    pev(para_ent[id],pev_fuser1, frame)                    frame += 1.0                    set_pev(para_ent[id],pev_fuser1,frame)                    set_pev(para_ent[id],pev_frame,frame)                                        if (frame > 100.0)                     {                        set_pev(para_ent[id], pev_animtime, 0.0)                        set_pev(para_ent[id], pev_framerate, 0.4)                        set_pev(para_ent[id], pev_sequence, 1)                        set_pev(para_ent[id], pev_gaitsequence, 1)                        set_pev(para_ent[id], pev_frame, 0.0)                        set_pev(para_ent[id], pev_fuser1, 0.0)                    }                }            }        }                else if (para_ent[id] > 0)         {            engfunc(EngFunc_RemoveEntity, para_ent[id])            para_ent[id] = 0        }    }        else if ((oldbutton & IN_USE) && para_ent[id] > 0 )     {        engfunc(EngFunc_RemoveEntity, para_ent[id])        para_ent[id] = 0    }}
Kaip padaryti ,kad vipui duotu?
P.S man kazko neiseina errorus meto bekopilindimas kas pades +karma
Image

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: Parasiutas vipams

Post by aaarnas »

Galima tiesiog:

Code: Select all

public client_connect(id) {        parachute_reset(id)    has_parachute[id] = false}
--->>>

Code: Select all

public client_connect(id) {        parachute_reset(id)    if(get_user_flags(id) & ADMIN_LEVEL_H) has_parachute[id] = true    else has_parachute[id] = false}
Bet čia reikės prisijungti per naujo žaidėjui, jei jis gaus vip žaidimo metu.

Kitas būdas šitas:

Code: Select all

if (!is_user_alive(id) || !has_parachute[id] )        return
---->>>

Code: Select all

if (!is_user_alive(id) || !has_parachute[id] || !(get_user_flags(id) & ADMIN_LEVEL_H))        return
Bet šitas man nepatinka, nes get_user_flags be reikalo labai dažniai iškvietinėjamas.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Re: Parasiutas vipams

Post by nuodas159 »

Na kazkodel vipams neduoda parasiuta! ;/
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest