Programación en Pawn - SAMP

[FS] Armas en el cuerpo (con cambio de posición)

¿Tienes un FilterScript muy bueno y quieres compartirlo con los demás? ¿Qué esperas? ¡Muéstranoslo aquí!
Reglas del Foro

  • Al liberar un FilterScript, debes informar sobre qué trata el código claramente, imágenes o vídeos y la explicación de cómo usarlo.
  • Si el link de descarga no funciona, el tema será movido a la papelera sin aviso.
  • Si no eres el autor del FilterScript o has utilizado códigos de otros autores, recuerda colocar los créditos correspondientes. (El plagio es motivo de sanción).

Moderador: Ayudantes

Hola comunidad de PawnScript, hoy les vengo compartiendo un [FS] muy bueno que me encontre en el forum de samp
Se trata de que cuando tu poner el cmd /editararma, te cambiara la posicion del arma en donde la tengas.
El arma por Default aparece en el pecho, pero tu la puedes configurar al lado y posicion que mas te guste con ese simple cmd.

CMD:

/editararma [ajustarposicion/bone/hide]

Videos/Imagenes: como ya dije anteriormente el FS es muy simple, asi que no creo que haga falta subir imagenes
Descarga:
 Codigo Pawno:
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255

//Weapons on body system by GoldenLion
//Traducido por OrlandoRivas

#define FILTERSCRIPT

#include <a_samp>

#undef MAX_PLAYERS
#define MAX_PLAYERS 100

#define DIALOG_EDIT_BONE 5000
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

enum weaponSettings
{
    Float:Position[6],
    Bone,
    Hidden
}
new WeaponSettings[MAX_PLAYERS][17][weaponSettings], WeaponTick[MAX_PLAYERS], EditingWeapon[MAX_PLAYERS];

GetWeaponObjectSlot(weaponid)
{
    new objectslot;

    switch (weaponid)
    {
        case 22..24: objectslot = 0;
        case 25..27: objectslot = 1;
        case 28, 29, 32: objectslot = 2;
        case 30, 31: objectslot = 3;
        case 33, 34: objectslot = 4;
        case 35..38: objectslot = 5;
    }
    return objectslot;
}

GetWeaponModel(weaponid) //Solo devolverá el modelo de armas portátiles (22-38)
{
    new model;

    switch(weaponid)
    {
        case 22..29: model = 324 + weaponid;
        case 30: model = 355;
        case 31: model = 356;
        case 32: model = 372;
        case 33..38: model = 324 + weaponid;
    }
    return model;
}

PlayerHasWeapon(playerid, weaponid)
{
    new weapon, ammo;

    for (new i; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapon, ammo);
        if (weapon == weaponid && ammo) return 1;
    }
    return 0;
}

IsWeaponWearable(weaponid)
    return (weaponid >= 22 && weaponid <= 38);

IsWeaponHideable(weaponid)
    return (weaponid >= 22 && weaponid <= 24 || weaponid == 28 || weaponid == 32);

