Raised This Month: $ Target: $400
 0% 

[EXTENSION] SHVector with example usage


Post New Thread Reply   
 
Thread Tools Display Modes
Mechanisms
Junior Member
Join Date: Nov 2012
Location: Thailand
Old 11-16-2012 , 10:28   Re: [EXTENSION] SHVector with example usage
Reply With Quote #31

How to fix this thing.. *help*

Quote:
L 11/16/2012 - 22:27:08: [SM] Unable to load extension "shvector.ext": Older Metamod versi
on required, probably 1.4.x (10 < 14)
PS. I'm New
Mechanisms is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-16-2012 , 10:29   Re: [EXTENSION] SHVector with example usage
Reply With Quote #32

You dont. No current plugin should be requiring this - it's been part of SourceMod for years.
__________________
asherkin is offline
Mechanisms
Junior Member
Join Date: Nov 2012
Location: Thailand
Old 11-16-2012 , 10:45   Re: [EXTENSION] SHVector with example usage
Reply With Quote #33

That mean i can't use this plugin? or what please recommend.
Mechanisms is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-16-2012 , 11:12   Re: [EXTENSION] SHVector with example usage
Reply With Quote #34

Quote:
Originally Posted by Mechanisms View Post
That mean i can't use this plugin? or what please recommend.
He recommends using the adt_array commands in plugins:

Quote:
Originally Posted by asherkin View Post
It was integrated into SourceMod in the form of ADT arrays.
Look at the API docs.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Mechanisms
Junior Member
Join Date: Nov 2012
Location: Thailand
Old 11-16-2012 , 12:10   Re: [EXTENSION] SHVector with example usage
Reply With Quote #35

Quote:
He recommends using the adt_array commands in plugins:
Thanks, Sorry how to use?, Where is API docs.

Last edited by Mechanisms; 11-16-2012 at 12:32.
Mechanisms is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 11-16-2012 , 13:00   Re: [EXTENSION] SHVector with example usage
Reply With Quote #36

He linked you the API docs. Using an adt_array is very simple. You create the array with CreateArray(), push data into using the PushArray*() functions, and retrieve the information from it using the GetArray*() functions. Look at the linked page for more useful functions as well.
bl4nk is offline
Mechanisms
Junior Member
Join Date: Nov 2012
Location: Thailand
Old 11-17-2012 , 03:28   Re: [EXTENSION] SHVector with example usage
Reply With Quote #37

Quote:
Originally Posted by bl4nk View Post
He linked you the API docs. Using an adt_array is very simple. You create the array with CreateArray(), push data into using the PushArray*() functions, and retrieve the information from it using the GetArray*() functions. Look at the linked page for more useful functions as well.
Oh, i found it..

http://wiki.alliedmods.net/index.php...eMod_Scripting

Quote:
C:\SRCDS\css\cstrike\addons\sourcemod\scripti ng\include
Quote:
adt.inc
adt_array.inc
adt_stack.inc
adt_trie.inc
Then what next? please recommends sir.

Last edited by Mechanisms; 11-17-2012 at 04:59.
Mechanisms is offline
Mechanisms
Junior Member
Join Date: Nov 2012
Location: Thailand
Old 11-17-2012 , 10:21   Re: [EXTENSION] SHVector with example usage
Reply With Quote #38

Actually i have add both code is first page, But still be right this please help.

Quote:
[SM] Unable to load extension "shvector.ext": Older Metamod version required, probably 1.4.x (10 < 14)
[SM] Unable to load plugin "RPGx.smx": Required extension "SHVector Extension" file("shvector.ext") not running
This is my shvector.inc

Quote:
#if defined _shvector_included
#endinput
#endif

#define _shvector_included

#include <sourcemod>
#include <shvector>

public Plugin:myinfo =
{
name = "SHVector Test",
author = "PimpinJuice",
description = "Testing out the SHVector extension",
version = "1.0.0.0",
url = "http://pimpinjuice.net/"
};

