[Help] (/N)ewbie Chat !
#1

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 !
Reply
#2

Check "/B" its the same
Reply
#3

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

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...
Reply
#5

***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
Reply
#6

It doesnt work
Reply
#7

pawn Код:
new noque=false;
Reply
#8

nope the error is at:

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

pawn Код:
new noque= 0;
...
Reply
#9

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;
}
Reply
#10

And from where could I get the bigstrtok and strtok?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)