Esempio n. 1
0
def getWeaponDict(userid):
    # Make sure the player is valid
    if not spe.getPlayer(int(userid)):
        # Return None due to the invalid player instance
        return None

    # Set up the list
    weapons = {}

    # Loop through the maximum range of 48 weapons
    for i in range(0, 48):

        # Retrieve the weapon instance/pointer
        wPointer = spe.getWeaponFromSlot(userid, i)

        # Make sure the weapon instance/pointer is valid
        if wPointer:

            # Create the valid key:value pair
            weapons[spe.getEntityClassName(wPointer)] = {
                "instance": wPointer,
                "slot": i,
                "index": spe.getEntityIndex(wPointer)}

    # Return the populated dictionary
    return weapons
Esempio n. 2
0
def getWeaponDict(userid):
    # Make sure the player is valid
    if not spe.getPlayer(int(userid)):
        # Return None due to the invalid player instance
        return None

    # Set up the list
    weapons = {}

    # Loop through the maximum range of 48 weapons
    for i in range(0, 48):

        # Retrieve the weapon instance/pointer
        wPointer = spe.getWeaponFromSlot(userid, i)

        # Make sure the weapon instance/pointer is valid
        if wPointer:

            # Create the valid key:value pair
            weapons[spe.getEntityClassName(wPointer)] = {
                "instance": wPointer,
                "slot": i,
                "index": spe.getEntityIndex(wPointer)
            }

    # Return the populated dictionary
    return weapons
Esempio n. 3
0
def getWeaponIndexList(userid):
    # Make sure the player is valid
    if not spe.getPlayer(int(userid)):
        # Return None due to the invalid player instance
        return None

    # Return a list of weapon indexes
    return [spe.getEntityIndex(i) for i in spe.getWeaponInstanceList(userid)]
Esempio n. 4
0
def getWeaponIndexList(userid):
    # Make sure the player is valid
    if not spe.getPlayer(int(userid)):
        # Return None due to the invalid player instance
        return None

    # Return a list of weapon indexes
    return [spe.getEntityIndex(i) for i in spe.getWeaponInstanceList(userid)]
Esempio n. 5
0
def getWeaponIndex(userid, weapon_name):
    # Retrieve the weapon pointer
    weapon = spe.ownsWeapon(userid, weapon_name)

    # Make sure the weapon pointer is valid
    if not weapon:
        # Return None if the weapon pointer is not valid
        return None

    # Return the index of the weapon
    return spe.getEntityIndex(weapon)
Esempio n. 6
0
def getWeaponIndex(userid, weapon_name):
    # Retrieve the weapon pointer
    weapon = spe.ownsWeapon(userid, weapon_name)

    # Make sure the weapon pointer is valid
    if not weapon:
        # Return None if the weapon pointer is not valid
        return None

    # Return the index of the weapon
    return spe.getEntityIndex(weapon)
Esempio n. 7
0
def getViewEntity(userid):
    '''Get the entity a player is looking at...'''
    
    # Is the player not valid?
    if not es.exists('userid', userid):
        
        # Don't go further...
        return None
        
    # Get the entity pointer...
    pEntity = spe.call('FindPickerEntity', spe.getPlayer(int(userid)))
    
    # Is the entity not valid?
    if not pEntity:
        
        # Don't go further...
        return None
        
    # Return the entity index...
    return spe.getEntityIndex(pEntity)
Esempio n. 8
0
def getIndexOfEntity(entity_instance):
    return spe.getEntityIndex(entity_instance)
Esempio n. 9
0
def getIndexOfEntity(entity_instance):
    return spe.getEntityIndex(entity_instance)