This topic was marked solved by Sebastian, on March 13th, 2021, 02:04 AM
ChangeCol cmd Fix

Kalee

  • Newbie
  • Posts: 20
ChangeCol cmd Fix
«  »
When itry to type like like this "/changecol" then message occurrs from scripts "/changecol <car id> <col1> <col2>".but if i try like this "/changecol 132 \or any id else" then no respose come ,no message comes out like /changecol <id> <col> <col>
help plz


 if (cmd=="changecol")
{
if( !text ) MessagePlayer("[#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !player.IsSpawned ) MessagePlayer("[#E0E0E0]You must be spawn first", player );
else {
local TextSplit = split( text, " " ),VehicleID=TextSplit[ 0 ],ColID1=TextSplit[ 1 ],ColID2=TextSplit[ 2 ];
if ( !IsNum(VehicleID)) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !IsNum(ColID1)) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !IsNum(ColID2)) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !FindVehicle(VehicleID.tointeger())) MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player);
else {
local v=FindVehicle(VehicleID.tointeger())
v.Colour1=ColID1.tointeger();
v.Colour2=ColID2.tointeger();
QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+ColID1+"' WHERE ID='"+VehicleID+"'");
QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+ColID2+"' WHERE ID='"+VehicleID+"'");
Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
     }
     }
}

MEGAMIND

  • Hero Member
  • Developer of Webnet Official
  • Posts: 807
Re: ChangeCol cmd Fix
« Reply #1,  »
Code: [Select]
/changecol <car id> <col1> <col2>
Means
/changecol -> is a cmd
<car id> -> vehicle id
<col1> -> color 1
<col2> -> color 2

so it goes like this

Code: [Select]
/changecol 191 1 5

Kalee

  • Newbie
  • Posts: 20
Re: ChangeCol cmd Fix
« Reply #2,  »
Quote from MEGAMIND on November 5th, 2020, 02:28 PM
Code: [Select]
/changecol <car id> <col1> <col2>
Means
/changecol -> is a cmd
<car id> -> vehicle id
<col1> -> color 1
<col2> -> color 2

so it goes like this

Code: [Select]
/changecol 191 1 5
No,I my mean is that when i type the cmd like
Code: [Select]
/changecol
.and left the other text empty,it show the error message but if i type one text
Code: [Select]
(i mean /changecol 191 )
and left the third empty it dont show error message.help!

Inferno

  • Jr. Member
  • Posts: 98
Re: ChangeCol cmd Fix
« Reply #3,  »
Code: [Select]
if (cmd=="changecol")
{
if( !text ) MessagePlayer("[#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !player.IsSpawned ) MessagePlayer("[#E0E0E0]You must be spawn first", player );
else {
local TextSplit = split( text, " " ),VehicleID=TextSplit[ 0 ],ColID1=TextSplit[ 1 ],ColID2=TextSplit[ 2 ];
if ( !IsNum(VehicleID)) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !IsNum(ColID1)) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !IsNum(ColID2)) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Code /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>", player);
else if ( !FindVehicle(VehicleID.tointeger())) MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); else if(!ColID1) return MessagePlayer(" Write Colour Id ",player); else if(!ColID2) return MessagePlayer(" Write Colour ID ",player);
else {
local v=FindVehicle(VehicleID.tointeger())
v.Colour1=ColID1.tointeger();
v.Colour2=ColID2.tointeger();
QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+ColID1+"' WHERE ID='"+VehicleID+"'");
QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+ColID2+"' WHERE ID='"+VehicleID+"'");
Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
     }
     }

Return 0;

}
Viva la VU
VFS Developer
VCCNR Administrator

Sonmez

  • Jr. Member
  • Yo! It's time to play the fair game!
  • Posts: 63
Re: ChangeCol cmd Fix
« Reply #4,  »
You can use this.
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
if (!perfect) createAgain();

Inferno

  • Jr. Member
  • Posts: 98
Re: ChangeCol cmd Fix
« Reply #5,  »
Quote from Sonmez on November 16th, 2020, 02:04 PM
You can use this.
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
It will still throw the same console error when cmd is typed as /cmd carID and not whole cmd.
And it wont show ingame syntax for half cmd.

Also you can use :

Code: [Select]
if(!IsNum(ColID1)) return MessagePlayer(" Colour ID must be integer ",player);
Instead of
Code: [Select]
if(!IsNum(ColID1)) {
MessagePlayer(" Write Integer ",player);
return false;
}

Viva la VU
VFS Developer
VCCNR Administrator

Sonmez

  • Jr. Member
  • Yo! It's time to play the fair game!
  • Posts: 63
Re: ChangeCol cmd Fix
« Reply #6,  »
Quote from Inferno on November 16th, 2020, 02:16 PM
Quote from Sonmez on November 16th, 2020, 02:04 PM
You can use this.
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
It will still throw the same console error when cmd is typed as /cmd carID and not whole cmd.
And it wont show ingame syntax for half cmd.

Also you can use :

Code: [Select]
if(!IsNum(ColID1)) return MessagePlayer(" Colour ID must be integer ",player);
Instead of
Code: [Select]
if(!IsNum(ColID1)) {
MessagePlayer(" Write Integer ",player);
return false;
}
This line already solves the problem mentioned:
Code: [Select]
if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}


if (!perfect) createAgain();

Kalee

  • Newbie
  • Posts: 20