public OnPluginStart()
{
// Create a vector
new Handle:shVec=SHVectorCreate(TYPE_CELL); // supports int,float,bool, and handle
SHVectorInsert_Cell(shVec,ITER_BACK,2.5); // Put 2.5 at the back of the vector, size should now be 1.
PrintToServer("The size of the vector is now %d",SHVectorSize_Cell(shVec));
// Lets add an int and a bool
SHVectorInsert_Cell(shVec,ITER_BACK,5);
SHVectorInsert_Cell(shVec,ITER_BACK,true);
// Right now the vector reads 2.5,5,true, in that order, but I want it to say true,5,2.5
SHVectorSwap_Cell(shVec,0,2);
// Lets see our full vector and our size
PrintToServer("size: %d\n0 == %d\n1 == %d\n2 == %f",SHVectorSize_Cell(shVec),SHVectorAt_Cell( shVec,0),SHVectorAt_Cell(shVec,1),SHVectorAt_ Cell(shVec,2));
// Lets give our system the memory back
SHVectorFree_Cell(shVec);
}

#include <core>

#define TYPE_CELL 0
#define TYPE_STRING 1
#define ITER_FRONT 0
#define ITER_BACK 1

/**
* Creates a SHVector
* @param type The type of vector to create (TYPE_CELL or TYPE_STRING)
* @return The SHVector handle of the result
*/
native Handle:SHVectorCreate(type=TYPE_CELL);

/**
* Frees the vector from the memory
* @param vector The vector to free from the memory
* @noreturn
*/
native SHVectorFree_Cell(Handle:vector);
native SHVectorFree_String(Handle:vector);

/**
* Gets the vector value at the provided position
* @param vector The vector to use
* @param pos The position in the vector to get the value of
* @return The value
*/
native any:SHVectorAt_Cell(Handle:vector,pos);
native SHVectorAt_String(Handle:vector,pos,String:st oreto[],maxlen);

/**
* Sets the vector value at the provided position
* @param vector The vector to use
* @param pos The position in the vector to set the value of
* @param value The value to set as
* @return Returns 0 if there was a failure
*/
native SHVectorSetAt_Cell(Handle:vector,pos,any:valu e);
native SHVectorSetAt_String(Handle:vector,pos,String :value[]);

/**
* Clear the whole vector provided
* @param vector The vector to use
* @noreturn
*/
native SHVectorClear_Cell(Handle:vector);
native SHVectorClear_String(Handle:vector);

/**
* Is the vector empty?
* @param vector The vector to use
* @return Returns true if the vector is empty
*/
native bool:SHVectorIsEmpty_Cell(Handle:vector);
native bool:SHVectorIsEmpty_String(Handle:vector);

/**
* Swap the contents of two pos's in a vector
* @param vector The Vector to use
* @param pos1 One of the pos's
* @param pos2 The other pos
* @return Returns 0 if there was a failure
*/
native SHVectorSwap_Cell(Handle:vector,pos1,pos2);
native SHVectorSwap_String(Handle:vector,pos1,pos2);

/**
* Insert a new item into a vector
* @param vector The vector to use
* @param where Where to put the item (ITER_FRONT or ITER_BACK)
* @param value The value to insert
* @return Returns 0 if there was a failure
*/
native SHVectorInsert_Cell(Handle:vector,where,any:v alue);
native SHVectorInsert_String(Handle:vector,where,Str ing:value[]);

/**
* Erase an item from the vector
* @param vector The vector to use
* @param pos The position to delete from the vector
* @return Returns 0 if there was a failure
*/
native SHVectorErase_Cell(Handle:vector,pos);
native SHVectorErase_String(Handle:vector,pos);

/**
* The amount of items in the vector
* @param vector The vector to use
* @return Returns the amount of items in the vector
*/
native SHVectorSize_Cell(Handle:vector);
native SHVectorSize_String(Handle:vector);

/**
* @endsection
*/

/**
* Do not edit below this line!
*/
public Extension:__ext_shvector =
{
name = "SHVector Extension",
file = "shvector.ext",
#if defined AUTOLOAD_EXTENSIONS
autoload = 1,
#else
autoload = 0,
#endif
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
};

Last edited by Mechanisms; 11-17-2012 at 10:21.
Mechanisms is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 11-17-2012 , 10:35   Re: [EXTENSION] SHVector with example usage
Reply With Quote #39

Quote:
Originally Posted by Mechanisms View Post
Actually i have add both code is first page, But still be right this please help.



This is my shvector.inc
*facepalm* they just said that thos isnt usable use adt_array this is outdated.
Mitchell is offline
Mechanisms
Junior Member
Join Date: Nov 2012
Location: Thailand
Old 11-17-2012 , 11:42   Re: [EXTENSION] SHVector with example usage
Reply With Quote #40

Quote:
Originally Posted by Mitchell View Post
*facepalm* they just said that thos isnt usable use adt_array this is outdated.
Really don't know please complete shvector.inc.
Mechanisms is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode