/makeadmin
#1

SOLVED
Reply
#2

pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
  {
    if(adminlevel[playerid] == 7)
     {
      if(logged[playerid] == 1)
      {
      new tmp[256], tmp2[256], idx;   tmp = strtok(cmdtext,idx), tmp2 = strtok(cmdtext,idx);
      tmp = strtok(cmdtext, idx);
      new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
      player1 = strval(tmp);
      level = strval(tmp2);
     if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /makeadmin [playerid] [level]");
    }
    else
    {
       if(adminlevel[playerid] == 7)
      {
       if(logged[playerid] == 1)
       {
      GetPlayerName(player1, playername, sizeof(playername));  GetPlayerName(playerid, adminname, sizeof(adminname));
      format(string,sizeof(string),"You have promoted %s to adminlevel %d ", playername, level);
       SendClientMessage(playerid, COLOR_GREEN, string);
      format(string,sizeof(string),"Administrator %s has promoted %s to adminlevel %d",adminname, playername, level);
      SendClientMessageToAll(playerid, COLOR_GREEN, string);
      adminlevel[playerid] = level;
      return 1;
      }
You forgot some braces.
pawn Код:
}
}
}
}
 return 1;
      }
Reply
#3

EDIT: I have now only one error:
Quote:

C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(100) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(115) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(116) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(137) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(140) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(145) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(145) : warning 219: local variable "tmp2" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(145) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 219: local variable "playername" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 219: local variable "adminname" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(150) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(154) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(162) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(163) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(16 : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(173) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(186) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(210) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(212) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(21 : error 030: compound statement not closed at the end of file (started at line 73)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Command:
Quote:

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));
tmp = strtok(cmdtext, idx);
if(strcmp(cmd, "/register", true) == 0)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "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);
dini_IntSet(udb_encode(playername), "score", 0);
format(string, sizeof(string), "Account %s has been made! You can now login with the password: %s.", playername, tmp);
SendClientMessage(playerid, COLOR_GREEN, string);
}else{
format(string, sizeof(string), "%s is already registered.", playername,tmp);
SendClientMessage(playerid, COLOR_RED, string);
}
return 1;
}
return 0;
}

Reply
#4

Quote:
Originally Posted by Second
EDIT: I have now only one error:
Quote:

C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(100) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(115) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(116) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(137) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(140) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(145) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(145) : warning 219: local variable "tmp2" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(145) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 219: local variable "playername" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 219: local variable "adminname" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(147) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(150) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(154) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(162) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(163) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(16 : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(173) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(186) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(210) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(212) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(21 : error 030: compound statement not closed at the end of file (started at line 73)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Command:
Quote:

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));
tmp = strtok(cmdtext, idx);
if(strcmp(cmd, "/register", true) == 0)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "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);
dini_IntSet(udb_encode(playername), "score", 0);
format(string, sizeof(string), "Account %s has been made! You can now login with the password: %s.", playername, tmp);
SendClientMessage(playerid, COLOR_GREEN, string);
}else{
format(string, sizeof(string), "%s is already registered.", playername,tmp);
SendClientMessage(playerid, COLOR_RED, string);
}
return 1;
}
return 0;
}

HELP PLEASE!
Reply
#5

Use PAWN tags to display your code next time. ([ pawn ] Your Code Here [ /pawn ])

And you have a bracket missing before return 0;
Reply
#6

Quote:
Originally Posted by MadeMan
Use PAWN tags to display your code next time. ([ pawn ] Your Code Here [ /pawn ])

And you have a bracket missing before return 0;
i dont know what you mean, can you maybe edit it for me ?
Reply
#7

pawn Код:
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));
  tmp = strtok(cmdtext, idx);
  if(strcmp(cmd, "/register", true) == 0)
  {
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "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);
        dini_IntSet(udb_encode(playername), "score", 0);
        format(string, sizeof(string), "Account %s has been made! You can now login with the password: %s.", playername, tmp);
        SendClientMessage(playerid, COLOR_GREEN, string);
      }else{
        format(string, sizeof(string), "%s is already registered.", playername,tmp);
        SendClientMessage(playerid, COLOR_RED, string);
      }
    }
    return 1;
  }
  return 0;
}
Reply
#8

Quote:
Originally Posted by MadeMan
pawn Код:
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));
  tmp = strtok(cmdtext, idx);
  if(strcmp(cmd, "/register", true) == 0)
 {
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "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);
        dini_IntSet(udb_encode(playername), "score", 0);
        format(string, sizeof(string), "Account %s has been made! You can now login with the password: %s.", playername, tmp);
        SendClientMessage(playerid, COLOR_GREEN, string);
      }else{
        format(string, sizeof(string), "%s is already registered.", playername,tmp);
        SendClientMessage(playerid, COLOR_RED, string);
      }
    }
    return 1;
  }
  return 0;
}
I got these errors now:
Quote:

C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(2 : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(132) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(172) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(280) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(29 : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(337) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(379) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(443) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dutils.inc(462) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dini.inc(46) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\pawno\inclu de\dudb.inc(4 : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(73) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(73) : warning 219: local variable "tmp2" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(74) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(75) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(73) : warning 204: symbol is assigned a value that is never used: "tmp2"
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(73 -- 109) : error 010: invalid function or declaration
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(73 -- 111) : error 010: invalid function or declaration
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(73 -- 114) : error 010: invalid function or declaration
C:\Documents and Settings\Eigenaar\Bureaublad\Minigames\filterscrip ts\Minigame.pwn(73 -- 114) : fatal error 107: too many error messages on one line

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


4 Errors.

Reply
#9

Paste line 73.
Reply
#10

Quote:
Originally Posted by ikarus❶❸❸❼
Paste line 73.
new cmd[256],tmp[256], tmp2[256];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)