/me and /irc :O
#1

it compiles with 2 errors which are causing me to get unkown cmd in-game

Код:
W:\Users\Mom & Dad\Documents\samp03dsvr_R2_win32\gamemodes\lvcnr.pwn(349) : warning 225: unreachable code
W:\Users\Mom & Dad\Documents\samp03dsvr_R2_win32\gamemodes\lvcnr.pwn(352) : warning 219: local variable "str" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
and my code:

pawn Код:
if (strcmp("/me", cmdtext, true, 3))
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
        SendClientMessageToAll(COLOR_WHITE, str);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
        IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, str);
        return 1;
    }
    if (strcmp("/irc", cmdtext, true, 3) == 0)
    {
        if (!cmdtext[3])return SendClientMessage(playerid, COLOR_RED, "USAGE: /irc (message)");
        new ircmsg[128];
        format(ircmsg, sizeof(ircmsg), "02To IRC: %s(%d) said:%s", ircmsg,GetName(playerid), playerid, cmdtext[4]);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, ircmsg);
        IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, ircmsg);
        SendClientMessage(playerid, COLOR_YELLOW, "Message Sent To Irc");
        return 1;
    }
Reply
#2

You forgot "== 0" after your strcmp
Reply
#3

i still get the same error's :/
Reply
#4

pawn Код:
format(str, sizeof(str), "* %s %s", cmdtext[4]);
Reply
#5

pawn Код:
warning 219: local variable "str" shadows a variable at a preceding level
means that "str" is already a global define. So u dont really to define it again
pawn Код:
if (strcmp("/me", cmdtext, true, 3) == 0)
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
        SendClientMessageToAll(COLOR_WHITE, str);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
        IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, str);
        return 1;
    }
Reply
#6

Which lines are which?!
Reply
#7

im still getting 1 error

Quote:

W:\Users\Mom & Dad\Documents\samp03dsvr_R2_win32\gamemodes\lvcnr. pwn(509) : warning 225: unreachable code

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)