SA-MP Forums Archive
/n chat command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /n chat command (/showthread.php?tid=248590)



/n chat command - seanny - 14.04.2011

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


Re: /n chat command - Diogo_Bras - 14.04.2011

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;
}



Re: /n chat command - seanny - 14.04.2011

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


Re: /n chat command - admantis - 14.04.2011

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?


Re: /n chat command - seanny - 14.04.2011

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


Re: /n chat command - admantis - 14.04.2011

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;
}