public OnPlayerUpdate(playerid)
{
    if (NetStats_GetConnectedTime(playerid) - WeaponTick[playerid] >= 250)
    {
        new weaponid, ammo, objectslot, count, index;

        for (new i = 2; i <= 7; i++) //Bucle solo a través de las ranuras que pueden contener las armas portátiles
        {
            GetPlayerWeaponData(playerid, i, weaponid, ammo);
            index = weaponid - 22;

            if (weaponid && ammo && !WeaponSettings[playerid][index][Hidden] && IsWeaponWearable(weaponid) && EditingWeapon[playerid] != weaponid)
            {
                objectslot = GetWeaponObjectSlot(weaponid);

                if (GetPlayerWeapon(playerid) != weaponid)
                    SetPlayerAttachedObject(playerid, objectslot, GetWeaponModel(weaponid), WeaponSettings[playerid][index][Bone], WeaponSettings[playerid][index][Position][0], WeaponSettings[playerid][index][Position][1], WeaponSettings[playerid][index][Position][2], WeaponSettings[playerid][index][Position][3], WeaponSettings[playerid][index][Position][4], WeaponSettings[playerid][index][Position][5], 1.0, 1.0, 1.0);

                else if (IsPlayerAttachedObjectSlotUsed(playerid, objectslot)) RemovePlayerAttachedObject(playerid, objectslot);
            }
        }
        for (new i; i <= 5; i++) if (IsPlayerAttachedObjectSlotUsed(playerid, i))
        {
            count = 0;

            for (new j = 22; j <= 38; j++) if (PlayerHasWeapon(playerid, j) && GetWeaponObjectSlot(j) == i)
                count++;

            if (!count) RemovePlayerAttachedObject(playerid, i);
        }
        WeaponTick[playerid] = NetStats_GetConnectedTime(playerid);
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    for (new i; i < 17; i++)
    {
        WeaponSettings[playerid][i][Position][0] = -0.116;
        WeaponSettings[playerid][i][Position][1] = 0.189;
        WeaponSettings[playerid][i][Position][2] = 0.088;
        WeaponSettings[playerid][i][Position][3] = 0.0;
        WeaponSettings[playerid][i][Position][4] = 44.50;
        WeaponSettings[playerid][i][Position][5] = 0.0;
        WeaponSettings[playerid][i][Bone] = 1;
        WeaponSettings[playerid][i][Hidden] = false;
    }
    WeaponTick[playerid] = 0;
    EditingWeapon[playerid] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == DIALOG_EDIT_BONE)
    {
        if (response)
        {
            new weaponid = EditingWeapon[playerid], weaponname[18], string[68];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));
            WeaponSettings[playerid][weaponid - 22][Bone] = listitem + 1;

            format(string, sizeof(string), "Has cambiado con éxito el hueso de tu %s.", weaponname);
            SendClientMessage(playerid, -1, string);
        }
        EditingWeapon[playerid] = 0;
        return 1;
    }
    return 0;
}

public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
    new weaponid = EditingWeapon[playerid];

    if (weaponid)
    {
        if (response)
        {
            new enum_index = weaponid - 22, weaponname[18], string[80];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));

            WeaponSettings[playerid][enum_index][Position][0] = fOffsetX;
            WeaponSettings[playerid][enum_index][Position][1] = fOffsetY;
            WeaponSettings[playerid][enum_index][Position][2] = fOffsetZ;
            WeaponSettings[playerid][enum_index][Position][3] = fRotX;
            WeaponSettings[playerid][enum_index][Position][4] = fRotY;
            WeaponSettings[playerid][enum_index][Position][5] = fRotZ;

            RemovePlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid));
            SetPlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid), GetWeaponModel(weaponid), WeaponSettings[playerid][enum_index][Bone], fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, 1.0, 1.0, 1.0);

            format(string, sizeof(string), "Has cambiado con éxito el hueso de tu %s.", weaponname);
            SendClientMessage(playerid, -1, string);
        }
        EditingWeapon[playerid] = 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[24], params[64], len = strlen(cmdtext);

    for (new i; i < len; i++) if (cmdtext[i] == ' ')
    {
        strmid(cmd, cmdtext, 0, i);
        strcat(params, cmdtext[i + 1]);
        break;
    }
    if (isnull(cmd)) strcat(cmd, cmdtext);

    if (!strcmp(cmd, "/editararma", true))
    {
        new weaponid = GetPlayerWeapon(playerid);

        if (!weaponid)
            return SendClientMessage(playerid, -1, "No estás sosteniendo un arma.");

        if (!IsWeaponWearable(weaponid))
            return SendClientMessage(playerid, -1, "Esta arma no puede ser editada.");

        if (isnull(params))
            return SendClientMessage(playerid, -1, "USE: /editararma [ajustarposicion/bone/hide]");

        if (!strcmp(params, "ajustarposicion", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "Ya estás editando un arma.");

            if (WeaponSettings[playerid][weaponid - 22][Hidden])
                return SendClientMessage(playerid, -1, "No puedes ajustar un arma oculta.");

            new index = weaponid - 22;

            SetPlayerArmedWeapon(playerid, 0);

            SetPlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid), GetWeaponModel(weaponid), WeaponSettings[playerid][index][Bone], WeaponSettings[playerid][index][Position][0], WeaponSettings[playerid][index][Position][1], WeaponSettings[playerid][index][Position][2], WeaponSettings[playerid][index][Position][3], WeaponSettings[playerid][index][Position][4], WeaponSettings[playerid][index][Position][5], 1.0, 1.0, 1.0);
            EditAttachedObject(playerid, GetWeaponObjectSlot(weaponid));

            EditingWeapon[playerid] = weaponid;
        }
        else if (!strcmp(params, "bone", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "Ya estás editando un arma.");

            ShowPlayerDialog(playerid, DIALOG_EDIT_BONE, DIALOG_STYLE_LIST, "Bone", "Spine\nHead\nLeft upper arm\nRight upper arm\nLeft hand\nRight hand\nLeft thigh\nRight thigh\nLeft foot\nRight foot\nRight calf\nLeft calf\nLeft forearm\nRight forearm\nLeft shoulder\nRight shoulder\nNeck\nJaw", "Choose", "Cancel");
            EditingWeapon[playerid] = weaponid;
        }
        else if (!strcmp(params, "hide", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "No puedes ocultar un arma mientras la estás editando.");

            if (!IsWeaponHideable(weaponid))
                return SendClientMessage(playerid, -1, "Esta arma no puede ser escondida.");

            new index = weaponid - 22, weaponname[18], string[48];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));

            if (WeaponSettings[playerid][index][Hidden])
            {
                format(string, sizeof(string), "Usted ha establecido su %s mostrar.", weaponname);
                WeaponSettings[playerid][index][Hidden] = false;
            }
            else
            {
                if (IsPlayerAttachedObjectSlotUsed(playerid, GetWeaponObjectSlot(weaponid)))
                    RemovePlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid));

                format(string, sizeof(string), "Ha configurado su %s para que no se muestre.", weaponname);
                WeaponSettings[playerid][index][Hidden] = true;
            }
            SendClientMessage(playerid, -1, string);
        }
        else SendClientMessage(playerid, -1, "Has especificado una opción inválida.");
        return 1;
    }
    return 0;
}
  Cantidad de llaves: Abiertas(28)-Cerradas(28) | Lineas Totales: 255
