SA-MP Forums Archive
Errors. - 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: Errors. (/showthread.php?tid=77965)



Errors. - Hot - 16.05.2009

Код:
C:\Documents and Settings\Convidado\Desktop\samp02Xserver.win32\gamemodes\DMGM.pwn(230) : error 021: symbol already defined: "strtok"
C:\Documents and Settings\Convidado\Desktop\samp02Xserver.win32\gamemodes\DMGM.pwn(244) : 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
pawn Код:
new logged[MAX_PLAYERS];
new playername[MAX_PLAYER_NAME];

public OnPlayerConnect(playerid)
{
    logged[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  logged[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
  if(logged[playerid] == 0)
  {
    SendClientMessage(playerid, COLOR_RED, "You are not logged in! Use /login [password]!");
  }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256],tmp[256], tmp2[256];
  new idx;
  new string[256];
  cmd = strtok(cmdtext, idx);
  GetPlayerName(playerid, playername, sizeof(playername));

  if(strcmp(cmd, "/register", true) == 0)
  {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "[SERVER] USAGE: /register (password)");
    }
    else
    {
      if (!dini_Exists(udb_encode(playername)))
      {
        dini_Create(udb_encode(playername));
        dini_IntSet(udb_encode(playername), "password", udb_hash(tmp));
        dini_IntSet(udb_encode(playername), "adminlevel", 0);
        dini_IntSet(udb_encode(playername), "money", 0);
        format(string, sizeof(string), "[SERVER] Account %s created! You can now login with /login %s", playername, tmp);
        SendClientMessage(playerid, COLOR_YELLOW, string);
      }
      else
      {
        format(string, sizeof(string), "[SERVER] %s is already registered.", playername,tmp);
        SendClientMessage(playerid, COLOR_RED, string);
      }
    }
    return 1;
  }


  if(strcmp(cmd, "/login", true) == 0)
  {
    if(logged[playerid] == 1)
    {
      SendClientMessage(playerid, COLOR_RED, "[SERVER] You are already logged in!");
      return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "[SERVER] USAGE: /login [password]");
    }
    else
    {
      if (dini_Exists(udb_encode(playername)))
      {
        tmp2 = dini_Get(udb_encode(playername), "password");
        if (udb_hash(tmp) != strval(tmp2))
        {
          SendClientMessage(playerid, COLOR_RED, "[SERVER] Wrong/Invalid Password!");
        }
      }
      else
      {
        format(string, sizeof(string), "[SERVER] You are not registerid Type /Register [Password] to create an account!", playername);
        SendClientMessage(playerid, COLOR_RED, string);
      }
    }
    return 1;
  }
    return 0;
}



Re: Errors. - miokie - 16.05.2009

First error:
You have two 'Strok's In your script or an include has it in aswell, Remove one.
Second Error:
What's line 244?


Re: Errors. - Weirdosport - 16.05.2009

Perhaps putting the strtok stock in your script would help? Look on the wiki for it..


Re: Errors. - miokie - 16.05.2009

Quote:
Originally Posted by Weirdosport
Perhaps putting the strtok stock in your script would help? Look on the wiki for it..
Strok is already defined, If you read the errors you would have seen that. so there must be two located in his script/include files.