09.06.2016, 08:18
Chicos estaba editando una Gamemode cuando quiero sacar algo de dicho "inventario" no me deja EJM, Celular, GPS, Bidуn, Dinamita entre otros y la verdad no se que pasa intente buscarle soluciуn pero nada
Cuando le doy clik al objeto simplemente no funciona y no lo pasa al jugador para que este pueda llamar o usarlo.
Tampoco se cierra el dialogo y queda estorbando en toda la pantalla
Cuando le doy clik al objeto simplemente no funciona y no lo pasa al jugador para que este pueda llamar o usarlo.
Tampoco se cierra el dialogo y queda estorbando en toda la pantalla
PHP код:
// ====== SISTEMA DE INVENTARIO =========
/*/ ---------------------------------------------
native AddToInv(playerid, object, slot)
native GetFreeSlotToObject(playerid)
native GetObjectName(object, name[], dest = sizeof (name))
native HaveFreeSlotForObject(playerid)
native GetPlayerObject(playerid)
native HaveObject(playerid, model)
native GetObjectIndexFromModel(object)
native GetObjectFromIndex(playerid, slot)
native SetPlayerObject(playerid, object = INVALID_OBJECT_ID, slot = -1)
native RemovePlayerObject(playerid, object = INVALID_OBJECT_ID, slot = -1)
native GetPlayerObjectIndexFromModel(playerid, object)
// -------------------------------------------- */
stock AddToInv(playerid, object, slot=-1)
{
if(slot == -1)// -1 = find slot.
slot = GetFreeSlotToObject(playerid);
if(0 <= slot < MAX_OBJS)
{
InfoJugador[playerid][jObjeto][slot] = object;
ActualizarObjetoInv(playerid, slot);
return 1;
}
return 0;
}
stock ActualizarObjetoInv(playerid, slot)
{
new
str[15],
INI:Arch = INI_Open(U_Usuario(playerid));
INI_SetTag(Arch, "data");
A_Format(str, "Objeto%d", slot);
INI_WriteInt(Arch,str,InfoJugador[playerid][jObjeto][slot]);
INI_Close(Arch);
return 1;
}
stock GetObjectName(object, name[], dest = sizeof (name))
return strunpack (name, ObjectInfo[GetObjectIndexFromModel(object)][objName], dest);
stock PlayerNeedObject(playerid, object)
{
if(GetPlayerObject(playerid) == object && IsPlayerAttachedObjectSlotUsed(playerid, SLOT_OBJECTS)) return 1;
new
String[75],
Name[30];
GetObjectName(object, Name);
A_Format(String, "ЎNecesitas un/a ~g~~h~%s~w~!", Name);
Error(playerid, String);
return 0;
}
#define NeedObject(%0)<%1> if(!PlayerNeedObject(%0,%1)) return 1
#define AddObjectInv(%0)<%1> if(!AddToInv(%0,%1)) return Error(%0,"ЎNo se encontrу mбs espacio en el inventario!")
stock GetFreeSlotToObject(playerid)
{
for(new i; i < MAX_OBJS; i++)
if(InfoJugador[playerid][jObjeto][i] == 0)
return i;
return -1;
}
stock HaveFreeSlotForObject(playerid)
return (GetFreeSlotToObject(playerid) != -1);
stock GetPlayerObject(playerid)
return CurrentObject[playerid];
stock HaveObject(playerid, model)
{
for(new i; i < MAX_OBJS; i++)
if(InfoJugador[playerid][jObjeto][i] == model)
return 1;
return 0;
}
stock GetObjectIndexFromModel(object)
{
for(new i; i != sizeof (ObjectInfo); i++)
if(ObjectInfo[i][objModel] == object)
return i;
return -1;
}
stock GetObjectFromIndex(playerid, slot)
return InfoJugador[playerid][jObjeto][slot];
stock GetPlayerObjectIndexFromModel(playerid, object)
{
for(new i; i < MAX_OBJS; i++)
if(InfoJugador[playerid][jObjeto][i] == object)
return i;
return -1;
}
stock SetPlayerObject(playerid, object = INVALID_OBJECT_ID, slot = -1)
{
if(numargs() == 1) print("[ERROR]: Falta usar parбmetros en SetPlayerObject.");
if(slot == -1 && object != INVALID_OBJECT_ID)
{
new
i = GetObjectIndexFromModel(object);
SetPlayerAttachedObject(playerid, SLOT_OBJECTS, object, 5,
ObjectInfo[i][objPos][0], ObjectInfo[i][objPos][1], ObjectInfo[i][objPos][2],
ObjectInfo[i][objRot][0], ObjectInfo[i][objRot][1], ObjectInfo[i][objRot][2],
ObjectInfo[i][objEsc][0], ObjectInfo[i][objEsc][1], ObjectInfo[i][objEsc][2]);
CurrentObject[playerid] = object;
return 1;
}
if(slot != -1 && object == INVALID_OBJECT_ID)
{
new
i = slot,
model = GetObjectFromIndex(playerid, slot);
SetPlayerAttachedObject(playerid, SLOT_OBJECTS, model, 5,
ObjectInfo[i][objPos][0], ObjectInfo[i][objPos][1], ObjectInfo[i][objPos][2],
ObjectInfo[i][objRot][0], ObjectInfo[i][objRot][1], ObjectInfo[i][objRot][2],
ObjectInfo[i][objEsc][0], ObjectInfo[i][objEsc][1], ObjectInfo[i][objEsc][2]);
CurrentObject[playerid] = model;
return 1;
}
return 0;
}
stock RemovePlayerObject(playerid, object = INVALID_OBJECT_ID, slot = -1)
{
if(numargs() == 1) print("[ERROR]: Falta usar parбmetros en RemovePlayerObject.");
if(slot == -1 && object != INVALID_OBJECT_ID)
{
if(!HaveObject(playerid, object)) return 0;
if(GetPlayerObject(playerid) == object)
{
CurrentObject[playerid] = 0;
RemovePlayerAttachedObject(playerid, SLOT_OBJECTS);
}
new
slot_0 = GetPlayerObjectIndexFromModel(playerid, object);
InfoJugador[playerid][jObjeto][slot_0] = 0;
ActualizarObjetoInv(playerid, slot_0);
return 1;
}
if(slot != -1 && object == INVALID_OBJECT_ID)
{
new
model = GetObjectFromIndex(playerid, slot);
if(!HaveObject(playerid, model)) return 0;
if(GetPlayerObject(playerid) == model)
{
CurrentObject[playerid] = 0;
RemovePlayerAttachedObject(playerid, SLOT_OBJECTS);
}
InfoJugador[playerid][jObjeto][slot] = 0;
ActualizarObjetoInv(playerid, slot);
return 1;
}
return 0;
}
stock ShowInv(playerid, target = INVALID_PLAYER_ID)
{
if(target != INVALID_PLAYER_ID)
{
SetPVarInt(target, "INT_AJENO", true);
}
else
{
target = playerid;
}
new
Objects[MAX_OBJS],
Amount,
Float:Object_Rotx[MAX_OBJS],
Float:Object_Roty[MAX_OBJS],
Float:Object_Rotz[MAX_OBJS],
Float:Object_Zoom[MAX_OBJS];
for(new i; i < MAX_OBJS; i++)
{
if(InfoJugador[playerid][jObjeto][i])
{
Objects[Amount] = InfoJugador[playerid][jObjeto][i];
if(InfoJugador[playerid][jObjeto][i] == OBJ_CEL || InfoJugador[playerid][jObjeto][i] == OBJ_GPS)
{
Object_Rotx[Amount] = -90.0;
Object_Rotz[Amount] = 180.0;
}
if(InfoJugador[playerid][jObjeto][i] == OBJ_DINAMITA)
{
Object_Rotz[Amount] = 170.0;
}
Object_Zoom[Amount] = 1.0;
Amount++;
}
}
if(!Amount) return Error(playerid, "ЎNo tienes nada en el inventario!");
ShowModelSelectionMenuEx(target, Objects, Amount, "~w~Inventario", LIST_INV, Object_Rotx, Object_Roty, Object_Rotz, Object_Zoom, 0x3E327796, .tdSelectionColor=0x00000099);
return 1;
}
stock IsValidObject2(object)
{
for(new i; i != sizeof (ObjectInfo); i++)
if(ObjectInfo[i][objModel] == object)
return true;
return false;
}
// ---------------------