SALUDOS!
Orlando Rivas escribió:
03 Ago 2018 22:53
Hola comunidad de PawnScript, hoy les vengo compartiendo un [FS] muy bueno que me encontre en el forum de samp
Se trata de que cuando tu poner el cmd /editararma, te cambiara la posicion del arma en donde la tengas.
El arma por Default aparece en el pecho, pero tu la puedes configurar al lado y posicion que mas te guste con ese simple cmd.

CMD:

/editararma [ajustarposicion/bone/hide]

Videos/Imagenes: como ya dije anteriormente el FS es muy simple, asi que no creo que haga falta subir imagenes
Descarga:
 Codigo Pawno:
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255

//Weapons on body system by GoldenLion
//Traducido por OrlandoRivas

#define FILTERSCRIPT

#include <a_samp>

#undef MAX_PLAYERS
#define MAX_PLAYERS 100

#define DIALOG_EDIT_BONE 5000
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

enum weaponSettings
{
    Float:Position[6],
    Bone,
    Hidden
}
new WeaponSettings[MAX_PLAYERS][17][weaponSettings], WeaponTick[MAX_PLAYERS], EditingWeapon[MAX_PLAYERS];

GetWeaponObjectSlot(weaponid)
{
    new objectslot;

    switch (weaponid)
    {
        case 22..24: objectslot = 0;
        case 25..27: objectslot = 1;
        case 28, 29, 32: objectslot = 2;
        case 30, 31: objectslot = 3;
        case 33, 34: objectslot = 4;
        case 35..38: objectslot = 5;
    }
    return objectslot;
}

GetWeaponModel(weaponid) //Solo devolverá el modelo de armas portátiles (22-38)
{
    new model;

    switch(weaponid)
    {
        case 22..29: model = 324 + weaponid;
        case 30: model = 355;
        case 31: model = 356;
        case 32: model = 372;
        case 33..38: model = 324 + weaponid;
    }
    return model;
}

PlayerHasWeapon(playerid, weaponid)
{
    new weapon, ammo;

    for (new i; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapon, ammo);
        if (weapon == weaponid && ammo) return 1;
    }
    return 0;
}

