OOC Command, (Out of Character, /o)
#1

I need a OOC (Out of Character, /o) command, Please help!
Reply
#2

Some of us might not know OOC
Can you please tell us what it is so we can help you faster + better.
Reply
#3

OOC: Out Of Character

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(text[0] == '$') //If the text starts with a '$', it'll send OOC.
  {
    new pName[MAX_PLAYER_NAME], string[128]; GetPlayerName(playerid, pName, sizeof pName);
    format(string,sizeof string,"[OOC] %s: %s",pName, text[1]);
    SendClientMessageToAll(0x0000ffff,string);
    return 0;
  }
  return 1;
}
Reply
#4

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
OOC: Out Of Character

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(text[0] == '$') //If the text starts with a '$', it'll send OOC.
  {
    new pName[MAX_PLAYER_NAME], string[128]; GetPlayerName(playerid, pName, sizeof pName);
    format(string,sizeof string,"[OOC] %s: %s",pName, text[1]);
    SendClientMessageToAll(0x0000ffff,string);
    return 0;
  }
  return 1;
}
Thank you, But i want it to be under
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
Reply
#5

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext,"/ooc",true)) //If the text starts with a '$', it'll send OOC.
  {
    new pName[MAX_PLAYER_NAME], string[128]; GetPlayerName(playerid, pName, sizeof pName);
    format(string,sizeof string,"[OOC] %s: %s",pName, text[5]);
    SendClientMessageToAll(0x0000ffff,string);
    return 1;
  }
  return 0;
}
Didn't test it though.
Reply
#6

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext,"/ooc",true)) //If the text starts with a '$', it'll send OOC.
  {
    new pName[MAX_PLAYER_NAME], string[128]; GetPlayerName(playerid, pName, sizeof pName);
    format(string,sizeof string,"[OOC] %s: %s",pName, text[5]);
    SendClientMessageToAll(0x0000ffff,string);
    return 1;
  }
  return 0;
}
Didn't test it though.
pawn Код:
format(string,sizeof string,"[OOC]%s: %s",pName, text[5]);
That code gives me these errors,
Код:
C:\Users\BooNii3\Geramia RP\LV-RP\gamemodes\New!.pwn(159) : error 017: undefined symbol "text"
C:\Users\BooNii3\Geramia RP\LV-RP\gamemodes\New!.pwn(159) : warning 215: expression has no effect
C:\Users\BooNii3\Geramia RP\LV-RP\gamemodes\New!.pwn(159) : error 001: expected token: ";", but found "]"
C:\Users\BooNii3\Geramia RP\LV-RP\gamemodes\New!.pwn(159) : error 029: invalid expression, assumed zero
Reply
#7

Replace 'text[5]' by 'cmdtext[5]', sorry.
Reply
#8

shouldn't it be string?


excuse me if im wrong i fail at strcmp
Reply
#9

Nah, It just says "Server Unknown Command" but thanks anyway!
Reply
#10

pawn Код:
if (strcmp("/ooc", cmdtext, true) == 0)
    {
        new string[128];
        new pName[MAX_PLAYER_NAME], string[128]; GetPlayerName(playerid, pName, sizeof pName);
        format(string,sizeof string,"[OOC] %s: %s",pName, string);
        SendClientMessageToAll(0x0000ffff,string);
        return 1;
    }
untested
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)