problem with string [Help Please]
#5

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new tmp[256];
    new giveplayer[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new idx;



    if (strcmp(cmd, "/login", true) ==0 )
    {
      if(IsPlayerConnected(playerid))
      {
        new tmppass[64];
            if(gPlayerLogged[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "You are already logged in.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /login [password]");
                return 1;
            }
            strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
            Encrypt(tmppass);
            OnPlayerLogin(playerid,tmppass);
        }
        return 1;
    }
    if (strcmp(cmd, "/register", true) ==0 )
    {
      if(IsPlayerConnected(playerid))
      {
        if(gPlayerLogged[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "You are already logged in.");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "%s.ini", sendername);
            new File: hFile = fopen(string, io_read);
            if (hFile)
            {
                SendClientMessage(playerid, COLOR_RED, "That name is alredy registered. Please change your name.");
                fclose(hFile);
                return 1;
            }
        new tmppass[64];
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /register [password]");
                return 1;
            }
            strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
            Encrypt(tmppass);
            OnPlayerRegister(playerid,tmppass);
        }
        return 1;
    }

//------------[ Make Admin cmnd ]--------------

    if(strcmp(cmd, "/makeadmin", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1338)
            {
              if(IsPlayerConnected(para1))
              {
                if(para1 != INVALID_PLAYER_ID)
                {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pAdmin] = level;
                        printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
                        format(string, sizeof(string), "  You have been promoted to a level %d admin by %s", level, sendername);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "  You have promoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        SetPlayerColor(giveplayerid,TEAM_HIT_COLOR);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
            }
        }
        return 1;
    }
    return 0;
}
I also searched for "new string" and I found string already defined as
pawn Code:
new string[64];
any idea how to fix it ? any help will be much appreciated, thanks

EDIT: the defined strings i found look pretty strange, like there's one onplayerlogin callback and it's new string2[64]; then it's new string3 onplayerregister etc...
what should I do ?
Reply


Messages In This Thread
problem with string [Help Please] - by *BueNoOo* - 29.11.2009, 01:35
Re: problem with string [Help Please] - by GTA_Rules - 29.11.2009, 05:30
Re: problem with string [Help Please] - by MJ! - 29.11.2009, 06:26
Re: problem with string [Help Please] - by Kinetic - 29.11.2009, 06:55
Re: problem with string [Help Please] - by *BueNoOo* - 29.11.2009, 12:42
Re: problem with string [Help Please] - by *BueNoOo* - 29.11.2009, 13:49
Re: problem with string [Help Please] - by Kurence - 29.11.2009, 14:50
Re: problem with string [Help Please] - by *BueNoOo* - 29.11.2009, 16:17
Re: problem with string [Help Please] - by *BueNoOo* - 29.11.2009, 16:34
Re: problem with string [Help Please] - by Kurence - 29.11.2009, 16:42

Forum Jump:


Users browsing this thread: 6 Guest(s)