IsWeaponWearable(weaponid)
    return (weaponid >= 22 && weaponid <= 38);

IsWeaponHideable(weaponid)
    return (weaponid >= 22 && weaponid <= 24 || weaponid == 28 || weaponid == 32);

public OnPlayerUpdate(playerid)
{
    if (NetStats_GetConnectedTime(playerid) - WeaponTick[playerid] >= 250)
    {
        new weaponid, ammo, objectslot, count, index;

        for (new i = 2; i <= 7; i++) //Bucle solo a través de las ranuras que pueden contener las armas portátiles
        {
            GetPlayerWeaponData(playerid, i, weaponid, ammo);
            index = weaponid - 22;

            if (weaponid && ammo && !WeaponSettings[playerid][index][Hidden] && IsWeaponWearable(weaponid) && EditingWeapon[playerid] != weaponid)
            {
                objectslot = GetWeaponObjectSlot(weaponid);

                if (GetPlayerWeapon(playerid) != weaponid)
                    SetPlayerAttachedObject(playerid, objectslot, GetWeaponModel(weaponid), WeaponSettings[playerid][index][Bone], WeaponSettings[playerid][index][Position][0], WeaponSettings[playerid][index][Position][1], WeaponSettings[playerid][index][Position][2], WeaponSettings[playerid][index][Position][3], WeaponSettings[playerid][index][Position][4], WeaponSettings[playerid][index][Position][5], 1.0, 1.0, 1.0);

                else if (IsPlayerAttachedObjectSlotUsed(playerid, objectslot)) RemovePlayerAttachedObject(playerid, objectslot);
            }
        }
        for (new i; i <= 5; i++) if (IsPlayerAttachedObjectSlotUsed(playerid, i))
        {
            count = 0;

            for (new j = 22; j <= 38; j++) if (PlayerHasWeapon(playerid, j) && GetWeaponObjectSlot(j) == i)
                count++;

            if (!count) RemovePlayerAttachedObject(playerid, i);
        }
        WeaponTick[playerid] = NetStats_GetConnectedTime(playerid);
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    for (new i; i < 17; i++)
    {
        WeaponSettings[playerid][i][Position][0] = -0.116;
        WeaponSettings[playerid][i][Position][1] = 0.189;
        WeaponSettings[playerid][i][Position][2] = 0.088;
        WeaponSettings[playerid][i][Position][3] = 0.0;
        WeaponSettings[playerid][i][Position][4] = 44.50;
        WeaponSettings[playerid][i][Position][5] = 0.0;
        WeaponSettings[playerid][i][Bone] = 1;
        WeaponSettings[playerid][i][Hidden] = false;
    }
    WeaponTick[playerid] = 0;
    EditingWeapon[playerid] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == DIALOG_EDIT_BONE)
    {
        if (response)
        {
            new weaponid = EditingWeapon[playerid], weaponname[18], string[68];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));
            WeaponSettings[playerid][weaponid - 22][Bone] = listitem + 1;

            format(string, sizeof(string), "Has cambiado con éxito el hueso de tu %s.", weaponname);
            SendClientMessage(playerid, -1, string);
        }
        EditingWeapon[playerid] = 0;
        return 1;
    }
    return 0;
}

