if i do "@" for admin chat gamemode restarts
#1

if(text[0] == '@')
{
new string[256], pName[24];
if(PlayerInfo[playerid][AdminLevel] < 1)
{
GetPlayerName(playerid,pName,sizeof(pName));
format(string, sizeof(string), "Admin Chat: %s: %s", pName, text[1]);
SendModMsg(COLOR_YELLOW, string);
}
return 0;
}
return 1;
}
Reply
#2

Try this:
pawn Код:
if(text[0] == '@')
   {
     new string[256], pName[24];
     if(PlayerInfo[playerid][AdminLevel] < 1)
     {
      GetPlayerName(playerid,pName,sizeof(pName));
      strdel(text, 0, 1);
      format(string, sizeof(string), "Admin Chat: %s: %s", pName, text);
      SendModMsg(COLOR_YELLOW, string);
   }
   return 0;
  }
  return 1;
}
Reply
#3

pawn Код:
if(text[0] == '@')
   {
     new string[256], pName[24];
     if(PlayerInfo[playerid][AdminLevel] < 1)
     {
      GetPlayerName(playerid,pName,sizeof(pName));
      strdel(text, 0, 1);
      format(string, sizeof(string), "Admin Chat: %s: %s", pName, text);
      SendModMsg(COLOR_YELLOW, string);
     }             // ;]
   }
   return 0;
  }
  return 1;
}
Reply
#4

pawn Код:
public OnPlayerText(playerid, text[])
{
    if (text[0] == '@' && PlayerInfo[playerid][AdminLevel] < 1)
    {
        new
            name[MAX_PLAYER_NAME]; // it's better to use define instead of its value (24 in this case)
                      // as it makes your code more readable
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        // here we don't make a new string, just use already existing one (at least it works for me)
        format(text, 128, "Admin Chat: %s: %s", name, text[1]);
        // I'm not sure but perhaps this is what crashes your server
        SendModMsg(COLOR_YELLOW, text);
        return 0;
    }
    return 1;
}
Could you show us SendModMsg code?
Reply
#5

Uhm

pawn Код:
if (text[0] == '@' && PlayerInfo[playerid][AdminLevel] < 1)
Are you sure you want only players with level 0 or less to use this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)