Question
#1

Hey all,

I have a question regarding cuffing.
Код:
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(889) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(889) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(890) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(890) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(891) : error 001: expected token: ")", but found "return"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(893) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(897) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(897) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(899) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(1041) : warning 203: symbol is never used: "giveplayername"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(1041) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Errors.
That are the errors I get, and this is the script I use:

Код:
 (THESE ARE AT TOP OF SCRIPT)
29 new tmp[128]; 
30 new idx;
31 new giveplayerid;
32 new giveplayername[MAX_PLAYER_NAME];
33 new sendername[MAX_PLAYER_NAME];


886	new cmd[30];
887	if(strcmp(cmd, "/cuff", true) == 0)
888	{
889  cmd = strtok(cmdtext, idx);
890  tmp = strtok(cmdtext,idx);
891  if(!strlen(tmp) return SendClientMessage(playerid, white, "USAGE: /cuff playerid");
892	giveplayerid = strval(tmp)
893	if(gTeam[playerid] == TEAM_SWAT)
894	{
895	  if(gTeam[giveplayerid] == TEAM_SWAT) return SendClientMessage(playerid,white, "You can not cuff cops or SWAT.");
896	  TogglePlayerControllable(giveplayerid,0);
897	  format(tmp, sizeof(tmp),"You have cuffed %s", GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
898	  SendClientMessage(playerid,blue,tmp);
899	  format(tmp, sizeof(tmp),"You have been cuffed by %s", GetPlayerName(playerid,sendername,sizeof(sendername));
900	  return 1;
901	}
902	return 1;
903	}
And does anyone have a tutorial or something regarding formatting/indexing?

I'm still a noob, so don't go hard on me

Thanks.
Reply
#2

Quote:
Originally Posted by VonLeeuwen
I'm still a noob, so don't go hard on me
noob D=

You shouldn't just copy from other scripts, making your own would be the best.

(can you add error line numbers to the cmd also?)
Reply
#3

As I'm a noob, I thought WRITING it over from someone else, would be best. So I did, I didn't copy - paste anything :P

I'll edit my first post with line numbers.
Reply
#4

define strtok
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(889) : error 017: undefined symbol "strtok"

add this to ur script:

pawn Код:
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;
}
Reply
#5

Now I still have these:

Код:
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(910) : error 001: expected token: ")", but found "return"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(912) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(916) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(916) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(918) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(1060) : warning 203: symbol is never used: "giveplayername"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#6

Quote:
Originally Posted by VonLeeuwen
Now I still have these:

Код:
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(910) : error 001: expected token: ")", but found "return"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(912) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(916) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(916) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(918) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Administrator\Mijn documenten\SAMP Server\gamemodes\SWAT.pwn(1060) : warning 203: symbol is never used: "giveplayername"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
1. Define Symbols (giveplayer) not with New with #define blabla
2. Dleate giveplayername becouse it's not never used. (new giveplayername[MAX_PLAYER_NAME]
3. I don't have time 4 other errors :P
Reply
#7

Post lines 910, 912 and 918.
Reply
#8

It's already fixed, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)