public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
    new weaponid = EditingWeapon[playerid];

    if (weaponid)
    {
        if (response)
        {
            new enum_index = weaponid - 22, weaponname[18], string[80];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));

            WeaponSettings[playerid][enum_index][Position][0] = fOffsetX;
            WeaponSettings[playerid][enum_index][Position][1] = fOffsetY;
            WeaponSettings[playerid][enum_index][Position][2] = fOffsetZ;
            WeaponSettings[playerid][enum_index][Position][3] = fRotX;
            WeaponSettings[playerid][enum_index][Position][4] = fRotY;
            WeaponSettings[playerid][enum_index][Position][5] = fRotZ;

            RemovePlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid));
            SetPlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid), GetWeaponModel(weaponid), WeaponSettings[playerid][enum_index][Bone], fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, 1.0, 1.0, 1.0);

            format(string, sizeof(string), "Has cambiado con éxito el hueso de tu %s.", weaponname);
            SendClientMessage(playerid, -1, string);
        }
        EditingWeapon[playerid] = 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[24], params[64], len = strlen(cmdtext);

    for (new i; i < len; i++) if (cmdtext[i] == ' ')
    {
        strmid(cmd, cmdtext, 0, i);
        strcat(params, cmdtext[i + 1]);
        break;
    }
    if (isnull(cmd)) strcat(cmd, cmdtext);

    if (!strcmp(cmd, "/editararma", true))
    {
        new weaponid = GetPlayerWeapon(playerid);

        if (!weaponid)
            return SendClientMessage(playerid, -1, "No estás sosteniendo un arma.");

        if (!IsWeaponWearable(weaponid))
            return SendClientMessage(playerid, -1, "Esta arma no puede ser editada.");

        if (isnull(params))
            return SendClientMessage(playerid, -1, "USE: /editararma [ajustarposicion/bone/hide]");

        if (!strcmp(params, "ajustarposicion", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "Ya estás editando un arma.");

            if (WeaponSettings[playerid][weaponid - 22][Hidden])
                return SendClientMessage(playerid, -1, "No puedes ajustar un arma oculta.");

            new index = weaponid - 22;

            SetPlayerArmedWeapon(playerid, 0);

            SetPlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid), GetWeaponModel(weaponid), WeaponSettings[playerid][index][Bone], WeaponSettings[playerid][index][Position][0], WeaponSettings[playerid][index][Position][1], WeaponSettings[playerid][index][Position][2], WeaponSettings[playerid][index][Position][3], WeaponSettings[playerid][index][Position][4], WeaponSettings[playerid][index][Position][5], 1.0, 1.0, 1.0);
            EditAttachedObject(playerid, GetWeaponObjectSlot(weaponid));

            EditingWeapon[playerid] = weaponid;
        }
        else if (!strcmp(params, "bone", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "Ya estás editando un arma.");

            ShowPlayerDialog(playerid, DIALOG_EDIT_BONE, DIALOG_STYLE_LIST, "Bone", "Spine\nHead\nLeft upper arm\nRight upper arm\nLeft hand\nRight hand\nLeft thigh\nRight thigh\nLeft foot\nRight foot\nRight calf\nLeft calf\nLeft forearm\nRight forearm\nLeft shoulder\nRight shoulder\nNeck\nJaw", "Choose", "Cancel");
            EditingWeapon[playerid] = weaponid;
        }
        else if (!strcmp(params, "hide", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "No puedes ocultar un arma mientras la estás editando.");

            if (!IsWeaponHideable(weaponid))
                return SendClientMessage(playerid, -1, "Esta arma no puede ser escondida.");

            new index = weaponid - 22, weaponname[18], string[48];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));

            if (WeaponSettings[playerid][index][Hidden])
            {
                format(string, sizeof(string), "Usted ha establecido su %s mostrar.", weaponname);
                WeaponSettings[playerid][index][Hidden] = false;
            }
            else
            {
                if (IsPlayerAttachedObjectSlotUsed(playerid, GetWeaponObjectSlot(weaponid)))
                    RemovePlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid));

                format(string, sizeof(string), "Ha configurado su %s para que no se muestre.", weaponname);
                WeaponSettings[playerid][index][Hidden] = true;
            }
            SendClientMessage(playerid, -1, string);
        }
        else SendClientMessage(playerid, -1, "Has especificado una opción inválida.");
        return 1;
    }
    return 0;
}
  Cantidad de llaves: Abiertas(28)-Cerradas(28) | Lineas Totales: 255
SALUDOS!
Buen Aporte!! :D
AndrewQuintero escribió:
04 Ago 2018 15:55
Orlando Rivas escribió:
03 Ago 2018 22:53
Hola comunidad de PawnScript, hoy les vengo compartiendo un [FS] muy bueno que me encontre en el forum de samp
Se trata de que cuando tu poner el cmd /editararma, te cambiara la posicion del arma en donde la tengas.
El arma por Default aparece en el pecho, pero tu la puedes configurar al lado y posicion que mas te guste con ese simple cmd.

