Sign in to follow this  
Followers 0
Shakoladka

/afly - свободная камера, полёт по карте, спек за игроками

3 posts in this topic

Многие ищут эту команду и флудят темами поэтому я решил кинуть сюда эту команду. Нам понадобятся: плагин DC/ZCMD, лучше ZCMD и мод.
Вставляем в конец мода:

Спойлер
CMD:afly(playerid,params[])
{
    if(antiflood[playerid] > 0) return SendClientMessage(playerid, COLOR_WARNING,"Не флуди!");
    antiflood[playerid]++;
        if(PLAYER_DATA[playerid][data_LOGGED] == false) return SendClientMessage(playerid,COLOR_WARNING,"Вы не авторизованы на сервере!");
    if(PLAYER_DATA[playerid][data_ADMLVL] < 1) return true;
    SetPVarInt(playerid,"spawn_ac",1);
     
        if(GetPVarType(playerid, "FlyMode"))
        {
            new inter, world, Float:X, Float:Y, Float:Z, Float:FA;
            GetPlayerHealth(playerid,PLAYER_DATA[playerid][data_HP]);
                GetPlayerPos(playerid, X, Y, Z);
                GetPlayerFacingAngle(playerid, FA);
                inter = GetPlayerInterior(playerid);
                world = GetPlayerVirtualWorld(playerid);
                SetPVarFloat(playerid, "SpecX", X);
                SetPVarFloat(playerid, "SpecY", Y);
                SetPVarFloat(playerid, "SpecZ", Z);
                SetPVarFloat(playerid, "SpecFA", FA);
                SetPVarInt(playerid, "SpecInt", inter);
                SetPVarInt(playerid, "SpecWorld", world);
                 
                CancelFlyMode(playerid);
        }
        else
        {
                SetPVarInt(playerid, "SpecBool", 1);
                FlyMode(playerid);
        }
        return true;
}

Вот и всё, скорее всего придётся менять переменные. 
Команда из мода +RP.

Спойлер
stock CancelFlyMode(playerid)
{
        DeletePVar(playerid, "FlyMode");
        CancelEdit(playerid);
        TogglePlayerSpectating(playerid, false);
 
        DestroyPlayerObject(playerid, noclipdata[playerid][flyobject]);
        noclipdata[playerid][cameramode] = CAMERA_MODE_NONE;
        return 1;
}
 
 
stock FlyMode(playerid)
{
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        noclipdata[playerid][flyobject] = CreatePlayerObject(playerid, 19300, X, Y, Z, 0.0, 0.0, 0.0);
 
        TogglePlayerSpectating(playerid, true);
        AttachCameraToPlayerObject(playerid, noclipdata[playerid][flyobject]);
 
        SetPVarInt(playerid, "FlyMode", 1);
        noclipdata[playerid][cameramode] = CAMERA_MODE_FLY;
        return 1;
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
stock GetMoveDirectionFromKeys(ud, lr)
{
        new direction = 0;
        if(lr < 0)
        {
                if(ud < 0) direction = MOVE_FORWARD_LEFT;
                else if(ud > 0) direction = MOVE_BACK_LEFT;
                else direction = MOVE_LEFT;
        }
        else if(lr > 0)
        {
                if(ud < 0) direction = MOVE_FORWARD_RIGHT;
                else if(ud > 0) direction = MOVE_BACK_RIGHT;
                else direction = MOVE_RIGHT;
        }
        else if(ud < 0) direction = MOVE_FORWARD;
        else if(ud > 0) direction = MOVE_BACK;
        return direction;
}
//--------------------------------------------------
stock MoveCamera(playerid)
{
        new Float:FV[3], Float:CPR[3];
        GetPlayerCameraPos(playerid, CPR[0], CPR[1], CPR[2]);
    GetPlayerCameraFrontVector(playerid, FV[0], FV[1], FV[2]);
 
        if(noclipdata[playerid][accelmul] <= 1) noclipdata[playerid][accelmul] += ACCEL_RATE;
 
        new Float:speed = MOVE_SPEED * noclipdata[playerid][accelmul];
 
        new Float:X, Float:Y, Float:Z;
        GetNextCameraPosition(noclipdata[playerid][mode], CPR, FV, X, Y, Z);
        MovePlayerObject(playerid, noclipdata[playerid][flyobject], X, Y, Z, speed);
 
        noclipdata[playerid][lastmove] = GetTickCount();
        return 1;
}
//--------------------------------------------------
stock GetNextCameraPosition(move_mode, Float:CPR[3], Float:FV[3], &Float:X, &Float:Y, &Float:Z)
{
    #define OFFSET_X (FV[0]*6000.0)
        #define OFFSET_Y (FV[1]*6000.0)
        #define OFFSET_Z (FV[2]*6000.0)
        switch(move_mode)
        {
                case MOVE_FORWARD:
                {
                        X = CPR[0]+OFFSET_X;
                        Y = CPR[1]+OFFSET_Y;
                        Z = CPR[2]+OFFSET_Z;
                }
                case MOVE_BACK:
                {
                        X = CPR[0]-OFFSET_X;
                        Y = CPR[1]-OFFSET_Y;
                        Z = CPR[2]-OFFSET_Z;
                }
                case MOVE_LEFT:
                {
                        X = CPR[0]-OFFSET_Y;
                        Y = CPR[1]+OFFSET_X;
                        Z = CPR[2];
                }
                case MOVE_RIGHT:
                {
                        X = CPR[0]+OFFSET_Y;
                        Y = CPR[1]-OFFSET_X;
                        Z = CPR[2];
                }
                case MOVE_BACK_LEFT:
                {
                        X = CPR[0]+(-OFFSET_X - OFFSET_Y);
                         Y = CPR[1]+(-OFFSET_Y + OFFSET_X);
                         Z = CPR[2]-OFFSET_Z;
                }
                case MOVE_BACK_RIGHT:
                {
                        X = CPR[0]+(-OFFSET_X + OFFSET_Y);
                         Y = CPR[1]+(-OFFSET_Y - OFFSET_X);
                         Z = CPR[2]-OFFSET_Z;
                }
                case MOVE_FORWARD_LEFT:
                {
                        X = CPR[0]+(OFFSET_X  - OFFSET_Y);
                        Y = CPR[1]+(OFFSET_Y  + OFFSET_X);
                        Z = CPR[2]+OFFSET_Z;
                }
                case MOVE_FORWARD_RIGHT:
                {
                        X = CPR[0]+(OFFSET_X  + OFFSET_Y);
                        Y = CPR[1]+(OFFSET_Y  - OFFSET_X);
                        Z = CPR[2]+OFFSET_Z;
                }
        }
}

в OnPlayerSpawn:

Спойлер
if(GetPVarInt(playerid, "SpecBool") == 1)
       {
               DeletePVar(playerid, "SpecBool");
               new Float:X = GetPVarFloat(playerid, "SpecX"), Float:Y = GetPVarFloat(playerid, "SpecY"), Float:Z = GetPVarFloat(playerid, "SpecZ"),
               Float:FA = GetPVarFloat(playerid, "SpecFA"), inter = GetPVarInt(playerid, "SpecInt"), world = GetPVarInt(playerid, "SpecWorld");
               DeletePVar(playerid, "SpecX");
               DeletePVar(playerid, "SpecY");
               DeletePVar(playerid, "SpecZ");
               DeletePVar(playerid, "SpecFA");
               DeletePVar(playerid, "SpecInt");
               DeletePVar(playerid, "SpecWorld");
               SetPlayerPos(playerid, X, Y, Z);
               SetPlayerFacingAngle(playerid, FA);
               SetPlayerVirtualWorld(playerid, world);
               SetPlayerInterior(playerid, inter);
               SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
               if(PlayerInfo[playerid][pWanted] > 0) SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWanted]);
               if(PlayerInfo[playerid][pSkin] > 0) SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
               else SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
               return true;
       }

