[Aporte] Neon p/ Vehículos

Aprende lo que no sabes de este lenguaje y encuentra herramientas y códigos útiles.

Moderador: Ayudantes

Reglas del Foro
  • Si tu código es corto, no crees un tema nuevo para liberarlo, publica un mensaje en el tema [Funciones] ¡Publica tu código aquí!.
  • Si creas una guía, debes explicar el código claramente. Evita poner la explicación en forma de comentarios dentro del mismo y no olvides utilizar el BBCode correspondiente: [Pawn]Código aquí[/Pawn].
  • No postear códigos sin probar. Publicar códigos con errores (que impidan compilar el script para el cual está destinado) en este apartado es motivo de sanción.
  • Si tu código necesita plugins, includes u otros códigos adicionales para funcionar, debes mencionarlo en el mensaje.
  • Si has utilizado códigos de otros autores, recuerda colocar los créditos correspondientes. (El plagio es motivo de sanción).
  • Si tu aporte es para un GameMode en específico, debes publicar el tema en el apartado "Guías y Aportes para GameModes específicos".
Responder
Avatar de Usuario
MattHudson
Moderador Global
Moderador Global
Mensajes: 1666
Registrado: 31 Oct 2015 18:16
Ubicación: Argentina, Buenos Aires, San Miguel.
Contactar:
Reputación: 89

07 Dic 2017 02:55

Lo que dice el titulo -mfr_lol

Historia:
Lo tenia tirado en mi carpeta llamada "Todos los códigos separados" así que acá lo tienen:

Includes necesarios:
-a_samp
-zcmd

Bugs: No se porque no lo probe, pero supongo que ninguno. Si hay avisar.
Errores en código: Ninguno.

Créditos:
-Yo.
-Y el tipo que tenia tiempo libre y se puso a buscar las coordenadas para los objetos(no se quien fue, pero le dejo un credito moral)

Es algo sencillo, pero me gusta porque tiene la estetica diferente a los de siempre por los Menus.

Código:
 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282

#include <a_samp>
#include <zcmd>

new V_NeonEstado[MAX_VEHICLES];
new ObjetoNeon[4];
new Menu:MenuNeones;
new Menu:MenuListaNeones;
public OnGameModeInit()
{
    MenuNeones = CreateMenu("Configuraciones >> Neón", 1, 270.000000, 30.000000, 90.000000, 90.000000);
    AddMenuItem(MenuNeones, 0, "Prender Neón");
    AddMenuItem(MenuNeones, 0, "Apagar Neón");  
    MenuListaNeones = CreateMenu("Neón >> Color", 2, 400.000000, 170.000000, 170.000000, 170.000000);
    AddMenuItem(MenuListaNeones, 0, "Azul");
    AddMenuItem(MenuListaNeones, 0, "Verde");
    AddMenuItem(MenuListaNeones, 0, "Blanco");
    AddMenuItem(MenuListaNeones, 0, "Amarillo");
    AddMenuItem(MenuListaNeones, 0, "Rojo");
    AddMenuItem(MenuListaNeones, 0, "Rosa");
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
        V_NeonEstado[v] = 0;
    }
    return 1;
}


