#include <a_samp>
#include <zcmd>
#include <sscanf2>
// 0x00FF00FF - GREEN
//
main() {}
#define MAX_DROPPED_GPARTS 6
static Text3D: takegunpart3d1;
static Text3D: takegunpart3d2;
static Text3D: takegunpart3d3;
static Text3D: takegunpart3d4;
static Text3D: takegunpart3d5;
static Text3D: takegunpart3d6;
enum GunPart {
gID,
gType,
gDropped,
Float:gPos[3]
};
enum GunPartsCoords {
Float:gPosx,
Float:gPosy,
Float:gPosz
};
CMD:here(playerid, params[])
{
SetPlayerPos(playerid, 2834.8857, -2386.6113, 17.5051);
return 1;
}
static GunParts[6][GunPart];
static crateLocations[][GunPartsCoords] = {
{2834.8857, -2386.6113, 17.5051},
{2842.3608, -2500.4163, 17.5051},
{2823.5750, -2474.1826, 12.0983},
{2837.7878, -2449.3562, 19.9220},
{2846.3259, -2447.9080, 19.9220},
{2842.2053, -2500.4648, 17.5051}
};
forward ShipArrivalTimer();
forward ShipDockingTimer();
public OnGameModeInit()
{
takegunpart3d1 = Create3DTextLabel("/takegunpart", 0x00FF00FF, 2834.8857, -2386.6113, 17.5051, 20.0, 0, 1);
takegunpart3d2 = Create3DTextLabel("/takegunpart", 0x00FF00FF, 2842.3608, -2500.4163, 17.5051, 20.0, 0, 1);
takegunpart3d3 = Create3DTextLabel("/takegunpart", 0x00FF00FF, 2823.5750, -2474.1826, 12.0983, 20.0, 0, 1);
takegunpart3d4 = Create3DTextLabel("/takegunpart", 0x00FF00FF, 2837.9119, -2449.5093, 19.9220, 20.0, 0, 1);
takegunpart3d5 = Create3DTextLabel("/takegunpart", 0x00FF00FF, 2845.8704, -2447.4880, 19.9220, 20.0, 0, 1);
takegunpart3d6 = Create3DTextLabel("/takegunpart", 0x00FF00FF, 2834.8857, -2386.6113, 17.5051, 20.0, 0, 1);
Update3DTextLabelText(takegunpart3d1, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d2, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d3, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d4, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d5, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d6, 0x00FF00FF, "");
SetTimer("ShipArrivalTimer", 10, false);
return 1;
}
public ShipArrivalTimer()
{
SetTimer("ShipDockingTimer", 1200000, false);
for(new i = 0; i < MAX_DROPPED_GPARTS; i++)
{
new shiphasillegal = random(2);
GunParts[i][gDropped] = shiphasillegal;
if(shiphasillegal == 0) return print("No");
if(shiphasillegal == 1) return print("Yes");
}
Update3DTextLabelText(takegunpart3d1, 0x00FF00FF, "/takegunpart");
Update3DTextLabelText(takegunpart3d2, 0x00FF00FF, "/takegunpart");
Update3DTextLabelText(takegunpart3d3, 0x00FF00FF, "/takegunpart");
Update3DTextLabelText(takegunpart3d4, 0x00FF00FF, "/takegunpart");
Update3DTextLabelText(takegunpart3d5, 0x00FF00FF, "/takegunpart");
Update3DTextLabelText(takegunpart3d6, 0x00FF00FF, "/takegunpart");
return 1;
}
public ShipDockingTimer()
{
SetTimer("ShipArrivalTimer", 10800000, false);
Update3DTextLabelText(takegunpart3d1, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d2, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d3, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d4, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d5, 0x00FF00FF, "");
Update3DTextLabelText(takegunpart3d6, 0x00FF00FF, "");
return 1;
}
CMD:takegunpart(playerid, params[])
{
// if(pInfo[playerid][pFamily] > 0)
//{
//if(pInfo[playerid][pRank] >= 5)
//{
new pickedmsg[30];
for(new i = 0; i < sizeof(crateLocations); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, crateLocations[i][gPosx], crateLocations[i][gPosy], crateLocations[i][gPosz]))
{
if(GunParts[i][gDropped] == 0) continue;
new gunpartamount = random (6);
//PlayerInfo[playerid][Gunparts] += gunpartamount;
format(pickedmsg, sizeof(pickedmsg), "You've picked %i gun parts.", gunpartamount);
SendClientMessage(playerid, -1, pickedmsg);
GunParts[i][gDropped] = 0;
}
return 1;
}
//}
//}
return 1;
}