[Help] Gang chat
#1

Okay so I've made a gang chat but I get these errors even though I have defined the symbol:

pawn Код:
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\LSR.pwn(30070) : warning 204: symbol is assigned a value that is never used: "id"
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\LSR.pwn(30070 -- 30072) : error 017: undefined symbol "id"
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\LSR.pwn(30078) : error 017: undefined symbol "id"
pawn Код:
if(strcmp(cmd, "/gang", true) == 0 || strcmp(cmd, "/g", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            if(gChat[playerid] >= 999)
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/g)ang [gang chat]");
                    return 1;
                }
                format(string, sizeof(string), "%s: %s ", sendername, result);
                GangChat(COLOR_GCHAT,string);
                printf("%s", string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  you arn't in a gang!");
                return 1;
            }
        }//not connected
        return 1;
    }
    if (strcmp("/joingang", cmd, true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /joingang [gangid 0-9999]");
            new id;
            id = strval(tmp);
        }
        if(id >= 9999 || id <= 0)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "gangid must be 0-9999");
        }
        else
        {
            gChat[playerid] = id;
        }
        return 1;
    }
Reply
#2

You declared it out of scope of the other uses.

pawn Код:
if (strcmp("/joingang", cmd, true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /joingang [gangid 0-9999]");
        new id;
        id = strval(tmp);
        if(id >= 9999 || id <= 0)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "gangid must be 0-9999");
        }
        else
        {
            gChat[playerid] = id;
        }
        return 1;
    }
I have also removed the IsPlayerConnected check, as obviously it is useless to check if the playerid (who typed the command) is online.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)