CMD:

/editararma [ajustarposicion/bone/hide]

Videos/Imagenes: como ya dije anteriormente el FS es muy simple, asi que no creo que haga falta subir imagenes
Descarga:
 Codigo Pawno:
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255

//Weapons on body system by GoldenLion
//Traducido por OrlandoRivas

#define FILTERSCRIPT

#include <a_samp>

#undef MAX_PLAYERS
#define MAX_PLAYERS 100

#define DIALOG_EDIT_BONE 5000
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

enum weaponSettings
{
    Float:Position[6],
    Bone,
    Hidden
}
new WeaponSettings[MAX_PLAYERS][17][weaponSettings], WeaponTick[MAX_PLAYERS], EditingWeapon[MAX_PLAYERS];

GetWeaponObjectSlot(weaponid)
{
    new objectslot;

    switch (weaponid)
    {
        case 22..24: objectslot = 0;
        case 25..27: objectslot = 1;
        case 28, 29, 32: objectslot = 2;
        case 30, 31: objectslot = 3;
        case 33, 34: objectslot = 4;
        case 35..38: objectslot = 5;
    }
    return objectslot;
}

GetWeaponModel(weaponid) //Solo devolverá el modelo de armas portátiles (22-38)
{
    new model;

    switch(weaponid)
    {
        case 22..29: model = 324 + weaponid;
        case 30: model = 355;
        case 31: model = 356;
        case 32: model = 372;
        case 33..38: model = 324 + weaponid;
    }
    return model;
}

PlayerHasWeapon(playerid, weaponid)
{
    new weapon, ammo;

    for (new i; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapon, ammo);
        if (weapon == weaponid && ammo) return 1;
    }
    return 0;
}

IsWeaponWearable(weaponid)
    return (weaponid >= 22 && weaponid <= 38);

IsWeaponHideable(weaponid)
    return (weaponid >= 22 && weaponid <= 24 || weaponid == 28 || weaponid == 32);

public OnPlayerUpdate(playerid)
{
    if (NetStats_GetConnectedTime(playerid) - WeaponTick[playerid] >= 250)
    {
        new weaponid, ammo, objectslot, count, index;

        for (new i = 2; i <= 7; i++) //Bucle solo a través de las ranuras que pueden contener las armas portátiles
        {
            GetPlayerWeaponData(playerid, i, weaponid, ammo);
            index = weaponid - 22;

            if (weaponid && ammo && !WeaponSettings[playerid][index][Hidden] && IsWeaponWearable(weaponid) && EditingWeapon[playerid] != weaponid)
            {
                objectslot = GetWeaponObjectSlot(weaponid);

                if (GetPlayerWeapon(playerid) != weaponid)
                    SetPlayerAttachedObject(playerid, objectslot, GetWeaponModel(weaponid), WeaponSettings[playerid][index][Bone], WeaponSettings[playerid][index][Position][0], WeaponSettings[playerid][index][Position][1], WeaponSettings[playerid][index][Position][2], WeaponSettings[playerid][index][Position][3], WeaponSettings[playerid][index][Position][4], WeaponSettings[playerid][index][Position][5], 1.0, 1.0, 1.0);

                else if (IsPlayerAttachedObjectSlotUsed(playerid, objectslot)) RemovePlayerAttachedObject(playerid, objectslot);
            }
        }
        for (new i; i <= 5; i++) if (IsPlayerAttachedObjectSlotUsed(playerid, i))
        {
            count = 0;

            for (new j = 22; j <= 38; j++) if (PlayerHasWeapon(playerid, j) && GetWeaponObjectSlot(j) == i)
                count++;

            if (!count) RemovePlayerAttachedObject(playerid, i);
        }
        WeaponTick[playerid] = NetStats_GetConnectedTime(playerid);
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    for (new i; i < 17; i++)
    {
        WeaponSettings[playerid][i][Position][0] = -0.116;
        WeaponSettings[playerid][i][Position][1] = 0.189;
        WeaponSettings[playerid][i][Position][2] = 0.088;
        WeaponSettings[playerid][i][Position][3] = 0.0;
        WeaponSettings[playerid][i][Position][4] = 44.50;
        WeaponSettings[playerid][i][Position][5] = 0.0;
        WeaponSettings[playerid][i][Bone] = 1;
        WeaponSettings[playerid][i][Hidden] = false;
    }
    WeaponTick[playerid] = 0;
    EditingWeapon[playerid] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == DIALOG_EDIT_BONE)
    {
        if (response)
        {
            new weaponid = EditingWeapon[playerid], weaponname[18], string[68];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));
            WeaponSettings[playerid][weaponid - 22][Bone] = listitem + 1;

            format(string, sizeof(string), "Has cambiado con éxito el hueso de tu %s.", weaponname);
            SendClientMessage(playerid, -1, string);
        }
        EditingWeapon[playerid] = 0;
        return 1;
    }
    return 0;
}

