more natives touchups/additions
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40262
This commit is contained in:
parent
5d23974a3e
commit
2a7f0b9854
@ -16,6 +16,7 @@ enum FileType
|
||||
FileType_File = 2, /* File is a file */
|
||||
};
|
||||
|
||||
#define PLATFORM_MAX_PATH 256
|
||||
|
||||
/**
|
||||
* @brief Opens a directory/folder for contents enumeration.
|
||||
@ -39,4 +40,4 @@ native Handle:OpenDirectory(const String:path[]);
|
||||
* @return True on success, false if there are no more files to read.
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native bool:ReadDirEntry(Handle:dir, String:buffer[], maxlength, &FileType:type=0);
|
||||
native bool:ReadDirEntry(Handle:dir, String:buffer[], maxlength, &FileType:type=FileType_Unknown);
|
||||
|
@ -19,6 +19,7 @@ struct Plugin
|
||||
#include <float>
|
||||
#include <handles>
|
||||
#include <string>
|
||||
#include <files>
|
||||
|
||||
/**
|
||||
* Declare this as a struct in your plugin to expose its information.
|
||||
@ -143,9 +144,9 @@ native GetClientCount(bool:inGameOnly=true);
|
||||
* @param client Player index.
|
||||
* @param name Buffer to store the client's name.
|
||||
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
||||
* @noreturn
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
native GetClientName(client, String:name[], maxlen);
|
||||
native bool:GetClientName(client, String:name[], maxlen);
|
||||
|
||||
/**
|
||||
* Retrieves a client's IP address.
|
||||
@ -153,9 +154,9 @@ native GetClientName(client, String:name[], maxlen);
|
||||
* @param client Player index.
|
||||
* @param name Buffer to store the client's ip address.
|
||||
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
||||
* @noreturn
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
native GetClientIP(client, String:ip[], maxlen);
|
||||
native bool:GetClientIP(client, String:ip[], maxlen);
|
||||
|
||||
/**
|
||||
* Retrieves a client's authentication string (SteamID).
|
||||
@ -163,9 +164,9 @@ native GetClientIP(client, String:ip[], maxlen);
|
||||
* @param client Player index.
|
||||
* @param auth Buffer to store the client's auth string.
|
||||
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
||||
* @return Returns 0 on failure, non-zero otherwise.
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
native GetClientAuthString(client, String:auth[], maxlen);
|
||||
native bool:GetClientAuthString(client, String:auth[], maxlen);
|
||||
|
||||
/**
|
||||
* Returns if a certain player is connected.
|
||||
|
@ -74,6 +74,28 @@ stock bool:StrEqual(const String:str1[], const String:str2[], bool:caseSensitive
|
||||
*/
|
||||
native StrCopy(String:dest[], destLen, const String:source[]);
|
||||
|
||||
/**
|
||||
* Formats a string according to the SourceMod format rules (see documentation).
|
||||
*
|
||||
* @param buffer Destination string buffer.
|
||||
* @param maxlength Maximum length of output string buffer.
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
*/
|
||||
native Format(String:buffer[], maxlength, const String:format[], {Handle,Float,String,_}:...);
|
||||
|
||||
/**
|
||||
* Formats a string according to the SourceMod format rules (see documentation).
|
||||
* @note This is the same as Format(), except none of the input buffers can overlap the same
|
||||
* memory as the output buffer. Since this security check is removed, it is slightly faster.
|
||||
*
|
||||
* @param buffer Destination string buffer.
|
||||
* @param maxlength Maximum length of output string buffer.
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
*/
|
||||
native FormatEx(String:buffer[], maxlength, const String:format[], {Handle,Float,String,_}:...);
|
||||
|
||||
/**
|
||||
* Converts a string to an integer.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <sourcemod>
|
||||
#include <handles>
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
@ -7,22 +8,23 @@ public Plugin:myinfo =
|
||||
description = "Tests Stuff",
|
||||
version = "1.0.0.0",
|
||||
url = "http://www.sourcemod.net/"
|
||||
}
|
||||
};
|
||||
|
||||
copy(String:dest[], maxlength, const String:source[])
|
||||
{
|
||||
new len
|
||||
|
||||
while (source[len] != '\0' && len < maxlength)
|
||||
{
|
||||
dest[len] = source[len]
|
||||
len++
|
||||
}
|
||||
|
||||
dest[len] = '\0'
|
||||
}
|
||||
native PrintStuff(const String:buffer[]);
|
||||
|
||||
public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
|
||||
{
|
||||
return true
|
||||
new String:buffer[PLATFORM_MAX_PATH];
|
||||
new FileType:type;
|
||||
|
||||
new Handle:dir = OpenDirectory("addons/stripper");
|
||||
while (ReadDirEntry(dir, buffer, sizeof(buffer), type))
|
||||
{
|
||||
decl String:stuff[1024];
|
||||
Format(stuff, sizeof(stuff), "Type: %d Dir: %s", _:type, buffer)
|
||||
PrintStuff(stuff);
|
||||
}
|
||||
CloseHandle(dir);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user