One thing, someone help.
#1

pawn Код:
//==========ADMIN CHAT================//
    if(text[0] == '@' && pInfo[playerid][AdminLvl] > 0)
    {
        new AdminName[MAX_PLAYER_NAME], AdminText[128];
        GetPlayerName(playerid,AdminName,sizeof(AdminName));
        format(AdminText,sizeof(AdminText),"%s: %s",AdminName,text[1]);
       
        SendClientMessageToAdmins(0xA954FFFF,AdminText);
        return false;
    }
    //=====================================//
Its good @ [text] but i want to make // [text] is it possible to do that? Because replacing @ with // doesn't work, i get error error 027: invalid character constant
Reply
#2

maybe a '//' command?
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new command[32],params[96];
  if (strfind(cmdtext, " ", false) != -1)
  {
    strmid(command, cmdtext, 0, strfind(cmdtext, " ", false));
    strmid(params, cmdtext, strfind(cmdtext, " ", false), strlen(cmdtext));
  }
  if (strcmp(command, "//", true) == 0)
  {
    new AdminName[MAX_PLAYER_NAME], AdminText[128];
    GetPlayerName(playerid,AdminName,sizeof(AdminName));
    format(AdminText,sizeof(AdminText),"%s: %s",AdminName,params);
    SendClientMessageToAdmins(0xA954FFFF,AdminText);
    return 1;
  }
  return 0;
}
Here you go mate. The first "if" finds the space between the command and the parameters (/command parameters). The second if is your command ( // [text] ). What this does is send everything the player types after //[space] to the admins.

Just add everything in your OnPlayerCommandText(playerid, cmdtext[]) and it should work.
Reply
#4

Thx a lot, it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)