I BEG YOU! HELP MEEEEE :'(
#1

I can't figure it out the "why" can somebody help me?


Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(204) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(207) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(211) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(212) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(215) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(217) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(219) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(226) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(231) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(236) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(241) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(245) : error 010: invalid function or declaration
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(317) : warning 203: symbol is never used: "Jailed"
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(317) : warning 203: symbol is never used: "Wanted"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


12 Errors.
pawn Код:
#define TEAM_COPS 2

new gTeam[MAX_PLAYERS];
new Jailed[MAX_PLAYERS];
new Wanted[MAX_PLAYERS];


if(strcmp(cmd, "/arrest", true) == 0)
    {
      {
        if(gTeam[playerid] != TEAM_COPS) return SendClientMessage(playerid, 0xFF0000AA, "-> You are not a Police Officer.");
        }
   
      new id;
      tmp = strtok(cmdtext, index);
      if (strlen(tmp))
      {
        id = strval(tmp);
        if (IsPlayerConnected(id))
        {
          if (Jailed[id] = 1)
            {
              if (Wanted[id] = 1)
                {
                        SetPlayerPos(id, 1958.3783, 1343.1572, 15.3746);
                        SendClientMessage(id, 0x00FF00AA, "-> You have been jailed for 120 seconds, YOU CRIMINAL!");
                                Jailed[id] = 0;
                                SendClientMessage(playerid, 0x00FF00AA, "-> Player Jailed, Keep the Good work officer!");
                            }
                            else
                            {
                                SendClientMessage(playerid, 0xFF0000AA, "-> The Player isn't Wanted.");
                            }
                           
                            else
                            {
                              SendClientMessage(playerid, 0xFF0000AA, "-> The Player is already jailed.");
                            }
                           
                            else
                            {
                              SendClientMessage(playerid, 0xFF0000AA, "-> Player not found.");
                            }
                           
                            else
                            {
                              SendClientMessage(playerid, 0xFF0000AA, "-> You mean: /arrest [PlayerID]");
                            }
    return 1;
}
Код:
Line 205: if(strcmp(cmd, "/arrest", true) == 0)
Line 208: if(gTeam[playerid] != TEAM_COPS) return SendClientMessage(playerid, 0xFF0000AA, "-> You are not a Police Officer.");
Line 212: 	  tmp = strtok(cmdtext, index);
Line 213: 	  if (strlen(tmp))
Line 216: 	   if (IsPlayerConnected(id))
Line 218:	      if (Jailed[id] = 1)
Line 220:	          if (Wanted[id] = 1)
Line 227:							else
Line 232:							else
Line 237:							else
Line 242:							else
Line 246:	return 1;
Line 318: SCRIPT END AND 317, Jailed and wanted are two of my variables.
Reply
#2

Your command needs to be in the OnPlayerCommandText callback....
Reply
#3

OMG ! It was really out of that callback. But when I put it there i get thousands of errors:
EDIT: PLEASE ! I BEG YOU ! HELP ME! I REALLY NEED IT TO KEEP ME WORK

Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(92) : error 017: undefined symbol "strtok"
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(92) : error 033: array must be indexed (variable "cmd")
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(97) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(101) : error 017: undefined symbol "strtok"
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(101) : error 033: array must be indexed (variable "tmp")
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(107) : warning 211: possibly unintended assignment
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(109) : warning 211: possibly unintended assignment
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(115) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(123) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(129) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(135) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(140) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(142) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(145) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(145) : error 004: function "OnPlayerInfoChange" is not implemented
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(147) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(150) : warning 225: unreachable code
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(150) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(150) : error 004: function "OnPlayerEnterVehicle" is not implemented
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(152) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(155) : warning 225: unreachable code
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(155) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(155) : error 004: function "OnPlayerExitVehicle" is not implemented
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(157) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(160) : warning 225: unreachable code
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(160) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(160) : error 004: function "OnPlayerStateChange" is not implemented
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(162) : error 079: inconsistent return types (array & non-array)
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(165) : warning 225: unreachable code
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(165) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(165) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(167) : error 079: inconsistent return types (array & non-array)

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.


26 Errors.
Reply
#4

That means you didn't close all of your brackets properly. Try this.

pawn Код:
if(strcmp(cmd, "/arrest", true) == 0)
{
    if(gTeam[playerid] != TEAM_COPS)
        return SendClientMessage(playerid, 0xFF0000AA, "-> You are not a Police Officer.");

    new id;
    tmp = strtok(cmdtext, index);
    if(strlen(tmp))
    {
      id = strval(tmp);
      if (IsPlayerConnected(id))
      {
            if (Jailed[id] == 1)
            {
                if (Wanted[id] == 1)
                {
                    SetPlayerPos(id, 1958.3783, 1343.1572, 15.3746);
                    SendClientMessage(id, 0x00FF00AA, "-> You have been jailed for 120 seconds, YOU CRIMINAL!");
                    Jailed[id] = 0;
                    SendClientMessage(playerid, 0x00FF00AA, "-> Player Jailed, Keep the Good work officer!");
                    return 1;
                }
                else return SendClientMessage(playerid, 0xFF0000AA, "-> The Player isn't Wanted.");
            }
            else return SendClientMessage(playerid, 0xFF0000AA, "-> The Player is already jailed.");
        }
        else return SendClientMessage(playerid, 0xFF0000AA, "-> Player not found.");
    }
    else return SendClientMessage(playerid, 0xFF0000AA, "-> You mean: /arrest [PlayerID]");
}
Reply
#5

Look at your arrest code, you open tonnes of brackets but don't close many, this is probably the source of the problem..
Reply
#6

put this before OnGameModeInit or OnFilterScriptInit:
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;
}
then, under OnPlayerCommand text, put:

pawn Код:
new cmd[128];
new tmp[128];
new idx;
cmd=strtok(cmdtext,idx);
and then put the command:

pawn Код:
if(strcmp(cmd, "/arrest", true) == 0)
{
    if(gTeam[playerid] != TEAM_COPS) return SendClientMessage(playerid, 0xFF0000AA, "-> You are not a Police Officer.");
    new id;
    tmp = strtok(cmdtext, index);
    if (strlen(tmp))
    {
        id = strval(tmp);
        if (IsPlayerConnected(id))
        {
            if (Jailed[id] = 1)
            {
                if (Wanted[id] = 1)
                {
                    SetPlayerPos(id, 1958.3783, 1343.1572, 15.3746);
                    SendClientMessage(id, 0x00FF00AA, "-> You have been jailed for 120 seconds, YOU CRIMINAL!");
                    Jailed[id] = 0;
                    SendClientMessage(playerid, 0x00FF00AA, "-> Player Jailed, Keep the Good work officer!");
                }
                else{SendClientMessage(playerid, 0xFF0000AA, "-> The Player isn't Wanted.");}
            }
            else{SendClientMessage(playerid, 0xFF0000AA, "-> The Player is already jailed.");}
        }
        else{SendClientMessage(playerid, 0xFF0000AA, "-> Player not found.");}
    }
    else{SendClientMessage(playerid, 0xFF0000AA, "-> You mean: /arrest [PlayerID]");}
    return 1;
}
Reply
#7

He already has the strtok function. And the command you put will not work anyway. You never closed any of the previous brackets.

pawn Код:
if (Jailed[id] = 1)// ==
{
    if (Wanted[id] = 1)// ==
    {
        SetPlayerPos(id, 1958.3783, 1343.1572, 15.3746);
        SendClientMessage(id, 0x00FF00AA, "-> You have been jailed for 120 seconds, YOU CRIMINAL!");
        Jailed[id] = 0;
        SendClientMessage(playerid, 0x00FF00AA, "-> Player Jailed, Keep the Good work officer!");
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "-> The Player isn't Wanted.");
    }
//You didn't put a closing bracket here
else
{
    SendClientMessage(playerid, 0xFF0000AA, "-> The Player is already jailed.");
}
Reply
#8

Updated it. Sorry if it looks like it hasnt been indented, for some reason it moves them around.
Reply
#9

You still forgot the "==" in the if statements. Although, you're posting the exact same thing I did.
Reply
#10

oh sorry. It's late and somehow I missed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)