/makeadmin
#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


Messages In This Thread
/makeadmin - by geerdinho8 - 28.04.2010, 18:10
Re: /makeadmin - by [MWR]Blood - 28.04.2010, 18:19
Re: /makeadmin - by geerdinho8 - 28.04.2010, 18:22
Re: /makeadmin - by geerdinho8 - 28.04.2010, 18:37
Re: /makeadmin - by MadeMan - 28.04.2010, 18:41
Re: /makeadmin - by geerdinho8 - 28.04.2010, 18:46
Re: /makeadmin - by MadeMan - 28.04.2010, 18:48
Re: /makeadmin - by geerdinho8 - 28.04.2010, 18:50
Re: /makeadmin - by [MWR]Blood - 28.04.2010, 18:52
Re: /makeadmin - by geerdinho8 - 28.04.2010, 18:53

Forum Jump:


Users browsing this thread: 3 Guest(s)