I got some problems with that native. My path is "radio/ct_affirm.wav" and I would like to split the folder and the file name, so I used strtok with "/". It has also a function, to check if there are two folders (szOtherFolder). But I don't understand why it bugs.
PHP Code:
#include <amxmodx>
#define PLUGIN "test"
#define VERSION "1.0"
#define AUTHOR "bibu"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /string", "string")
}
public string(id)
{
new szValue[64] = "radio/ct_affirm.wav"
if(contain(szValue, "/"))
{
new szFolder[16]
log_amx("* szValue contains a '/'")
strtok(szValue, szFolder, charsmax(szFolder), szValue, charsmax(szValue), '/')
log_amx("* szFolder: %s", szFolder)
log_amx("* szValue: %s", szValue)
if(contain(szValue, "/"))
{
new szOtherFolder[8]
log_amx("* szValue contains another '/'")
strtok(szValue, szOtherFolder, charsmax(szOtherFolder), szValue, charsmax(szValue), '/')
log_amx("* szOtherFolder: %s", szOtherFolder)
log_amx("* szValue: %s", szValue)
}
}
}
This is the output:
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.