![]() |
|
okay this is simple, but I'm freaking out on this one.. - Printable Version +- Las Venturas Playground (https://forum.sa-mp.nl) +-- Forum: Miscellaneous (https://forum.sa-mp.nl/forum-4.html) +--- Forum: Gaming (https://forum.sa-mp.nl/forum-27.html) +--- Thread: okay this is simple, but I'm freaking out on this one.. (/thread-10098.html) |
okay this is simple, but I'm freaking out on this one.. - Dust - 07-07-2008 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 indentationC:\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 indentationC:\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?
Re: okay this is simple, but I'm freaking out on this one.. - FarePak - 07-07-2008 Next time use bin.sa-mp.nl as i cannot see any of that properly.. Right now i can only notice that you haven't returned 0 after at the end of the commands. edit: I also noticed you haven't returned or closed some of the commands.... Re: okay this is simple, but I'm freaking out on this one.. - Jay - 07-07-2008 Code: Try reading the warnings/errors.Indent 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[])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]
Re: okay this is simple, but I'm freaking out on this one.. - Dust - 07-07-2008 I don't know what to say! yay Jay! ![]() no, but seriously, thanks! I though I would go nuts about those errors .. it's easy to get blind while using pawno i guess. ![]() Thanks!
|