256 ~ 128
#1

Hi, reading topics, I realize how 256 cells suck

I tryed to change a variable from a FS to 256. But I got this:

Код:
C:\Documents and Settings\Convidado\Desktop\samp02Xserver.win32\gamemodes\GM.pwn(125) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
It's defined as 128, and I get this error. If I change it to 256 it compiles, but I don't want to have 256 cells!

How to fix it?

Line 125:
Код:
tmp = dini_Get(file, "hashPW");
Reply
#2

use this strtok
https://sampwiki.blast.hk/wiki/Strtok
Reply
#3

I want to made with dcmd. Is there a way without changin to strtok?

my code.

Код:
dcmd_register(playerid, params[])
{
  new file[128], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "\\Users\\%s.ini", pname);
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "* Try '/register' [Password]");
  if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "* You are already registered!");
  dini_Create(file);
  dini_IntSet(file, "hashPW", udb_hash(params));
  dini_Set(file, "password", params);
  dini_IntSet(file, "score", GetPlayerScore(playerid));
  dini_IntSet(file, "money", GetPlayerMoney(playerid));
  new string[128];
  format(string, 128, "* Welcome to Blueberry Role-Play! Nickname %s with password %s", pname, params);
  SendClientMessage(playerid, COLOR_YELLOW, string);
  Logged[playerid] = 1;
  SendClientMessage(playerid, COLOR_YELLOW, "* You have been automatically logged in!");
  return 1;
}

dcmd_login(playerid, params[])
{
  new file[128];
  new string[128], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "\\Users\\%s.ini", pname);
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "* Try '/login' [Password]");
  if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "* You are not registered!");
  if(Logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "* You are already logged in!");
  new tmp[128];
  tmp = dini_Get(file, "hashPW");
  if(udb_hash(params) != strval(tmp))
  {
    format(string, 256, "You specified the wrong password for %s!", pname);
    SendClientMessage(playerid, COLOR_RED, string);
  }
  else
  {
    Logged[playerid] = 1;
		SetPlayerScore(playerid, dini_Int(file, "score"));
		GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
    SendClientMessage(playerid, COLOR_YELLOW, "* You have succesfully logged in!");
  }
  return 1;
}
Reply
#4

open include with your strtok and change
Код:
new result[256]; to 128
Reply
#5

Try putting

#define MAX_STRING 128

at the top. Dini uses this to set its max string size.
Reply
#6

Jeff, I'M NOT USING STRTOK

Werdiosport:

Код:
C:\Documents and Settings\Convidado\Desktop\samp02Xserver.win32\gamemodes\bRP.pwn(6) : warning 201: redefinition of constant/macro (symbol "MAX_STRING")
:/
Reply
#7

Quote:
Originally Posted by Koppa,
Jeff, I'M NOT USING STRTOK

Werdiosport:

Код:
C:\Documents and Settings\Convidado\Desktop\samp02Xserver.win32\gamemodes\bRP.pwn(6) : warning 201: redefinition of constant/macro (symbol "MAX_STRING")
:/
its in the a_samp.inc include
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)