256 cells.
#1

I already readed the ****** topic, I am new at scripting, so I would like a information.
I don't wan't to use 256 cells. so when I try to put at strtok definition - I think you guys call like this -
128 cells, i get errors. example:

Код:
 new cmd[256], tmp[256]; <- At this way it works.
new cmd[128], tmp[128]; <-doesn't works. 2 errors
Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(95) : error 047: array sizes do not match, or destination array is too small
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\ROLE-P~1.PWN(102) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

What are you trying to do?
Reply
#3

Change strtok function to other and 128 will be good
Reply
#4

I am doing a arrest command, it works fine, but i just wanna change the 256 to 128, I don't have strtok function at my GM, i just added to my includes dini. it has strtok.

Anyway, /arrest 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!");
                        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

Open your dini inc and replace in strtok
Код:
new result[256];
to
Код:
new result[128];
and u can write cmd with
Код:
new cmd[128]
etc

and

Код:
if(strcmp(cmd, "/arrest", true) == 0)
{
	if(gTeam[playerid] != TEAM_COPS) return SendClientMessage(playerid, 0xFF0000AA, "-> You are not a Police Officer.");
	tmp = strtok(cmdtext, index);
	if(strlen(tmp)) return SendClientMessage(playerid, 0xFF0000AA, "-> You mean: /arrest [PlayerID]");
	new 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.");
	return 1;
}
Reply
#6

Quote:
Originally Posted by Hot
I am doing a arrest command, it works fine, but i just wanna change the 256 to 128, I don't have strtok function at my GM, i just added to my includes dini. it has strtok.

Anyway, /arrest 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!");
                        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]");
                        }
Huh? How are you saying that you don't use the strtok function, look what I found on your /arrest.
pawn Код:
tmp = strtok(cmdtext, index);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)