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

Title says it all without a please :P
So please do it someone, i'll be thankful.

Other info :
To check if player is admin - [pAdminLevel]
To check if player is tester - [pTester]
Or whatever it is IDK
Reply
#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
#3

Код:
G:\EL-RP\gamemodes\el-rp.pwn(10709) : warning 219: local variable "string" shadows a variable at a preceding level
Reply
#4

Quote:
Originally Posted by anantanni
Посмотреть сообщение
Код:
G:\EL-RP\gamemodes\el-rp.pwn(10709) : warning 219: local variable "string" shadows a variable at a preceding level
Change:
pawn Код:
new string[256];
To:
pawn Код:
new mystring[256];
Reply
#5

1 last thing
How to format it?
I mean when you type
Код:
"/n lol"
it appears
Код:
"lol"
how to make it
Код:
**Newbie chat : (PlayerName) : lol**
?
Reply
#6

Anyone?

EDIT : W00t! Just became a big clucker with this post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)