Empires Sourcemod API

Discussion in 'Mapping' started by Theowningone, Nov 8, 2008.

  1. Theowningone

    Theowningone Noone likes me :'(

    Messages:
    704
    Likes Received:
    0
    Trophy Points:
    0
    (Once again i think this forums should be renamed "Custom Content")

    This has been in production for a decently long time now and i figured i'd throw it up here so when some noob comes along a needs help coding something he has some resources to do so. This include holds a bunch of really useful stocks for sourcemod to grab and set multiple things. Well here it is:

    To use, put it in the include folder where the compiler is and at the top of you plugin put...
    Code:
    #include "empires"
    

    These are the functions(Note: This doesnt include the actual code in the Include file for those of you who think copy and pasting this will work.) :
    Code:
    /*
    * Empires API
    *
    * Created By Theowningone
    * Version: 1.2
    * http://www.theowningone.info/
    * http://www.borgamers.com/
    */
    
    /********************
    * --> Is Stocks <-- *
    ********************/
    
    /**
    * Is Player Squad Leader
    *
    * @param client            Client Index
    * @return                1 if leader, 0 if other
    */
    stock IsSquadLeader(client)
    
    /**
    * Is Player Commander
    *
    * @param client            Client Index
    * @return                1 if comm, 0 if other
    */
    stock IsComm(client)
    
    /**
    * Is Player In Vehicle
    *
    * @param client            Client Index
    * @return                1 if in vehicle, 0 if not
    */
    stock IsInVehicle(client)
    
    
    
    
    
    /**********************
    * --> Team Stocks <-- *
    **********************/
    
    /**
    * Retrieves NF Resources.
    *
    * @return                NF Resources
    */
    stock GetNFResources()
    
    /**
    * Sets NF Resources.
    *
    * @noreturn
    */
    stock SetNFResources(amount)
    
    /**
    * Retrieves BE Resources.
    *
    * @return                BE Resources
    */
    stock GetBEResources()
    
    /**
    * Sets BE Resources.
    *
    * @noreturn
    */
    stock SetBEResources(amount)
    
    /**
    * Retrieves NF Reinforcements
    *
    * @return                NF Reinforcements
    */
    stock GetNFReinforcements()
    
    /**
    * Sets NF Reinforcements
    *
    * @noreturn
    */
    stock SetNFReinforcements(amount)
    
    /**
    * Retrieves BE Reinforcements
    *
    * @return                BE Reinforcements
    */
    stock GetBEReinforcements()
    
    /**
    * Sets BE Reinforcements
    *
    * @noreturn
    */
    stock SetBEReinforcements(amount)
    
    /**
    * Is Researched
    *
    * @param team            Team Index
    * @param index            Research Index
    * @return                1 if researched, 0 if not
    */
    stock IsResearched(team, index)
    
    /**
    * Current Research
    *
    * @param team            Team Index
    * @return                Research Index
    */
    stock CurrentResearch(team)
    
    /**
    * Current Research Name
    *
    * @param team            Team Index
    * @param buffer            Buffer to hold the research name
    * @param size            Len of the buffer
    * @return                Research Index
    */
    stock CurrentResearchName(team, String:buffer[], size)
    
    /**
    * Set Research
    *
    * @param team            Team Index
    * @param index            Research Index
    * @param status            weather to research or not
    * @noreturn
    */
    stock SetResearch(team, index, bool:status)
    
    
    
    
    /*************************
    * --> Vehicle Stocks <-- *
    *************************/
    
    /**
    * Get Vehicle Occupants
    *
    * @param ent            Vehicle Entity Index
    * @return               Amount of clients in vehicle
    */
    stock GetVehicleOccupants(ent)
    
    /**
    * Get Vehicle Driver
    *
    * @param ent            Vehicle Entity Index
    * @return                 Client Index of Driver (0 if none, -1 if invalid entity)
    */
    stock GetVehicleDriver(ent)
    
    /**
    * Set Vehicle Armor
    *
    * @param ent            Vehicle Entity Index
    * @param side            side of armor (1 is front, 2 is back, 3 is left, 4 is right)
    * @param front            Health to set armor to
    * @return                -1 on error, 0 on success
    */
    stock SetVehicleArmor(ent, side, Float:health)
    
    /**
    * Get Vehicle Armor
    *
    * @param ent            Vehicle Entity Index
    * @param side            side of armor (1 is front, 2 is back, 3 is left, 4 is right)
    * @return                Armor Health (-1.0 on error)
    */
    stock Float:GetVehicleArmor(ent, side)
    
    /**
    * Set Vehicle Hull
    *
    * @param ent            Vehicle Entity Index
    * @param health            Health to set hull to
    * @return                -1 on error, 0 on success
    */
    stock SetVehicleHull(ent, Float:health)
    
    /**
    * Get Vehicle Hull
    *
    * @param ent            Vehicle Entity Index
    * @return                Hull Health (-1.0 on error)
    */
    stock Float:GetVehicleHull(ent)
    
    /**
    * Set Vehicle Heat
    *
    * @param ent            Vehicle Entity Index
    * @param heat            Heat to set for vehicle
    * @return                -1 on error, 0 on success
    */
    stock SetVehicleHeat(ent, Float:heat)
    
    /**
    * Get Vehicle Heat
    *
    * @param ent            Vehicle Entity Index
    * @return                Vehicle Heat (-1.0 on error)
    */
    stock Float:GetVehicleHeat(ent)
    
    /**
    * Get Vehicle Class
    *
    * @param ent            Vehicle Entity Index
    * @return                Vehicle Class (-1 on error)
    */
    stock GetVehicleClass(ent)
    
    /**
    * Get Vehicle Class Name
    *
    * @param ent            Vehicle Entity Index
    * @param buffer            Buffer to hold the vehicle class name
    * @param size            Len of the buffer
    * @return                Vehicle Class (-1 on error)
    */
    stock GetVehicleClassName(ent, String:buffer[], size)
    
    /**
    * Get Client Vehicle
    *
    * @param client            Client Index
    * @return                Client Vehicle Entity Index (-1 is error, 0 is none)
    */
    stock GetPlayerVehicle(client)
    
    /**
    * Get Cannon Entity
    *
    * @param ent            Vehicle Entity Index
    * @return                Cannon Entity Index
    */
    stock GetCannonEnt(ent)
    
    /**
    * Get Turret Entity
    *
    * @param ent            Vehicle Entity Index
    * @return                Turret Entity Index
    */
    stock GetTurretEnt(ent)
    
    
    
    
    
    
    
    /**********************
    * --> Misc Stocks <-- *
    **********************/
    
    /**
    * Retrieves a player's squad number
    *
    * @param client            Client Index
    * @return                Player squad index (0 is none)
    */
    stock GetPlayerSquadNum(client)
    
    /**
    * Retrieves a player's squad name
    *
    * @param client            Client Index
    * @param buffer            Buffer to hold the squad name
    * @param size            Len of the buffer
    * @return                Player squad index
    */
    stock GetPlayerSquadName(client, String:buffer[], size)
    
    /**
    * Retrieves a player's score
    *
    * @param client            Client Index
    * @return                Player score
    */
    stock GetPlayerScore(client)
    
    /**
    * Retrieves a player's class
    *
    * @param client            Client Index
    * @return                Player class (0 is scout, 1 is rifleman, 2 is gren, 3 is engy, 5 is spec)
    */
    stock GetPlayerClassNum(client)
    
    /**
    * Retrieves a player's class
    *
    * @param client            Client Index
    * @param buffer            Buffer to hold the class name
    * @param size            Len of the buffer
    * @return                Player class index
    */
    stock GetPlayerClassName(client, String:buffer[], size)
    

    Edit: I can't upload it as an attachment so here's an offsite link.
    Edit2: Also a lot of very useful info can be found here.
     
    Last edited: Nov 8, 2008

Share This Page