public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
    new weaponid = EditingWeapon[playerid];

    if (weaponid)
    {
        if (response)
        {
            new enum_index = weaponid - 22, weaponname[18], string[80];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));

            WeaponSettings[playerid][enum_index][Position][0] = fOffsetX;
            WeaponSettings[playerid][enum_index][Position][1] = fOffsetY;
            WeaponSettings[playerid][enum_index][Position][2] = fOffsetZ;
            WeaponSettings[playerid][enum_index][Position][3] = fRotX;
            WeaponSettings[playerid][enum_index][Position][4] = fRotY;
            WeaponSettings[playerid][enum_index][Position][5] = fRotZ;

            RemovePlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid));
            SetPlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid), GetWeaponModel(weaponid), WeaponSettings[playerid][enum_index][Bone], fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, 1.0, 1.0, 1.0);

            format(string, sizeof(string), "Has cambiado con éxito el hueso de tu %s.", weaponname);
            SendClientMessage(playerid, -1, string);
        }
        EditingWeapon[playerid] = 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[24], params[64], len = strlen(cmdtext);

    for (new i; i < len; i++) if (cmdtext[i] == ' ')
    {
        strmid(cmd, cmdtext, 0, i);
        strcat(params, cmdtext[i + 1]);
        break;
    }
    if (isnull(cmd)) strcat(cmd, cmdtext);

    if (!strcmp(cmd, "/editararma", true))
    {
        new weaponid = GetPlayerWeapon(playerid);

        if (!weaponid)
            return SendClientMessage(playerid, -1, "No estás sosteniendo un arma.");

        if (!IsWeaponWearable(weaponid))
            return SendClientMessage(playerid, -1, "Esta arma no puede ser editada.");

        if (isnull(params))
            return SendClientMessage(playerid, -1, "USE: /editararma [ajustarposicion/bone/hide]");

        if (!strcmp(params, "ajustarposicion", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "Ya estás editando un arma.");

            if (WeaponSettings[playerid][weaponid - 22][Hidden])
                return SendClientMessage(playerid, -1, "No puedes ajustar un arma oculta.");

            new index = weaponid - 22;

            SetPlayerArmedWeapon(playerid, 0);

            SetPlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid), GetWeaponModel(weaponid), WeaponSettings[playerid][index][Bone], WeaponSettings[playerid][index][Position][0], WeaponSettings[playerid][index][Position][1], WeaponSettings[playerid][index][Position][2], WeaponSettings[playerid][index][Position][3], WeaponSettings[playerid][index][Position][4], WeaponSettings[playerid][index][Position][5], 1.0, 1.0, 1.0);
            EditAttachedObject(playerid, GetWeaponObjectSlot(weaponid));

            EditingWeapon[playerid] = weaponid;
        }
        else if (!strcmp(params, "bone", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "Ya estás editando un arma.");

            ShowPlayerDialog(playerid, DIALOG_EDIT_BONE, DIALOG_STYLE_LIST, "Bone", "Spine\nHead\nLeft upper arm\nRight upper arm\nLeft hand\nRight hand\nLeft thigh\nRight thigh\nLeft foot\nRight foot\nRight calf\nLeft calf\nLeft forearm\nRight forearm\nLeft shoulder\nRight shoulder\nNeck\nJaw", "Choose", "Cancel");
            EditingWeapon[playerid] = weaponid;
        }
        else if (!strcmp(params, "hide", true))
        {
            if (EditingWeapon[playerid])
                return SendClientMessage(playerid, -1, "No puedes ocultar un arma mientras la estás editando.");

            if (!IsWeaponHideable(weaponid))
                return SendClientMessage(playerid, -1, "Esta arma no puede ser escondida.");

            new index = weaponid - 22, weaponname[18], string[48];

            GetWeaponName(weaponid, weaponname, sizeof(weaponname));

            if (WeaponSettings[playerid][index][Hidden])
            {
                format(string, sizeof(string), "Usted ha establecido su %s mostrar.", weaponname);
                WeaponSettings[playerid][index][Hidden] = false;
            }
            else
            {
                if (IsPlayerAttachedObjectSlotUsed(playerid, GetWeaponObjectSlot(weaponid)))
                    RemovePlayerAttachedObject(playerid, GetWeaponObjectSlot(weaponid));

                format(string, sizeof(string), "Ha configurado su %s para que no se muestre.", weaponname);
                WeaponSettings[playerid][index][Hidden] = true;
            }
            SendClientMessage(playerid, -1, string);
        }
        else SendClientMessage(playerid, -1, "Has especificado una opción inválida.");
        return 1;
    }
    return 0;
}
  Cantidad de llaves: Abiertas(28)-Cerradas(28) | Lineas Totales: 255