к new:

Спойлер
enum noclipenum
{
        cameramode,flyobject,mode,lrold,udold,lastmove,Float:accelmul
}
new noclipdata[MAX_PLAYERS][noclipenum];

OnPlayerConnect:

Спойлер
noclipdata[playerid][cameramode] = CAMERA_MODE_NONE;
noclipdata[playerid][lrold] = 0;
noclipdata[playerid][udold] = 0;
noclipdata[playerid][mode] = 0;
noclipdata[playerid][lastmove] = 0;
noclipdata[playerid][accelmul] = 0.0;

OnPlayerUpdate:

Спойлер
if(noclipdata[playerid][cameramode] == CAMERA_MODE_FLY)
       {
               new keys,ud,lr;
               GetPlayerKeys(playerid,keys,ud,lr);
 
               if(noclipdata[playerid][mode] && (GetTickCount() - noclipdata[playerid][lastmove] > 100))
               {
                       MoveCamera(playerid);
               }
               if(noclipdata[playerid][udold] != ud || noclipdata[playerid][lrold] != lr)
               {
                       if((noclipdata[playerid][udold] != 0 || noclipdata[playerid][lrold] != 0) && ud == 0 && lr == 0)
                       {
                               StopPlayerObject(playerid, noclipdata[playerid][flyobject]);
                               noclipdata[playerid][mode]      = 0;
                               noclipdata[playerid][accelmul]  = 0.0;
                       }
                       else
                       {
                               noclipdata[playerid][mode] = GetMoveDirectionFromKeys(ud, lr);
                               MoveCamera(playerid);
                       }
               }
               noclipdata[playerid][udold] = ud; noclipdata[playerid][lrold] = lr;
               return 0;
       }

 

Если что то не будет работать, то это из-за переменных. 

Share this post


Link to post
Share on other sites

ты не полностью вырезал систему

Share this post


Link to post
Share on other sites

ко всем define

#define MOVE_SPEED 100.0
#define ACCEL_RATE 0.03
#define CAMERA_MODE_NONE 0
#define CAMERA_MODE_FLY 1
#define MOVE_FORWARD 1
#define MOVE_BACK 2
#define MOVE_LEFT 3
#define MOVE_RIGHT 4
#define MOVE_FORWARD_LEFT 5
#define MOVE_FORWARD_RIGHT 6
#define MOVE_BACK_LEFT 7
#define MOVE_BACK_RIGHT 8

 

Edited by kut1r0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content