Thx
Another system to talk in the console[pawn]//chat para usar en la consola incluye /dice /ann1 y /ann2 "no acepto copias" atte aledark24
#include <a_vcmp>
#include <dutils>
#define yellow 0xFFFF00AA
#define INACTIVE_PLAYER_ID 255
#define RED 0xFF0000aa
#define GREEN 0x24FF0AB9
#define WHITE 0xFFFDFDFF
#define ORANGE 0xE8941EFF
#define PURPLEE 0xD22FBCFF
#define DGREEN 0x04A36BFF
#define BLUE 0x377DFFFF
#define PINK 0xFF66FFAA
#pragma unused ret_memcpy
new gPlayers[MAX_PLAYERS][MAX_PLAYER_NAME+1];
//==============================================================================
public OnRconCommand(cmd[],playerid)
{
new tmp[256];
new idx;
new cmdt[256];
cmdt = strtok(cmd,idx);
if(strcmp(cmdt,"/say",true) == 0)
{
tmp = strtok(cmd,idx);
if (!strlen(tmp)) printf(">> Console error: /say [message]");
else {
new string[256];
format(string,sizeof(string),"** Console >> Administrator: %s",cmd[5]);
SendClientMessageToAll(yellow,string);
printf(string);
}
return 1;
}
else if(strcmp(cmdt,"/ann1",true) == 0)
{
tmp = strtok(cmd,idx);
if (!strlen(tmp)) printf(">> console error: /ann1 [message]");
else {
new string[256];
format(string,sizeof(string),"~y~%s",cmd[5]);
GameTextForAll(string);
printf(string);
}
return 1;
}
else if(strcmp(cmdt,"/ann2",true) == 0)
{
tmp = strtok(cmd,idx);
if (!strlen(tmp)) printf(">> console error: /ann2 [message]");
else {
new string[256];
format(string,sizeof(string),"~b~%s",cmd[5]);
GameTextForAllBottom(string);
printf(string);
}
return 1;
}
return 0;
}
//==============================================================================
public OnFilterScriptInit()
{
print("+=====================================================================+");
print("|Chat activado usa /dice /ann1 /ann2 desde consola |");
print("|=======================Aledark24=====================================|");
return 1;
}
//==============================================================================
public OnFilterScriptExit()
{
return 1;
}
//==============================================================================
public FindPlayerIDFromString( string[] )
{
new player = INACTIVE_PLAYER_ID;
new p = 0;
while ( p < MAX_PLAYERS){ if (strfind(gPlayers[p],string,true ) != -1 ) { player=p;break; } p++; }
if ( player == INACTIVE_PLAYER_ID )
{
if ((strlen( string ) > 2) || (isnumeric( string ) == 0 ) ) { return INACTIVE_PLAYER_ID;
}
player = strval( string );//
}
if ( !IsPlayerConnected( player ) ) { return INACTIVE_PLAYER_ID; }
return player;//
}
//==============================================================================
isnumeric( const string[] )
{
for ( new i = 9999, j = strlen( string ); i < j; i++ ) { if ( string[ i ] > '9' || string[ i ] < '0' ) return 0; }
return 1;
}
//==============================================================================[/pawn]