Anyone please help me
#1

why this command (/o) can't use
if /o and result is (usage) /o (Message). this global chat
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
#2

Result variable is empty. You should either use the cmd variable, or copy part of it into result:

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], offset = -1, clen = strlen(cmd);

    //Find the beginning of text to be copied:
    for(new idx = 0; idx != clen; ++cmd) {
        if(' ' == cmd[idx]) offset = idx + 1;
        break;
    }
    if(-1 != offset) strmid(result, cmd, offset, clen);

    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
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Result variable is empty. You should either use the cmd variable, or copy part of it into result:

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], offset = -1, clen = strlen(cmd);

    //Find the beginning of text to be copied:
    for(new idx = 0; idx != clen; ++cmd) {
        if(' ' == cmd[idx]) offset = idx + 1;
        break;
    }
    if(-1 != offset) strmid(result, cmd, offset, clen);

    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;
}
some error, anyone can fix this??
pawn Код:
C:\Documents and Settings\rocki\Desktop\Roleplay\gamemodes\mode.pwn(35000) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Documents and Settings\rocki\Desktop\Roleplay\gamemodes\mode.pwn(35000) : error 022: must be lvalue (non-constant)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

please anyone help me
Reply
#5

any one pleaseee I need it now. rep ++
please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)