SA-MP Forums Archive
[Help] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] (/showthread.php?tid=99800)



[Help] - MB@ - 30.09.2009

Код:
#include <a_samp>

new cmd[128];
new tmp[128];
new idx;
new giveplayername[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new string[128];
== > line 9 cmd = strtok(cmd,idx); 

#define POLICE 1
#define ARMY 2
#define FBI 3

forward IsPlayerInPolice(playerid);
forward IsPlayerInArmy(playerid);
forward IsPlayerInFbi(playerid);
Код:
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(9) : error 010: invalid function or declaration



Re: [Help] - MB@ - 30.09.2009

Yes but if i put it in onplayercommand text like this

Код:
#include <a_samp>



#define POLICE 1
#define ARMY 2
#define FBI 3



forward IsPlayerInPolice(playerid);
forward IsPlayerInArmy(playerid);
forward IsPlayerInFbi(playerid);

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new tmp[128];
new idx;
new giveplayername[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new string[128];
cmd = strtok(cmd,idx);
{
if(strcmp("/command", cmdtext, true, 7) == 0)
{
return 1;
}
return 0;
}
I get these erors

Код:
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(23) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(23) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(33) : error 030: compound statement not closed at the end of file (started at line 17)



Re: [Help] - Correlli - 30.09.2009

You have one { bracket which you don't need, try this:

pawn Код:
#include <a_samp>

#define POLICE 1
#define ARMY 2
#define FBI 3

forward IsPlayerInPolice(playerid);
forward IsPlayerInArmy(playerid);
forward IsPlayerInFbi(playerid);

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new tmp[128];
new idx;
new giveplayername[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new string[128];
cmd = strtok(cmd,idx);
if(strcmp("/command", cmdtext, true, 8) == 0)
{
return 1;
}
return 0;
}
And make sure you have the "strtok" function (i don't see it in the code you gave).


Re: [Help] - MB@ - 30.09.2009

I still get 2 erors and a few warnings


Код:
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(19) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(19) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(18) : warning 204: symbol is assigned a value that is never used: "string"
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(17) : warning 204: symbol is assigned a value that is never used: "sendername"
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(16) : warning 204: symbol is assigned a value that is never used: "giveplayername"
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(15) : warning 203: symbol is never used: "idx"
C:\Documents and Settings\Administrator\Desktop\Jub commands.pwn(14) : warning 204: symbol is assigned a value that is never used: "tmp"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: [Help] - Correlli - 30.09.2009

Quote:
Originally Posted by Don Correlli
And make sure you have the "strtok" function (i don't see it in the code you gave).



Re: [Help] - MB@ - 30.09.2009

oh didnt see that sry thx