Code:
Try reading the warnings/errors.
[code]C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(243) : warning 217: loose indentationIndent your code, or suppress the warnings (not recommended).
Code:
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(521) : warning 209: function "OnPlayerCommandText" should return a valueReturn a value at the end of the callback, best to return 0.
Code:
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(544) : warning 202: number of arguments does not match definitionCheck over your function, make sure all the parameters are correct & stated.
Code:
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(558) : error 078: function uses both "return" and "return <value>"Your using return more than once.
Code:
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(558) : error 079: inconsistent return types (array & non-array)^^
Code:
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : error 017: undefined symbol "index"Define index.
The problem isn't so much with the way you are using strtok, just some simple mistakes

[u]EDIT:
Meh, since you said please:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
// new cmd[256];
// new idx;
//Commented out because you havnt used them here.
if(strcmp(cmdtext, "/kill", true) == 0)
{
SetPlayerHealth(playerid, 0);
GivePlayerMoney(playerid, -0);
return 1;
}
if(strcmp(cmdtext,"/help", true)==0)
{
SendClientMessage(playerid,COLOR_YELLOW,"/bla || Balance Test ");
SendClientMessage(playerid,COLOR_YELLOW,"/range || Shooting range");
SendClientMessage(playerid,COLOR_YELLOW,"/back || Airstrip");
return true; //You missed a return statement here.
}
if(strcmp(cmdtext,"/bla",true)==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,2149.0371,-1805.6539,16.1464);
SendClientMessage(playerid,COLOR_GREEN,"|==============|");
SendClientMessage(playerid,COLOR_YELLOW,"| Balance Test |");
SendClientMessage(playerid,COLOR_GREEN,"|==============|");
return true; //Again, you missed a return statement. Note: true is the same as 1.
}
//{ //What is this brace for?
if(strcmp(cmdtext,"/range",true)==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 794.8486, 1686.9917, 5.2813); //You has a typo here, a comma instead of a decimal point!
SendClientMessage(playerid,COLOR_GREEN,"|================|");
SendClientMessage(playerid,COLOR_YELLOW,"| Shooting Range |");
SendClientMessage(playerid,COLOR_GREEN,"|================|");
return true; //No return statement again.
}
//{Again with the the braces.
if(strcmp(cmdtext,"/back",true)==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,413.3407,2531.4670,19.1658);
SendClientMessage(playerid,COLOR_GREEN,"|=========|");
SendClientMessage(playerid,COLOR_YELLOW,"| Airbase |");
SendClientMessage(playerid,COLOR_GREEN,"|=========|");
return true; //Missing brace and return statement here.
}
return false;
}
//Why did you define strtok with no value?
/*
Since you are not using strtok atm, commented out.
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result; //result
}
*/That should work, try reading the comments for some tips in future
Disregard the awful indention in code, when you copy and paste it into pawn it should be alright.[/code]