SA-MP Forums Archive
[Help] (/N)ewbie Chat ! - 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: [Help] (/N)ewbie Chat ! (/showthread.php?tid=71564)



[Help] (/N)ewbie Chat ! - tunetu - 02.04.2009

If someone can tell me the pawn code of (/n)ewbie chat please !
I need it for a Godfather Mod
If it can be 30secs betwen messages
Thx !


Re: [Help] (/N)ewbie Chat ! - Castle - 02.04.2009

Check "/B" its the same


Re: [Help] (/N)ewbie Chat ! - tunetu - 02.04.2009

/b is for local OOC chat, I need the /n chat for newbies questions


Re: [Help] (/N)ewbie Chat ! - tunetu - 02.04.2009

Sry for double post, I found a /n chat but when I put it in my gamemode it gives me an error something like this "error 017: undefined symbol "QUEOff" "
Here is the pawno code:

pawn Код:
if(strcmp(cmd, "/n", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
if ((noque) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "  The Questions channel has been disabled by an Admin !");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "  You can't speak, you have been silenced !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/n) [Text]");
return 1;
}
format(string, sizeof(string), "(( Newbie %s: %s ))", sendername, result);
QUEOff(COLOR_RED,string);
printf("%s", string);
}
return 1;
}
if(strcmp(cmd, "/an", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
 if(PlayerInfo[playerid][pAdmin] >= 1) {
    if(gPlayerLogged[playerid] == 0)
    {
      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet !");
      return 1;
    }
if ((noque) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "  The Questions channel has been disabled by an Admin !");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "  You can't speak, you have been silenced !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /an [Text]");
return 1;
}
format(string, sizeof(string), "(( Admin %s: %s ))", sendername, result);
QUEOff(COLOR_RED,string);
printf("%s", string);
}
return 1;
} else
{
SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
}
}
if(strcmp(cmd, "/non", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
if (PlayerInfo[playerid][pAdmin] >= 1 && (!noque))
{
noque = 1;
BroadCast(COLOR_RED, "  Questions chat channel disabled");
}
else if (PlayerInfo[playerid][pAdmin] >= 1 && (noque))
{
noque = 0;
BroadCast(COLOR_YELLOW, "  Questions chat channel enabled");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
}
}
return 1;
  }
If anyone knows how can I rezolve that problem pls post it here...


Re: [Help] (/N)ewbie Chat ! - bpeterson - 02.04.2009

***UNTESTED!***

Here is the complete code:

pawn Код:
#include <a_samp>

#define COLOR_RED 0xE60000FF

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/n", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new name[255];
new idx;
new string[100];
GetPlayerName(playerid,name, sizeof(name));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: (/n) [Text]");
return 1;
}
format(string, sizeof(string), "(( Newbie %s: %s ))", name, result);
SendClientMessageToAll(COLOR_RED,string);
printf("%s", string);
}
}
return 1;
}
bpeterson


Re: [Help] (/N)ewbie Chat ! - tunetu - 02.04.2009

It doesnt work


Re: [Help] (/N)ewbie Chat ! - MenaceX^ - 02.04.2009

pawn Код:
new noque=false;



Re: [Help] (/N)ewbie Chat ! - tunetu - 02.04.2009

nope the error is at:

pawn Код:
QUEOff(COLOR_RED,string);
and what u said MenaceX^ I have:

pawn Код:
new noque= 0;
...



Re: [Help] (/N)ewbie Chat ! - ICECOLDKILLAK8 - 02.04.2009

You will need bigstrtok for this, You will also need strtok
pawn Код:
// Top of OnPlayerCommandText
new idx = 0;
new cmd[128];
cmd = strtok(cmdtext, idx);
// Anywhere in OnPlayerCommandText
if(strcmp(cmd, "/n", true) == 0)
{
  if(Level[playerid] =< 2)// Only allow noob players to use it, Replace level with the variable you use for Level if any
  {
    new string[128];
    new result[128];
    new PlayerName[MAX_PLAYER_NAME];
    result = bigstrtok(cmdtext, idx);
    if(!strlen(result))
    {
      SendClientMessage(playerid, color, "Server: /n [message]"); // Replace color with a color of your choice
      return 1;
    }
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    for(new i; i < MAX_PLAYERS; i++)
    {
      if(Level[i] =< 2)// Only allow noob players to recieve it, Replace level with the variable you use for Level if any
      {
        format(string, sizeof(string), "[Newbie %s]: %s", PlayerName, result);
        SendClientMessage(i, color, string); // Replace color with a color of your choice
        return 1;
      }
    }
  }
  return 1;
}



Re: [Help] (/N)ewbie Chat ! - tunetu - 02.04.2009

And from where could I get the bigstrtok and strtok?