SALUDOS!
Buen Aporte!! :D
Gracias! pero creditos a su creador :D
hola es Muy buen aporte pero me sale estos Errores


D:\SERVER MEXICO\gamemodes\prueba arma.pwn(73) : error 017: undefined symbol "NetStats_GetConnectedTime"
D:\SERVER MEXICO\gamemodes\prueba arma.pwn(101) : error 017: undefined symbol "NetStats_GetConnectedTime"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Buen aporte -good
Francisco450 escribió:
05 Ago 2018 01:42
hola es Muy buen aporte pero me sale estos Errores


D:\SERVER MEXICO\gamemodes\prueba arma.pwn(73) : error 017: undefined symbol "NetStats_GetConnectedTime"
D:\SERVER MEXICO\gamemodes\prueba arma.pwn(101) : error 017: undefined symbol "NetStats_GetConnectedTime"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
debiste de aver echo algo mal al copilar el FS
Orlando Rivas escribió:
06 Ago 2018 22:00
Francisco450 escribió:
05 Ago 2018 01:42
hola es Muy buen aporte pero me sale estos Errores


D:\SERVER MEXICO\gamemodes\prueba arma.pwn(73) : error 017: undefined symbol "NetStats_GetConnectedTime"
D:\SERVER MEXICO\gamemodes\prueba arma.pwn(101) : error 017: undefined symbol "NetStats_GetConnectedTime"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
debiste de aver echo algo mal al copilar el FS
solo copie y pege y compise y me tiro errores
Francisco450 escribió:
06 Ago 2018 22:30
Orlando Rivas escribió:
06 Ago 2018 22:00
Francisco450 escribió:
05 Ago 2018 01:42
hola es Muy buen aporte pero me sale estos Errores


D:\SERVER MEXICO\gamemodes\prueba arma.pwn(73) : error 017: undefined symbol "NetStats_GetConnectedTime"
D:\SERVER MEXICO\gamemodes\prueba arma.pwn(101) : error 017: undefined symbol "NetStats_GetConnectedTime"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
debiste de aver echo algo mal al copilar el FS
solo copie y pege y compise y me tiro errores
No se entonces que sea, por que a mi me copilo a la perfección -sorry
Amigo, muy buen aporte pero tengo un problema. -good -good. Estuve adaptando el FS a una GM, todo bien pero resulta que el sistema de armas afecta a el sistema de accesorios, es decir que cuando coloco un accesorio y voy a editarlo desaparece. PD:Ya probé en varias GM y pasa lo mismo en cada una; ¿alguna solución?. -beg -beg

¿Quién está conectado?

En total hay 3 usuarios conectados :: 0 registrados, 0 ocultos y 3 invitados (basados en usuarios activos en los últimos 5 minutos)
La mayor cantidad de usuarios identificados fue 855 el 27 May 2018 00:03

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 3 invitados