public OnPlayerSelectedMenuRow(playerid, row)
{

    new Menu:CurrentMenu = GetPlayerMenu(playerid);
    if(CurrentMenu == MenuNeones)
    {
        switch(row)
        {
            case 0:
            {
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 1) 
                {
                    TogglePlayerControllable(playerid, 1);
                    SendClientMessage(playerid, -1, "Las luces de Neón ya estan prendidas.");
                    return 1;
                }
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 1)
                {
                    ObjetoNeon[0] = CreateObject(18648,0,0,0,0,0,0);
                    ObjetoNeon[1] = CreateObject(18648,0,0,0,0,0,0);
                    ObjetoNeon[2] = CreateObject(18648,0,0,0,0,0,0);
                    ObjetoNeon[3] = CreateObject(18648,0,0,0,0,0,0);
                    AttachObjectToVehicle(ObjetoNeon[0], GetPlayerVehicleID(playerid), -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[1], GetPlayerVehicleID(playerid), 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[2], GetPlayerVehicleID(playerid), 0.034999, 2.225003, -0.629999, 0.000000, 0.000000, -88.589958);
                    AttachObjectToVehicle(ObjetoNeon[3], GetPlayerVehicleID(playerid), 0.034999, -2.034998, -0.629999, 0.000000, 0.000000, -88.589958);
                }
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 2)
                {
                    ObjetoNeon[0] = CreateObject(18649,0,0,0,0,0,0);
                    ObjetoNeon[1] = CreateObject(18649,0,0,0,0,0,0);
                    ObjetoNeon[2] = CreateObject(18649,0,0,0,0,0,0);
                    ObjetoNeon[3] = CreateObject(18649,0,0,0,0,0,0);
                    AttachObjectToVehicle(ObjetoNeon[0], GetPlayerVehicleID(playerid), -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[1], GetPlayerVehicleID(playerid), 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[2], GetPlayerVehicleID(playerid), 0.034999, 2.225003, -0.629999, 0.000000, 0.000000, -88.589958);
                    AttachObjectToVehicle(ObjetoNeon[3], GetPlayerVehicleID(playerid), 0.034999, -2.034998, -0.629999, 0.000000, 0.000000, -88.589958);
                }
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 3)
                {
                    ObjetoNeon[0] = CreateObject(18652,0,0,0,0,0,0);
                    ObjetoNeon[1] = CreateObject(18652,0,0,0,0,0,0);
                    ObjetoNeon[2] = CreateObject(18652,0,0,0,0,0,0);
                    ObjetoNeon[3] = CreateObject(18652,0,0,0,0,0,0);
                    AttachObjectToVehicle(ObjetoNeon[0], GetPlayerVehicleID(playerid), -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[1], GetPlayerVehicleID(playerid), 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[2], GetPlayerVehicleID(playerid), 0.034999, 2.225003, -0.629999, 0.000000, 0.000000, -88.589958);
                    AttachObjectToVehicle(ObjetoNeon[3], GetPlayerVehicleID(playerid), 0.034999, -2.034998, -0.629999, 0.000000, 0.000000, -88.589958);
                }
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 4)
                {
                    ObjetoNeon[0] = CreateObject(18650,0,0,0,0,0,0);
                    ObjetoNeon[1] = CreateObject(18650,0,0,0,0,0,0);
                    ObjetoNeon[2] = CreateObject(18650,0,0,0,0,0,0);
                    ObjetoNeon[3] = CreateObject(18650,0,0,0,0,0,0);
                    AttachObjectToVehicle(ObjetoNeon[0], GetPlayerVehicleID(playerid), -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[1], GetPlayerVehicleID(playerid), 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[2], GetPlayerVehicleID(playerid), 0.034999, 2.225003, -0.629999, 0.000000, 0.000000, -88.589958);
                    AttachObjectToVehicle(ObjetoNeon[3], GetPlayerVehicleID(playerid), 0.034999, -2.034998, -0.629999, 0.000000, 0.000000, -88.589958);
                }
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 5)
                {
                    ObjetoNeon[0] = CreateObject(18647,0,0,0,0,0,0);
                    ObjetoNeon[1] = CreateObject(18647,0,0,0,0,0,0);
                    ObjetoNeon[2] = CreateObject(18647,0,0,0,0,0,0);
                    ObjetoNeon[3] = CreateObject(18647,0,0,0,0,0,0);
                    AttachObjectToVehicle(ObjetoNeon[0], GetPlayerVehicleID(playerid), -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[1], GetPlayerVehicleID(playerid), 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[2], GetPlayerVehicleID(playerid), 0.034999, 2.225003, -0.629999, 0.000000, 0.000000, -88.589958);
                    AttachObjectToVehicle(ObjetoNeon[3], GetPlayerVehicleID(playerid), 0.034999, -2.034998, -0.629999, 0.000000, 0.000000, -88.589958);
                }
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 6)
                {
                    ObjetoNeon[0] = CreateObject(18651,0,0,0,0,0,0);
                    ObjetoNeon[1] = CreateObject(18651,0,0,0,0,0,0);
                    ObjetoNeon[2] = CreateObject(18651,0,0,0,0,0,0);
                    ObjetoNeon[3] = CreateObject(18651,0,0,0,0,0,0);
                    AttachObjectToVehicle(ObjetoNeon[0], GetPlayerVehicleID(playerid), -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[1], GetPlayerVehicleID(playerid), 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                    AttachObjectToVehicle(ObjetoNeon[2], GetPlayerVehicleID(playerid), 0.034999, 2.225003, -0.629999, 0.000000, 0.000000, -88.589958);
                    AttachObjectToVehicle(ObjetoNeon[3], GetPlayerVehicleID(playerid), 0.034999, -2.034998, -0.629999, 0.000000, 0.000000, -88.589958);
                }
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 1;
                TogglePlayerControllable(playerid, 0);
            }
            case 1:
            {
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 0)
                {
                    TogglePlayerControllable(playerid, 1);
                    SendClientMessage(playerid, -1, "Las luces de Neón ya estan apagadas.");
                    return 1;
                }
                DestroyObject(ObjetoNeon[0]);
                DestroyObject(ObjetoNeon[1]);
                DestroyObject(ObjetoNeon[2]);
                DestroyObject(ObjetoNeon[3]);
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 0;
            }
            case 2:
            {
                if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "* Debes estar subido a un vehículo."), TogglePlayerControllable(playerid, 1);
                if(IsPlayerOnBike(playerid) || IsPlayerInBoat(playerid) || IsPlayerOnBicycle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "* Este vehículo no acepta neon."), TogglePlayerControllable(playerid, 1);
                if(V_NeonEstado[GetPlayerVehicleID(playerid)] == 0) return SendClientMessage(playerid, 0xFF0000FF, "* Este vehículo no tiene ningún neon para remover."), TogglePlayerControllable(playerid, 1);
                SendClientMessage(playerid, 0xFFFFFFFF, "* Has removido satisfactoriamente el neon de este vehículo.");
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 0;
                DestroyObject(ObjetoNeon[0]);
                DestroyObject(ObjetoNeon[1]);
                DestroyObject(ObjetoNeon[2]);
                DestroyObject(ObjetoNeon[3]);
                TogglePlayerControllable(playerid, 1);
                return 1;
            }
            case 3:
            {
                ShowMenuForPlayer(MenuListaNeones, playerid);
                TogglePlayerControllable(playerid, 1);
                return 1;
            }
        }
    }
    if(CurrentMenu == MenuNeones)
    {
        switch(row)
        {
            case 0:
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "* Has puesto un neon de color Azul en el vehículo..");
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 1;
                TogglePlayerControllable(playerid, 1);
                return 1;                
            }
            case 1:
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "* Has puesto un neon de color Verde en el vehículo..");
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 2;
                TogglePlayerControllable(playerid, 1);
                return 1;                
            }
            case 3:
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "* Has puesto un neon de color Blanco en el vehículo..");
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 3;
                TogglePlayerControllable(playerid, 1);
                return 1;                
            }
            case 4:
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "* Has puesto un neon de color Amarillo en el vehículo..");
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 4;
                TogglePlayerControllable(playerid, 1);
                return 1;                
            }
            case 5:
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "* Has puesto un neon de color Rojo en el vehículo..");
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 5;
                TogglePlayerControllable(playerid, 1);
                return 1;                
            }
            case 6:
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "* Has puesto un neon de color Rosa en el vehículo..");
                V_NeonEstado[GetPlayerVehicleID(playerid)] = 6;
                TogglePlayerControllable(playerid, 1);
                return 1;                
            }
        }
    }
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    TogglePlayerControllable(playerid,1);
    return 1;
}

