How to Fix this
#1

some error please help me
pawn Код:
C:\Users\User\Desktop\Republic State Roleplay\gamemodes\mode.pwn(34999) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
pawn Код:
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0) // By Kurnia Rocki
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "** You havent logged in yet !");
                return 1;
            }
            if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "ERROR: OOC channel has been disabled by an Admin !");
                return 1;
            }
            if(PlayerInfo[playerid][pMuted] == 1)
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "ERROR: You cannot speak, you have been silenced");
                return 1;
            }
        }
        new result[128];
        new string[128], pname[MAX_PLAYER_NAME];
        if(!strlen(result)) return SendClientMessage(playerid, 0xFFFFFFFF, "(usage) /o (Message)");
        GetPlayerName(playerid,pname,sizeof(pname));
        format(string, sizeof(string), "[GLOBAL] %s(%d) says: %s", pname, playerid, result);
        SendClientMessageToAll(0x33AA33AA, string);
        return 1;
    }
Reply
#2

Rename all the "string" 's in that code to "stringtwo" 's.
Reply
#3

pawn Код:
local variable "string" shadows a variable at a preceding level
That means that your variable "string" has been called before. I'm not sure If that's technically correct, but simply name your "string" to something else. If you're too lazy to do it, it's now called "oocstring":

pawn Код:
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0) // By Kurnia Rocki
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "** You havent logged in yet !");
                return 1;
            }
            if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "ERROR: OOC channel has been disabled by an Admin !");
                return 1;
            }
            if(PlayerInfo[playerid][pMuted] == 1)
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "ERROR: You cannot speak, you have been silenced");
                return 1;
            }
        }
        new result[128];
        new oocstring[128], pname[MAX_PLAYER_NAME];
        if(!strlen(result)) return SendClientMessage(playerid, 0xFFFFFFFF, "(usage) /o (Message)");
        GetPlayerName(playerid,pname,sizeof(pname));
        format(oocstring, sizeof(oocstring), "[GLOBAL] %s(%d) says: %s", pname, playerid, result);
        SendClientMessageToAll(0x33AA33AA, oocstring);
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)