/n chat command
#1

Hello

I want to know how to make a /n command

I'll explain what it will be used for:

It will be for players who want to know something about the server and if the script was posted that would be greatful

Regards,
Seanny
Reply
#2

OnPlayerCommandText:
pawn Код:
if(!strcmp(cmdtext, "/help", true))
{
   SendClientMessage(playerid, /*Color*/, "Script by: Your name!");
   SendClientMessage(playerid, /*Color*/, "for more information? Msn: XxX@hotmail.com");
   return 0x1;
}
or you can use:
pawn Код:
fcmd(ajuda, playerid)
{
   SendClientMessage(playerid, /*Color*/, "Script by: Your name!");
   SendClientMessage(playerid, /*Color*/, "for more information? Msn: XxX@hotmail.com");
   return true; //Or return 0x1; or return 1;
}
Reply
#3

No I want to make a /n chat command for people to ask stuff about the server

Код:
/n How do I become a taxi man?

Newbie Firstname_Lastname: How do I become a taxi man?
like that type of thing
Reply
#4

pawn Код:
CMD:n(playerid, params[])
{
    if (isnull(params)) return
        SendClientMessage(playerid, 0xFF3300FF, " Usage: /n <your question>");
       
    new szString[128], szName[28];
    GetPlayerName(playerid, szName, 28);
    format(szString, 128, "{33CCFF}Newbie %s(%d): %s", szName, playerid, params);
    SendClientMessageToAll(-1, szString);
    return 1;
}
Like that?
Reply
#5

Quote:
Originally Posted by admantis
Посмотреть сообщение
pawn Код:
CMD:n(playerid, params[])
{
    if (isnull(params)) return
        SendClientMessage(playerid, 0xFF3300FF, " Usage: /n <your question>");
       
    new szString[128], szName[28];
    GetPlayerName(playerid, szName, 28);
    format(szString, 128, "{33CCFF}Newbie %s(%d): %s", szName, playerid, params);
    SendClientMessageToAll(-1, szString);
    return 1;
}
Like that?
Yes Like that but with a timer to stop spam
Reply
#6

It's easy!

pawn Код:
new iNewbieTick[MAX_PLAYERS]; // Outside of functions/callbacks, top of script for example
CMD:n(playerid, params[])
{
    if (isnull(params)) return
        SendClientMessage(playerid, 0xFF3300FF, " Usage: /n <your question>");
     if((GetTickCount() - iNewbieTick[playerid]) < 60000) return SendClientMessage(playerid, -1, "{33CCFF}You have to wait 60 seconds before using that again!");
    new szString[128], szName[28];
    GetPlayerName(playerid, szName, 28);
    format(szString, 128, "{33CCFF}Newbie %s(%d): %s", szName, playerid, params);
    SendClientMessageToAll(-1, szString);
    iNewbieTick[playerid] = GetTickCount();
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)