07-07-2008, 12:45 AM
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
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");
}
{
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,"|==============|");
}
{
if(strcmp(cmdtext,"/range",true)==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,794.8486, 1686.9917, 5.2813,273);
SendClientMessage(playerid,COLOR_GREEN,"|================|");
SendClientMessage(playerid,COLOR_YELLOW,"| Shooting Range |");
SendClientMessage(playerid,COLOR_GREEN,"|================|");
}
{
if(strcmp(cmdtext,"/back",true)==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,413.3407,2531.4670,19.165;
SendClientMessage(playerid,COLOR_GREEN,"|=========|");
SendClientMessage(playerid,COLOR_YELLOW,"| Airbase |");
SendClientMessage(playerid,COLOR_GREEN,"|=========|");
return 1;
}
#define strtok
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
}
Errors
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(243) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(294) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(34 : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(521) : warning 209: function "OnPlayerCommandText" should return a value
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(524) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(531) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(540) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(544) : warning 202: number of arguments does not match definition
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(549) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(55 : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(55 : error 078: function uses both "return" and "return <value>"
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(55 : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : error 029: invalid expression, assumed zero
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : error 017: undefined symbol "index"
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : error 029: invalid expression, assumed zero
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
So basicly I need help with strtok, because thats the big problem here.
EDIT:please Jay?
{
new cmd[256];
new idx;
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");
}
{
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,"|==============|");
}
{
if(strcmp(cmdtext,"/range",true)==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,794.8486, 1686.9917, 5.2813,273);
SendClientMessage(playerid,COLOR_GREEN,"|================|");
SendClientMessage(playerid,COLOR_YELLOW,"| Shooting Range |");
SendClientMessage(playerid,COLOR_GREEN,"|================|");
}
{
if(strcmp(cmdtext,"/back",true)==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,413.3407,2531.4670,19.165;
SendClientMessage(playerid,COLOR_GREEN,"|=========|");
SendClientMessage(playerid,COLOR_YELLOW,"| Airbase |");
SendClientMessage(playerid,COLOR_GREEN,"|=========|");
return 1;
}
#define strtok
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
}
Errors
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(243) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(294) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(34 : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(521) : warning 209: function "OnPlayerCommandText" should return a value
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(524) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(531) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(540) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(544) : warning 202: number of arguments does not match definition
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(549) : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(55 : warning 217: loose indentation
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(55 : error 078: function uses both "return" and "return <value>"
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(55 : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : error 029: invalid expression, assumed zero
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : error 017: undefined symbol "index"
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : error 029: invalid expression, assumed zero
C:\Documents and Settings\ÄGARE\Skrivbord\bodyguards.pwn(564) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
So basicly I need help with strtok, because thats the big problem here.
EDIT:please Jay?