actions (ActionID, UsesType, ActionName) ActionID: Internal SQL ID (Primary Key) (INT) UsesType: The type that the action will be attached to. (INT) ActionName: The name of the action itself. (VARCHAR) objectinventory (InventoryID, PlayerObjectID, InsideIDs) InventoryID: Internal SQL ID (Primary Key) (INT) PlayerObjectID: The ID of the player object that the inventory belongs to. (INT) InsideIDs: The ids objects inside of the inventory, separated by commas. (VARCHAR) objects (ID, Name, Size, UsesType, UsesSlot, SlotsInside, Weight, MaxUses, Display, DisplayColor, DisplayOffsets, OnHandOffsets, OnBodyOffsets, ObjectScales, SpecialFlag_1, SpecialFlag_2, SpecialFlag_3) ID: Internal SQL ID (Primary Key) (INT) Name: Name of the base object (VARCHAR) Size: Size (slots it takes) (INT) UsesType: ID of the type it uses (INT) UsesSlot: ID of the slot it uses (INT) SlotsInside: Amount of slots it haves inside (INT) Weight: Unused, for scrapped weight (FLOAT) MaxUses: Total amount of uses (INT) Display: Object ID to use as dropped object / portraits (INT) DisplayColor: Color of the object (INT) DisplayOffsets: RX,RY,RZ and Zoom of the portrait (INT) OnHandOffsets: X, Y, Z, RX, RY, RZ of the object while on hands (VARCHAR) OnBodyOffsets: boneid, X, Y, Z, RX, RY, RZ of the object while on body (VARCHAR) ObjectScales: X, Y, Z that the object will use as scale for both OnHand and OnBody (VARCHAR) SpecialFlag_1: Special flag value 1 (INT) SpecialFlag_2: Special flag value 2 (INT) SpecialFlag_3: Special flag value 2 (INT) playerinventories (PlayerName, ...) PlayerName: name of the player attached to the inventory (VARCHAR) <number>: ID of the slot, these are dynamic columns and are created/removed by altering the slots. playerobjects (PlayerID, PlayerName, BaseObjectID, CurrentUses, Position, Status, Condition, WorldX, WorldY, WorldZ, P_SpecialFlag_1, P_SpecialFlag_2) PlayerID: Internal SQL ID (Primary Key) (INT) PlayerName: Name of the owner if applies (VARCHAR) BaseObjectID: ID of the base object it uses (INT) CurrentUses: Current amount of uses it has if applies (INT) Position: Current position inside of a object/as a container (INT) Status: Current Status -> 1: Is a player owned container 2: Is inside any container 3: Is dropped 4: To be deleted next script reload. 5: Dropped object on hand. (INT) Condition: Unused, default 100. (INT) WorldX: Position X inside of world. (FLOAT) WorldY: Position Y inside of world. (FLOAT) WorldZ: Position Z inside of world (FLOAT) P_SpecialFlag_1: Player Special flag value 1 (INT) P_SpecialFlag_2: Player Special flag value 2 (INT) slots (SlotID, SlotName, MaxObjects) SlotID: Internal SQL ID (Primary Key) (INT) SlotName: Name of the slot (VARCHAR) MaxObjects: Max amount of objects to allow in that slot as containers (INT) types (TypeID, TypeName) TypeID: Internal SQL ID (Primary Key) (INT) TypeName: Name of the Type (VARCHAR)
enum PlayerObjectInfo { BaseID, PlayerID, OwnerName[24], CurrentUses, Position, Status, Condition, Float:WorldX, Float:WorldY, Float:WorldZ, P_SpecialFlag_1, P_SpecialFlag_2, InventoryID, Inventory[64], GameObject, AreaID, IsNear[PLAYERS] } new ObjectInfo[MAX_PLAYER_OBJECTS][PlayerObjectInfo]; new LastObjectInfoIndexUsed, TotalLoadedPlayerObjects; // Stores player object data into the memory enum eObjectData { ID, Name[32], Size, UsesType, SlotsInside, UsesSlot, MaxUses, Float:Weight, Display, DisplayColor, Float:DisplayOffsets[4], Float:OnHandOffsets[6], Float:OnBodyOffsets[7], Float:ObjectScales[3], SpecialFlag_1, SpecialFlag_2, SpecialFlag_3 } new ObjectData[MAX_BASE_OBJECTS][eObjectData]; new LastObjectDataIndexUsed, TotalLoadedBaseObjects; // Stores each object individual information enum eSlotData { SlotID, SlotName[32], MaxObjects } new SlotData[MAX_SLOTS][eSlotData]; new LastSlotDataIndexUsed, TotalLoadedSlots; // Stores each object individual information enum PlayerVariables { ContainersInPages[13], //MAX_CONTAINERS_LIMIT / MAX_CONTAINERS_PER_PAGE rounded up DroppedContainersInPages[13], //MAX_CONTAINERS_LIMIT / MAX_CONTAINERS_PER_PAGE rounded up ContainerStoredInSlot[MAX_CONTAINERS_PER_PAGE+1], //+1 for the onhand inventory DroppedContainerStoredInSlot[MAX_CONTAINERS_PER_PAGE], ActionStored[MAX_OBJECT_ACTIONS], ObjectInAction, ObjectInActionGlobal, ObjectInActionSource, CurrentListTotal, CurrentListPerPage, CurrentListPage, CurrentListTotalPages, CurrentListStorage[MAX_LIST_ITEMS], InventoryOpen, ContainersListingPage, DroppedContainersListingPage, ContainersListingMin, DroppedContainersListingMin, SelectedObjectID, SelectedContainerID, SelectedObjectSourceID, SelectedObjectGlobal, EdittingObjectID, EdittingActionID, EdittingSlotID, EdittingTypeID, EdittingListItem, OnHandObjectID, OnHandTypeID, OnHandWeaponID, OnHandAmmoObjectID, OnHandMagObjectID, OnHandSourceID, OnHandSourcePosition, ObjectStoredInIndex[10], ActionSwapStep, HasInvalidAmmo, WearingArmor, Float:DisplayingModelRotation, LastClickedObjectTick, LastClickedObjectID, OverridePosition, MemorySlot[2], Float:SelectedObjectHeaderY[MAX_CONTAINERS_PER_PAGE], HideTooltipTimerID, PlayerSlots[MAX_SLOTS] } new PlayerVar[PLAYERS][PlayerVariables]; enum eTypeInfo { TypeID, //ID in database TypeName[32] //Name of the type itself } new TypeData[MAX_OBJECT_TYPES][eTypeInfo]; new LastTypeDataIndexUsed, TotalLoadedTypes; enum eActionInfo { ActionID, //ID in database TypeIDAttached, //ID of the type that the action goes with ActionName[32] //Name of the action itself } new ActionData[MAX_TOTAL_ACTIONS][eActionInfo]; new LastActionDataIndexUsed, TotalLoadedActions; enum eGlobalInfo { ScriptLoaded } new GlobalData[eGlobalInfo];
- GetPlayerObjectMemory(PlayerObjectID) Returns the memory index (for ObjectInfo) where the PlayerObjectID is stored. - GetObjectDataMemory(BaseObjectID) Returns the memory index (for ObjectData) where the Object Base ID is stored. - GetPlayerObjectDataMemory(PlayerObjectID) Returns the memory index (for ObjectData) where the PlayerObjectID is stored - GetActionDataMemory(fActionID) - GetSlotDataMemory(fSlotID) - GetTypeDataMemory(fTypeID) Returns the memory index where any of those is stored (for ActionData, SlotData and TypeData respectively) - GetObjectBaseID(PlayerObjectID) Returns the player object base ID - ConnectMySQL(); Initializes the connection to the SQL server. - LoadObjectData(); Called automatically when the script initializes the connection with the SQL server. - LoadPlayerObjects(); Called after object data is loaded. - LoadActionsAndTypesData(); Called after player objects are loaded. - LoadTypesData() Called after actions are loaded. - LoadSlotsData(); Called after types are loaded. - CheckIfPlayerHasInventory(playerid); Checks if the playerid has an inventory in the database, if not, create it. - OnPlayerInventoryCreated(playerid); Called when the inventory is created. - LoadPlayerInventory(playerid) Called after inventory creation/player login. - OnNewPlayerObjectAdded(Float:fX,Float:fY,Float:fZ, SpawnUses, BaseObjectID) Called after a new player object is created using SpawnObject Float:fX, Float:fY, Float:fZ: Coordinates to spawn the object at. BaseObjectID: The base object ID that the new player object will use SpawnUses: Amount of uses to spawn the object with - DeleteBaseObject(BaseObjectID) Removes BaseObjectID from the game and the database. - HideOnHandObjectInventory(playerid) Hides the inventory of your on hand object - LoadPlayerNearContainers(playerid) Loads all the containers that the player is near and lists them under "Near objects" - LoadNearObjectInventory(playerid, ContainerObjectID, memslot) Loads all the objects inside the corresponding dropped Container Object ID memslot: Memory index where the container is stored at ObjectStoredInDroppedContainer[][][memslot] - LoadPlayerContainers(playerid) Loads all the containers owned by the player and lists them under "Your objects" - LoadObjectInventory(playerid, ContainerObjectID, memslot) Loads all the objects inside the corresponding player Container Object ID memslot: Memory index where the container is stored at ObjectStoredInContainer[][][memslot] - LoadOnHandObjectInventory(playerid, ObjectID) Loads the first seven objects inside your Hand object - OnObjectInsideChecked(ObjectID) Called when removing an object, internal check to remove it from all inventories. - CheckBulletLimit(playerid, BulletObject, BulletSource, BulletSourceType, Dest) This callback is called when moving a bullet object type inside of a weapon or a magazine, checks if the bullet has to split to fit the new weapon or mag, and if it does, create a new object at Dest with the new splitted bullet. playerid: Player effecting the callback. BulletObject: the ID of the Player Object of the Bullet BulletSource: the ID of the container that contains the bullet BulletSourceType: Type ID of the container that contains the bullet Dest: the destination of the BulletObject - CreateNewSplittedObject(playerid, ObjectDataID, Dest, DestType, fUses, Owner[]) Called after CheckBulletLimit detects that the bullet needs to be split and actually inserts the new object into the database. ObjectDataID: the base object that the new bullet will use DestType: the type ID of the destination container fUses: amount of uses to create the object with Owner: the new owner of the object - InsertObjectInventory(playerid, Type, Dest, DestType, ObjectDataID, fUses) Called after CreateNewSplittedBullet inserts the new object into the database, this sets up the object in the memory - OnObjectSplitted(playerid, Type, Dest, DestType, Object) Called after all the previous steps are completed, which moves the object into it's new destination. - UpdateObjectLastPosition(playerid, object) Called when the player adds a container to his inventory, to set the object on the last position available. - RefreshObjectInventoryForNear(ObjectID, Exclude = INVALID_PLAYER_ID) Refreshes the NearObjects of all players but the Excluded that are near the ObjectID - RemoveObjectFromNearPlayers(ObjectID) Removes the object from Near Objects from players that are Near that object. - DestroyNearInventoryObjects(playerid) Deletes all the Near objects text draws - DestroyActions(playerid) Destroys all the actions text draws - DestroyInventoryObjects(playerid) Destroys all the player containers text draws - CreateInventory(playerid) - DestroyInventory(playerid) - ShowInventoryBase(playerid) - HideInventoryBase(playerid) Manipulates the inventory base text draws. - TDTip(playerid, tip[], time = 6000) - TDInfo(playerid, info[], time = 6000) - TDAdmin(playerid, message[], time = 6000) - TDWarning(playerid, warning[], time = 6000) - Usage(playerid, error[], time = 6000) - TDError(playerid, error[], time = 6000) - TDOther(playerid, error[], time = 6000) Send a message to the player in the form of a textdraw. - SendTDMessage(playerid, type, fstring[], {Float, _}:...) Sends a formatted TD message of the type that you input TYPE_ERROR 1 TYPE_INFO 2 TYPE_ADMIN 3 TYPE_WARNING 4 TYPE_USAGE 5 TYPE_TIP 6 TYPE_OTHER 999 - GeneralTxtHide(playerid) - CreatePlayerTextdraws(playerid) - DestroyPlayerTextdraws(playerid) Manipulates all the general player text draws - RenderMessage(top, color, const text[]) - RenderMessageToAll(color, const text[]) Sends a rendered message to the player/to all. - RenderFormattedMessage(playerid, color, fstring[], {Float, _}:...) Sends a formatted rendered message to the player (to all if INVALID_PLAYER_ID) - GetWeaponSlot(weaponid) Returns the slot of the weapon
- DropObject(playerid, PlayerObjectID, PlayerObjectType, SourceContainer) This function is to be used when you want to drop an object from a player. This removes all special flags, unrender all the player containers, removes the object from it's source, updates the player inventories, etcetera. playerid: The player that effects the action. PlayerObjectID: The Object ID to drop. PlayerObjectType: Type ID of the player object. SourceContainer: The source of the Player Object. - DropObjectOnPosition(playerid, PlayerObjectID, Float:fX, Float:fY, Float:fZ) Drops the PlayerObjectID on the selected position (fX, fY, fZ) playerid: player that has dropped the object, -1 if not applies. - SpawnObject(Float:fX,Float:fY,Float:fZ, BaseObjectID, SpawnUses) Creates a new player object. - SetObjectUses(playerid, ObjectID, iUses) Set the Current Uses of the ObjectID - RemoveObjectFromDatabase(ObjectID, bool:inventoryerase) Removes completely a Player object from the database, erases inventory if true and removes it from any inventory it contains that object, also resets the special flags of all the objects that use the deleted object ID. - PutObjectInFirstEmptySlotPla(playerid, Object, SourceContainer = 0, Exclude = 0, bool:Drop = true) Puts the object in the first player container that can hold the object playerid: The player which will own the object Object: the actual player object ID SourceContainer: The container that contains the Object Exclude: Exclude a certain container to search in Drop: If true, it will drop the object if it wont find a space, if false, it will just return 0 - PutObjectInFirstEmptySlotCont(playerid, Object, SourceContainer, DestinationContainer, bool:Drop = true) Puts the object in the first empty slot inside a certain container DestionationContainer: the container where to put the Object - MoveObjectToObject(playerid, pos, PlayerObjectID, PlayerObjectType, SourceContainer, SourceType, DestinationContainer, DestinationType, NewOwner, OldOwner[24]) The main callback to move a object to another object playerid: playerid that called the function, INVALID_PLAYER_ID if none pos: The position where to move the object at. If pos = -1, it will attempt to move the object to the first empty slot inside the DestinationContainer, if it has no room, it then searches for any other container, and if it still has no room, it will drop the object to the ground. If pos = -2, it will attempt to put the object wherever it fits in DestinationContainer, and if it doesn't, do not allow the move at all. PlayerObjectID: the ID of the player object to move PlayerObjectType: the Type ID of the PlayerObjectID SourceContainer: The source container of PlayerObjectID SourceType: Type ID of the source container DestinationContainer: The player id of the container to move the object to DestinationType: Type ID of the destination container NewOwner: Player ID of the new owner OldOwner: Name of the old owner - OnObjectMovedAttempt(playerid, PlayerObjectID, PlayerObjectType, SourceContainer, SourceType, DestinationContainer, DestinationType, NewOwner) This is called at the start of MoveObjectToObject, if this returns 0, it stops the MoveObjectToObject, use this callback to check for conditions when moving objects. - OnServerObjectMoved(playerid, PlayerObjectID, PlayerObjectType, SourceContainer, SourceType, DestinationContainer, DestinationType, NewOwner) This is called at the end of MoveObjectToObject, use this callback to set all the SpecialFlags and variables needed, as if this was called, the move was successful. - InternalSwapObject(playerid, ObjectsSource, SelectedObject, SecondObject, SelectedObjectType, SecondObjectType, SecondObjectSourceType, SelectedObjectSourceType, SelectedObjectPosition, SecondObjectPosition, mem) This function is to be used when swapping objects that are in the same containers (hence the internal), as it simply only swaps the positions. playerid: Player that effected the Swap ObjectSource: Source of the Selected Object SelectedObject: The object that the player has selected (Also First Object, or Object) SecondObject: The object the player clicked on SelectedObjectType: The type of the selected object SecondObjectType: the type of the second object SecondObjectSourceType: the type ID of the source of the second object SelectedObjectSourceType: the Type ID of the source of the selected object SelectedObjectPosition: The position of the first (selected) object SecondObjectPosition: The position of the second object mem: Memory slot of where the SecondObjectContainer is stored at (this is normally the third variable of GlobalObjectsSlots and ObjectStoredInDroppedContainer, etc.) - SwapObjectWithObject(playerid, SelectedObjectSource, SecondObjectSource, SelectedObject, SecondObject, SelectedObjectType, SecondObjectType, SecondObjectSourceType, SelectedObjectSourceType, SelectedObjectPosition, SecondObjectPosition, mem) This function shares the parameters with it's Internal sister; this is to be used when the objects being swapped are in different containers. - OnObjectSwapAttempt(playerid, SelectedObjectSource, SecondObjectSource, SelectedObject, SecondObject, SelectedObjectType, SecondObjectType, SecondObjectSourceType, SelectedObjectSourceType) This is a callback, this is caleld at the start of both Swap functions, if returned 0, it will stop the swap, use this to check for conditions. IMPORTANT: this is also the source of the scripted actions; if you want to create special actions (actions that pop up when you click an object with another object, such as the bullets ones) THIS IS THE PLACE, you will find already done examples inside of this callback. - OnObjectSwapped(playerid, SelectedObjectSource, SecondObjectSource, SelectedObject, SecondObject, SelectedObjectType, SecondObjectType, SecondObjectSourceType, SelectedObjectSourceType) This callback is called at the end of both swapping functions, use this to set all the variables as if this was called the swap was successfull. - AddObjectToObject(playerid, object, dest) Adds an object to the dest inventory dest: The ID of the destination of the object. - RemoveObjectFromObject(playerid, object, source) Removes an object from the source inventory source: The ID of the source of the object. - OnPlayerClickAction(playerid, ObjectID, fActionID, fActionName[], ObjectType, ActionObjectUses, aTotalUses, Flag1, Flag2, Flag3, objectsource, SpFlag1, SpFlag2, mem1, mem2) This callback is called when the player clicks an option from the action menu. playerid: player that clicked the action. ObjectID: ID of the object that the action was clicked on. fActionID: ID of the action clicked. fActionName: Name of the action clicked. ObjectType: Type of the Object that the action was clicked on. ActionObjectUses: Current uses of the object that was clicked on. aTotalUses: Total uses of the object that was clicked on. Flag1, Flag2, Flag3: SpecialFlags of the base object of the ObjectID objectsource: Source of the ObjectID SpFlag1, SpFlag2: Player special flags of the ObjectID mem1: position of the Object mem2: Position of the container in the memory. - SplitAmmo(playerid, ObjectID, newammo, oldammo, ObjectSource) Function to split an object (used for ammo) playerid: Player effecting the action ObjectID: The player ObjectID to split newammo: Amount of uses that the new splitted object will have oldammo: Amount of uses that the ObjectID will have left ObjectSource: source of the ObjectID - CheckForBulletCombining(playerid, destobject, destuses, desttotaluses, source, source_source, destcaliber) Function to check for combining bullets destobject: The Object that will get combined with the player's selected object destuses: Uses of the player's SelectedObject desttotaluses: Uses of the player's SelectedObject source: The player's selected object ID source_source: Source of the player's selected object ID destcaliber: The caliber (Stored in Special Flags) of the destobject - OnPlayerPutObjectInHand(playerid, object, object_type) Called when the player puts any object on his hand object: ID of the player object object_type: Type of the player Object. - OnPlayerPutWeaponOnHand(playerid, WeaponObjectID, TypeOfWeapon) Called inside of OnPlayerPutObjectInHand, when it detects that the object that was put in the player's hand was a weapon. - OnPlayerRemoveWeaponFromHand(playerid) Called when the player removes a weapon from his hand. - CheckOnHandWeaponAmmo(playerid) Function used to check the player's current ammo inside of the weapon, and set all the corresponding values (remove the weapon if empty, etc.) - OnObjectDropped(playerid, object, Float:fX, Float:fY, Float:fZ) Called when an object is dropped. - OnPlayerRequestActionList(playerid, PlayerObjectID, memoryslotused, PlayerObjectType, Container, bool:Global) Called when the player double clicks an object, or when the player clicks an object with another object and there is an scripted action to happen. PlayerObjectID: the ID of the objec that the player clicked. memoryslotused: Position of textdraw of the PlayerObjectID (the textdraw index). PlayerObjectType: Type ID of the player object. Container: ID of the container that was clicked if applies. Global: whether the object is global or not.
- UnrenderPlayerContainer(playerid, ObjectID) - RenderPlayerContainer(playerid, ObjectID) Renders/unrenders the player object ID as Attached Object on the body. - OnPlayerEquipContainer(playerid, ObjectID) - OnPlayerUnEquipContainer(playerid, ObjectID) Called when the player equips/unequips a container inside it's inventory.
- CountObjectsInInventory(ObjectID) Returns amount of objects inside the inventory of the inputted Object Player ID - CountPlayerContainers(playerid) Returns amount of containers a plyer owns - GetPlayerContainers(playerid) Returns containers of a player as a string, IDs separated by commas. - IsContainerSlotFree(Container, Slot) Returns 1 if the Slot on the Container is free, 0 if it isn't - CountEmptySlotsAfterPosition(Container, fPosition) Returns amount of empty slots inside of Container after fPosition - FindFirstEmptySlotInContainer(Container, start = 0) Returns the first empty slot in the Container, starting from any position - CheckIfObjectFitsInObject(ObjectToCheck, InsideOfObject, NewPosition) Returns 1 if the ObjectToCheck fits inside of InsideOfObject beginning from NewPosition - CheckIfObjectFitsInPlaceOf(ObjectToCheck, SecondObject, SecondObjectContainer) Returns 1 if the ObjectToCheck fits in place of the SecondObject that is inside SecondObjectContainer
- SetObjectColors(GTAObjectID, PlayerObjectID, ObjectBaseID = -1) Recolors an object dropped if it's not a GTA SA weapon GTAObjectID: The SAMP object ID PlayerObjectID: The ID of the player object ObjectBaseID: The Base Object ID of the player object
- ListActions(playerid, ItemsPerPage, Page) Creates a dialog listing all the actions - ListTypes(playerid, ItemsPerPage, Page) Creates a dialog listing all types - ListSlots(playerid, ItemsPerPage, Page) Creates a dialog listing all slots - ListObjects(playerid, ItemsPerPage, Page) Creates a dialog listing all objects playerid: player to show the dialog ItemsPerPage: how many items in one page Page: page to display - EditActions(playerid, fActionID) Brings up the action editing panel for that Action ID. - OnPlayerCreateAction(playerid) Called when a new action is created, the ID is the cache_insert_id - DeleteAction(fActionID) Deletes the fActionID from the memory and the database. - OnPlayerCreateType(playerid) Called when a new type is created, the ID is the cache_insert_id - DeleteType(iTypeID) Deletes the iTypeID from the memory and the database. - EditType(playerid, ifTypeID) Brings up the action editing panel for that Type ID. - PlayerEditSlot(playerid, fSlotID) Brings up the action editing panel for that Slot ID. - OnPlayerCreateSlot(playerid) Called when a new slot is created, the ID is the cache_insert_id - DeleteSlot(fSlotID) Deletes the slot from the memory and the database. - OnPlayerCreateBaseObject(playerid, Duplicate) Called when the player creates a new object via /newobject Duplicate: if the new object should be a duplicate of a currently existing base object. (0 for none) - PlayerEditBaseObject(playerid, BaseObjectID) Brings up the action editing panel for that Object ID.
/*These are all player textdraws, since most use More than two dimensions I can't list them in PlayerVar*/
new PlayerText:Inv[PLAYERS][24],
PlayerText:GeneralTxt[PLAYERS][2],
PlayerText:InventoryObjectsHead[PLAYERS][5][MAX_CONTAINERS_PER_PAGE],
PlayerText:InventoryObjectsSlots[PLAYERS][MAX_CARRY_OBJECTS][MAX_CONTAINERS_PER_PAGE+1], //+1 is the onhand inventory
PlayerText:InventoryObjectsAmount[PLAYERS][MAX_CARRY_OBJECTS][MAX_CONTAINERS_PER_PAGE],
PlayerText:GlobalObjectsHead[PLAYERS][5][MAX_CONTAINERS_PER_PAGE],
PlayerText:GlobalObjectsSlots[PLAYERS][MAX_CARRY_OBJECTS][MAX_CONTAINERS_PER_PAGE],
PlayerText:GlobalObjectsAmount[PLAYERS][MAX_CARRY_OBJECTS][MAX_CONTAINERS_PER_PAGE],
PlayerText:ActionMenu[PLAYERS][5];
/*This can't go into PlayerVar because of the three dimensions*/
new ObjectStoredInContainer[PLAYERS][MAX_CARRY_OBJECTS][MAX_CONTAINERS_PER_PAGE+1], //+1 is the onhand inventory
ObjectStoredInDroppedContainer[PLAYERS][MAX_CARRY_OBJECTS][MAX_CONTAINERS_PER_PAGE];
new dbHandle, query[128], medquery[256], bigquery[512], nname[24], msg[144];
• /objects - Lists and brings up the object edition menu • /newobject - Creates an object and inserts you into it's edition mode • /remobject <id or part of name> - Removes a global object from the DB and the memory. • /spawnobject <ID or part of name> - Spawns a persistent object in front of the admin. • /actions - Brings up the action editing menu. • /newaction - Creates a new action and puts you in edit mode. • /remaction <ID or part of name> - Removes an action from the DB and the memory • /types - Brings up the types editing menu • /newtype - Creates a new type and puts you in it's edition mode • /remtype <ID or part of name> - removes a type from the Database and the memory • /slots - Brings up a list with all the current slots • /newslot - Creates a new slot and puts you into it's edit mode. • /remslot <ID or part of name> - Removes a slot from the database and the memory
#define MYSQL_HOST "localhost" #define MYSQL_USER "root" #define MYSQL_UPASS "" #define MYSQL_DB "inventory"
#define PLAYERS 200 //Max players, affects really heavily the .amx size. #define MAX_PLAYER_OBJECTS 32768 //Max amount of player objects that can be loaded into the memory from the database (affects heavily the .amx size) #define MAX_BASE_OBJECTS 2048 //Max amount of base objects that can be loaded into the memory from the database #define MAX_OBJECT_TYPES 150 //Max amount of types that can be loaded into the memory from the database #define MAX_TOTAL_ACTIONS 150 //Max amount of actions that can be loaded into the memory from the database #define MAX_SLOTS 50 //Max amount of slots that can be loaded into the memory from the database #define MAX_OBJECT_ACTIONS 3 //Max actions that can be listed in an object when double clicked #define MAX_CARRY_OBJECTS 40 //Max inventory slots for a single object #define MAX_LIST_ITEMS 20 //Max items that can be listed in one list #define MAX_CONTAINERS_PER_PAGE 4 //Max amount of containers that can be displayed at once (both for global and player containers) #define MAX_CONTAINERS_LIMIT 50 //Max amount of containers to be loaded in the memory at once (both for global and player containers)
#include <a_samp> #include <a_mysql> #include <zcmd> #include <sscanf2> #include <streamer> #include <crashdetect> #include <SortArray>
Good job. Very good job. Can u add another link for downloading? I have some problems with your links
|
I saw the pictures this week and it looks that it something very good.
Have you a server with this already implemented to see it ? |
- Too much code in a single script
- This should be a include not a filterscript how is anyone to effectively implement this into a gamemode? Using CallRemoteFunction() and/or PVars is a terrible idea |
- No need to delete playertextdraws when a player disconnects this happens automatically |
- No OnPlayerClickTextDraw() so the menu will stay up if you press escape (very annoying), how about when the player dies? Doesn't close either. How about if the player gets shot? That should close the inventory immediately so they can fight |
The design looks bad, otherwise you did a good job out there!
|
Well it's pretty easy to make it an include, think of an include as code you simply insert into your gamemode when you use hooking (y_hooks) it's really no different than making a filterscript. The advantage of this is now the gamemode can directly access the include this is where static & stock modifiers are useful.
Everything that won't be used outside of your include should use a static modifier (variables/functions) functions that can be used outside of your include should usually have the stock modifier. You could actually make your system into an include in only a few minutes but keep in mind some functions like IsNumeric() might already be defined. |
mysql_format(dbHandle, medquery, sizeof medquery, "SELECT * FROM playerobjects \ JOIN objects ON playerobjects.O_ObjectID = objects.ID WHERE playerobjects.PlayerObjectStatus = 3 OR playerobjects.PlayerObjectStatus = 4");
mysql_format(dbHandle, query, sizeof query, "SELECT * FROM objects WHERE Name LIKE('%%%e%%') LIMIT 0,1",Obj);
/remaction a' or '1'='1 |
DELETE FROM actions WHERE Action = 'a' or '1'='1' |
if(sscanf(params,"s[32]", id))
if(isnull(params))
If query doesn't contain a single parameter, you can simply pass it to mysql_query. Think of format + SendClientMessage (just with additional %e).
|
Code:
if(sscanf(params,"s[32]", id)) Code:
if(isnull(params)) |
Default JOIN is INNER JOIN in mysql engine. Please specify type of join you want, because in most cases it should be LEFT JOIN.
|
Overall nice system, I like it.
P.S. I hate you forever and ever for raven's rp. |