Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Drop de Invetario

Iniciado por Swarlog, Ene 30, 2023, 11:18 PM

Tema anterior - Siguiente tema

Swarlog

Información Adicional:

Pues he revisado algunos fs de internet y he limpiado el codigo para dejarlo justo como deseaba. Se trata de un sistema de drop de equipo, es decir, el equipo que tengas lo dropeas cuando te matan. Eso si, podeis configurar dentro del script el que se dropea y el que no, simplemente con añadirle un "-1" a la id del objeto que no deseais que se dropee.

Código:

// ----------------------------------------------------------------------
// Creado para la comunidad U3Games --> http://samp.united-extreme.com
// De la comunidad de juegos online --> http://u3games.united-extreme.com
// U3G | Samp - Sistema de drop de inventario - Version: 1.0
// ----------------------------------------------------------------------

#include <a_samp>

//----------------------------------------------------------
// DEFINE:
//----------------------------------------------------------

// Tiempo que dura el drop: (segundos)
#define DROP_TIEMPO_ON 60

//----------------------------------------------------------
// FORWARD:
//----------------------------------------------------------

forward EliminarDropInventario(number);

//----------------------------------------------------------
// NEWS:
//----------------------------------------------------------

new Pickup[300];
new PickupID[] =
{
-1, // no fists
331, // - Brass Knuckles
333, // Golf Club
334, // Night Stick
335, // Knife
336, // baseball bat
337, // shovel
338, // pool cue
339, // katama
341, // chainsaw
321, // regular dildo
322, // white dildo
323, // Medium, white vibrator
324, // smaill, silver vibrator
325, // flowers
326, // cane
342, // grendade
343, // tear gas
344, // molotov
-1, // RPG rocket - we can't pick up those, do we oO
-1, // Heat-Seeking Rocket
-1, // Hydra rocket
346, // colt 45
347, // colt 45 + silencer
348, // deagle
349, // shotgun
350, // sawn-off
351, // spaz
352, // micro-uzi
353, // mp5
355, // ak47
356, // m4
372, // tec9
357, // country rifle
358, // sniper rifle
359, // rocket launcher
360, // heat-seeking rocket launcher
361, // flamethrower
362, // minigun
363, // sachtel charges
-1, // detonator
365, // spray can
366, // fire extinguisher
367, // camera
-1, // night-vision goggles
-1, // heat-vision goggles
371 // parachute
};

//----------------------------------------------------------
// CODIGO INTERNO SCRIPT:
//----------------------------------------------------------

public OnFilterScriptInit()
{
//Mensaje de la ejecucion del scripts:
print("[U3GAMES-SAMP] Sistema de drop de inventario cargado correctamente.");
return 1;
}

public OnFilterScriptExit()
{
//Mensaje de deshabilitacion del scripts:
print("[U3GAMES-SAMP] Sistema de drop de inventario deshabilitados correctamente.");
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
DropInventario(playerid);
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
for (new i = 0; i <= 300; i ++)
{
if (Pickup[i] == pickupid)
{
EliminarDropInventario(i);
}
}
}

//----------------------------------------------------------
// CODIGO ADICIONAL:
//----------------------------------------------------------

public EliminarDropInventario(number)
{
DestroyPickup(Pickup[number]);
Pickup[number] = -1;
}

stock DropInventario(playerid)
{
new Arma[14], Municion[14];
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);

for (new wep = 0; wep < 14; wep ++)
{
GetPlayerWeaponData(playerid, wep, Arma[wep], Municion[wep]);
if (PickupID[Arma[wep]] != -1)
{
new model = PickupID[Arma[wep]];
new randid = random(300);
new Float:X2 = X + (random(3) - random(3));
new Float:Y2 = Y + (random(3) - random(3));
Pickup[randid] = CreatePickup(model, 4, X2, Y2, Z);

SetTimerEx("EliminarDropInventario", DROP_TIEMPO_ON * 1000, false, "d", randid);
}
}
}