CMD:tablero(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "* Tienes que estar en un vehículo.");
    ShowMenuForPlayer(MenuNeones, playerid);
    TogglePlayerControllable(playerid, 0);
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    for(new ObjCant = 0; ObjCant < 4; ObjCant++)
    {
        DestroyObject(ObjetoNeon[ObjCant]);
    }
    V_NeonEstado[vehicleid] = 0;
    return 1;
}
 
IsPlayerOnBike(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new vehicleclass = GetVehicleModel(GetPlayerVehicleID(playerid));
        switch(vehicleclass)
        {
            case 448:return 1;
            case 461:return 1;
            case 462:return 1;
            case 463:return 1;
            case 468:return 1;
            case 521:return 1;
            case 522:return 1;
            case 523:return 1;
            case 581:return 1;
            case 586:return 1;
            case 471:return 1;
        }
    }
    return 0;
}
 
IsPlayerInBoat(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new vehicleclass = GetVehicleModel(GetPlayerVehicleID(playerid));
        switch(vehicleclass)
        {
            case 430:return 1;
            case 446:return 1;
            case 452:return 1;
            case 453:return 1;
            case 454:return 1;
            case 472:return 1;
            case 473:return 1;
            case 484:return 1;
            case 493:return 1;
            case 595:return 1;
        }
    }
    return 0;
}
 
IsPlayerOnBicycle(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new vehicleclass = GetVehicleModel(GetPlayerVehicleID(playerid));
        switch(vehicleclass)
        {
            case 481:return 1;
            case 509:return 1;
            case 510:return 1;
        }
    }
    return 0;
}
  Cantidad de llaves: Abiertas(38)-Cerradas(38) | Lineas Totales: 282



Saludos, -bye
/MH
Avatar de Usuario
EdinsonWalker
Senior
Senior
Mensajes: 1129
Registrado: 21 Feb 2014 10:34
Ubicación: dios no existe
Contactar:
Reputación: 93

07 Dic 2017 04:40

hola 2010 tanto tiempo
Consumido
Avatar de Usuario
MattHudson
Moderador Global
Moderador Global
Mensajes: 1666
Registrado: 31 Oct 2015 18:16
Ubicación: Argentina, Buenos Aires, San Miguel.
Contactar:
Reputación: 89

07 Dic 2017 07:29

EdinsonWalker escribió:
07 Dic 2017 04:40
hola 2010 tanto tiempo
Hola, -hi


Imagen


Saludos, -bye
/MH
Responder