Re: ChangeCol cmd Fix
« Reply #7,  »
Quote from Sonmez on November 16th, 2020, 02:48 PM
Quote from Inferno on November 16th, 2020, 02:16 PM
Quote from Sonmez on November 16th, 2020, 02:04 PM
You can use this.
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
It will still throw the same console error when cmd is typed as /cmd carID and not whole cmd.
And it wont show ingame syntax for half cmd.

Also you can use :

Code: [Select]
if(!IsNum(ColID1)) return MessagePlayer(" Colour ID must be integer ",player);
Instead of
Code: [Select]
if(!IsNum(ColID1)) {
MessagePlayer(" Write Integer ",player);
return false;
}
This line already solves the problem mentioned:
Code: [Select]
if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
Im I oly need to add the "Return"?

Sonmez

  • Jr. Member
  • Yo! It's time to play the fair game!
  • Posts: 63
Re: ChangeCol cmd Fix
« Reply #8,  »
Quote from kalee_khan on November 17th, 2020, 01:19 PM
Quote from Sonmez on November 16th, 2020, 02:48 PM
Quote from Inferno on November 16th, 2020, 02:16 PM
Quote from Sonmez on November 16th, 2020, 02:04 PM
You can use this.
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
It will still throw the same console error when cmd is typed as /cmd carID and not whole cmd.
And it wont show ingame syntax for half cmd.

Also you can use :

Code: [Select]
if(!IsNum(ColID1)) return MessagePlayer(" Colour ID must be integer ",player);
Instead of
Code: [Select]
if(!IsNum(ColID1)) {
MessagePlayer(" Write Integer ",player);
return false;
}
This line already solves the problem mentioned:
Code: [Select]
if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
Im I oly need to add the "Return"?
Just try this:
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
if (!perfect) createAgain();

Kalee

  • Newbie
  • Posts: 20
Re: ChangeCol cmd Fix
« Reply #9,  »
Quote from Sonmez on November 18th, 2020, 11:48 AM
Quote from kalee_khan on November 17th, 2020, 01:19 PM
Quote from Sonmez on November 16th, 2020, 02:48 PM
Quote from Inferno on November 16th, 2020, 02:16 PM
Quote from Sonmez on November 16th, 2020, 02:04 PM
You can use this.
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
It will still throw the same console error when cmd is typed as /cmd carID and not whole cmd.
And it wont show ingame syntax for half cmd.

Also you can use :

Code: [Select]
if(!IsNum(ColID1)) return MessagePlayer(" Colour ID must be integer ",player);
Instead of
Code: [Select]
if(!IsNum(ColID1)) {
MessagePlayer(" Write Integer ",player);
return false;
}
This line already solves the problem mentioned:
Code: [Select]
if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
Im I oly need to add the "Return"?
Just try this:
Code: [Select]
if (cmd=="changecol")
{
    if( !text ){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    if (!GetTok( text, " ", 1 )||!GetTok( text, " ", 2 )||!GetTok( text, " ", 3 )||GetTok( text, " ", 4 )){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
     if (!IsNum(GetTok( text, " ", 1 ))||!IsNum(GetTok( text, " ", 2 ))||!IsNum(GetTok( text, " ", 3 ))){MessagePlayer("/changecol <Veh/ID> <Col1/ID> <Col2/ID>",player); return false;}
    local vehicle = FindVehicle(GetTok( text, " ", 1 ).tointeger())
    if (!vehicle){MessagePlayer("[#95fcff]WARN >[#E0E0E0]Wrong Vehicle ID",player); return false;}
    local col1 = GetTok( text, " ", 2 ).tointeger();
    local col2 = GetTok( text, " ", 3 ).tointeger();
    QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+col1+"' WHERE ID='"+vehicle.ID+"'");
    QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+col2+"' WHERE ID='"+vehicle.ID+"'");
    Message("[#990000]#[#E0E0E0]SERVER[#990000]# [#E0E0E0]ADMIN ["+player.Name+"] changed the car color, ID: "+VehicleID+" Color-1: "+ColID1+" Color-2: "+ColID2);
}
An error has Occured the index GetTock Does'nt exist.

Sonmez

  • Jr. Member
  • Yo! It's time to play the fair game!
  • Posts: 63
Re: ChangeCol cmd Fix
« Reply #10,  »
Quote
An error has Occured the index GetTock Does'nt exist.
Add this functions.

Code: [Select]
function GetTok(string, separator, n, ...)
{
    local m = vargv.len() > 0 ? vargv[0] : n,
    tokenized = split(string, separator),
    text = "";
    if (n > tokenized.len() || n < 1) return null;
    for (; n <= m; n++)
    {
        text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
    }
    return text;
}

function NumTok( string, separator )
{
    local tokenized = split(string, separator);
    return tokenized.len();
}
if (!perfect) createAgain();

Altay

  • Newbie
  • Server Owner
  • Posts: 22
Re: ChangeCol cmd Fix
« Reply #11,  »
Quote from Sonmez on November 26th, 2020, 10:06 AM
Quote
An error has Occured the index GetTock Does'nt exist.
Add this functions.

Code: [Select]
function GetTok(string, separator, n, ...)
{
    local m = vargv.len() > 0 ? vargv[0] : n,
    tokenized = split(string, separator),
    text = "";
    if (n > tokenized.len() || n < 1) return null;
    for (; n <= m; n++)
    {
        text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
    }
    return text;
}

function NumTok( string, separator )
{
    local tokenized = split(string, separator);
    return tokenized.len();
}
Yeah, these functions should be included in every script file.
Mustafa Kemal ATATURK, the man who changed the course of history. https://en.wikipedia.org/wiki/Mustafa_Kemal_Atat%C3%BCrk