[NEWB] Getting some wrongs with cmd:/newb
#1

I think everything is fine but there too many warnings:

Warning 202:
pawn Код:
(3558) : warning 202: number of arguments does not match definition
Line:
pawn Код:
format(string, sizeof(string), "** Newbie %s: %s", GetPlayerName(playerid), params);

pawn Код:
CMD:newb(playerid, params[])
{
    if(gPlayerLogged{playerid} == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "You're not logged in.");
        return 1;
    }
    if(PlayerInfo[playerid][pTut] == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "You can't do that at this time.");
        return 1;
    }
    if ((nonewbie) && PlayerInfo[playerid][pAdmin] < 2)
    {
        SendClientMessage(playerid, COLOR_GRAD2, "The newbie chat channel has been disabled by an administrator!");
        return 1;
    }
    if(PlayerInfo[playerid][Pmuted] == 1)
    {
        SendClientMessage(playerid, COLOR_GREY, "You are muted from the newbie chat channel.");
        return 1;
    }
    new string[128];
    if(NewbieTimer[playerid] > 0)
    {
        format(string, sizeof(string), "You must wait %d seconds before speaking again in this channel.", NewbieTimer[playerid]);
        SendClientMessage(playerid, COLOR_GREY, string);
        return 1;
    }
    if(gNewbie[playerid]==1)
    {
        SendClientMessage(playerid, COLOR_GREY, "You have the channel toggled, /tognewbie to re-enable!");
        return 1;
    }

    if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/newb)ie [text]");

    if(PlayerInfo[playerid][pManga]<1&&PlayerInfo[playerid][pAdmin] < 2)
    {
        NewbieTimer[playerid] = 50;
    }
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        format(string, sizeof(string), "** Admin %s: %s", GetPlayerName(playerid), params);
    }
    foreach(Player, n)
    {
        if (gNewbie[n]==0)
        {
            SendClientMessage(n, COLOR_WHITENEWB, string);
        }
    }
    return 1;
}
Reply
#2

This is your problem:
GetPlayerName(playerid)

I suggest adding this:
stock PlayerAccName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
then changing the "GetPlayerName" Part in your specified code to PlayerAccName(playerid)
Reply
#3

From my gm.. It should work good!


format(string, sizeof(string), "** Newbie %s: %s", GetPlayerNameEx(playerid), params);
Reply
#4

Quote:
Originally Posted by bensmart469
Посмотреть сообщение
This is your problem:
GetPlayerName(playerid)

I suggest adding this:
stock PlayerAccName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
then changing the "GetPlayerName" Part in your specified code to PlayerAccName(playerid)
Thanks it fix the warnings, btw i got one error with <zcmd> with the same cmd which i post up, the error is next:

Line:
pawn Код:
CMD:newb(playerid, params[])
Error:
pawn Код:
error 017: undefined symbol "params"
<EDIT: FIXED>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)