From fb2be2256fda545f047c5f22983ab02d67e91202 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 19 Sep 2004 17:20:14 +0000 Subject: [PATCH] added amx_strtok for jtp10181 --- amxmodx/string.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/amxmodx/string.cpp b/amxmodx/string.cpp index 36d1dcde..1e452b4a 100755 --- a/amxmodx/string.cpp +++ b/amxmodx/string.cpp @@ -448,6 +448,60 @@ char* format_arguments(AMX *amx, int parm,int& len) return *buffer; } +//added by BAILOPAN for jtp10181 +//takes a string and breaks it into a 1st param and rest params +//different from strbreak because it's more crafted for control +static cell AMX_NATIVE_CALL amx_strtok(AMX *amx, cell *params) +{ + int left_pos = 0; + int right_pos = 0; + unsigned int i = 0; + bool done_flag = false; + int len = 0; + + //string[] + char *string = get_amxstring(amx, params[1], 0, len); + //left[] + char *left = new char[len+1]; + //right[] + char *right = new char[len+1]; + int leftMax = params[3]; + int rightMax = params[5]; + //token + char token = params[6]; + //trim + int trim = params[7]; + for (i=0; i