OOC Command, (Out of Character, /o) -
Luis_Leone - 30.07.2010
I need a OOC (Out of Character, /o) command, Please help!
Re: OOC Command -
ViruZZzZ_ChiLLL - 30.07.2010
Some of us might not know OOC
Can you please tell us what it is so we can help you faster + better.
Re: OOC Command, (Out of Character, /o) -
Hiddos - 30.07.2010
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;
}
Re: OOC Command, (Out of Character, /o) -
Luis_Leone - 30.07.2010
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[])
Re: OOC Command, (Out of Character, /o) -
Hiddos - 30.07.2010
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.
Re: OOC Command, (Out of Character, /o) -
Luis_Leone - 30.07.2010
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
Re: OOC Command, (Out of Character, /o) -
Hiddos - 30.07.2010
Replace 'text[5]' by 'cmdtext[5]', sorry.
Re: OOC Command, (Out of Character, /o) -
Kar - 30.07.2010
shouldn't it be string?
excuse me if im wrong i fail at strcmp
Re: OOC Command, (Out of Character, /o) -
Luis_Leone - 30.07.2010
Nah, It just says "Server Unknown Command" but thanks anyway!
Re: OOC Command, (Out of Character, /o) -
Kar - 30.07.2010
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