Someone can make me a newbie chat channel with /nonewbie for admin to toggle it?
#2

Will make you a little FS and edit after I finish.

Edit :
on the top of your script :
pawn Код:
new NewBie;
under OnGameModeInIt
pawn Код:
NewBie = 1;
under OnPlayerCommandText
pawn Код:
if(strcmp(cmd,"/new",true) == 0)
    {
        if(NewBie == 0) return SendClientMessage(playerid,0x00ccccff,"The newbie chat is disabled !");
        if(NewBie == 1)
        {
            new string[256];
            string = strrest(cmdtext, idx);
            if(!strlen(string)) return SendClientMessage(playerid,0xcc0000ff,"Usage : /new [TEXT] !");
            SendClientMessageToAll(0x00ccccff,string);
        }
        return 1;
    }
   
    if(strcmp(cmd,"/nonewbie",true) == 0)
    {
        if(PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,0xcc0000ff,"You are not an admin !");
        if(PlayerInfo[playerid][pAdminLevel] > 0)
        {
            switch(NewBie)
            {
                case 0:
                {
                    NewBie = 1;
                    SendClientMessage(playerid,0x999999ff,"The newbie chat is not ON. !");
                }
                case 1:
                {
                    NewBie = 0;
                    SendClientMessage(playerid,0x999999ff,"The newbie chat is not OFF. !");
                }
            }
        }
        return 1;
    }
and at the very end of your script
pawn Код:
stock strrest(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
    new offset = index;
    new result[128];
    while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

Last thing
if you dont have new cmd[256], idx; under onplayercommand text the add it .....

if you want me to explain you the code just tell me.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)