Szerző Téma: Chat  (Megtekintve 843 alkalommal)

Chat
« Dátum: 2010. augusztus 24. - 21:00:07 »
0 Show voters
Azt szeretném megoldani, hogy van a sima, az /ooc és a /me csetek a szerveren. A sima chatot csak az lássa, aki mondjuk \"20\" közelemben van. Ladmin4 et használok.

Chat
« Válasz #1 Dátum: 2010. augusztus 24. - 21:04:23 »
0 Show voters
 //----------------------------------[ooc]-----------------------------------------------
if(strcmp(cmd, \"/ooc\", true) == 0 || strcmp(cmd, \"/o\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, \"   You havent logged in yet !\");
            return 1;
        }
   if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"   The OOC channel has been disabled by an Admin !\");
      return 1;
   }
   if(PlayerInfo[playerid][pMuted] == 1)
   {
      SendClientMessage(playerid, TEAM_CYAN_COLOR, \"   You can\'t speak, you have been silenced !\");
      return 1;
   }
   GetPlayerName(playerid, sendername, sizeof(sendername));
   new length = strlen(cmdtext);
   while ((idx < length) && (cmdtext[idx] <= \' \'))
   {
      idx++;
   }
   new offset = idx;
   new result[64];
   while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
   {
      result[idx - offset] = cmdtext[idx];
      idx++;
   }
   result[idx - offset] = EOS;
   if(!strlen(result))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"USAGE: (/o)oc [ooc chat]\");
      return 1;
   }
   format(string, sizeof(string), \"(( %s: %s ))\", sendername, result);
   OOCOff(COLOR_OOC,string);
   printf(\"%s\", string);
}
return 1;
}

 
 
 //----------------------------------[Emote]-----------------------------------------------
if(strcmp(cmd, \"/me\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, \"   You havent logged in yet !\");
            return 1;
        }
   GetPlayerName(playerid, sendername, sizeof(sendername));
   new length = strlen(cmdtext);
   while ((idx < length) && (cmdtext[idx] <= \' \'))
   {
      idx++;
   }
   new offset = idx;
   new result[64];
   while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
   {
      result[idx - offset] = cmdtext[idx];
      idx++;
   }
   result[idx - offset] = EOS;
   if(!strlen(result))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"USAGE: /me [action]\");
      return 1;
   }
   format(string, sizeof(string), \"* %s %s\", sendername, result);
   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   printf(\"%s\", string);
}
return 1;
}

 
Rem jó, a gf bõl vágtam:D

Nem elérhető ZeRo

  • 4620
  • Ex Globális Moderátor
    • Profil megtekintése
Chat
« Válasz #2 Dátum: 2010. augusztus 24. - 21:30:47 »
0 Show voters
Idézetet írta: Filippo_Salieri date=1282676663\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"2975\" data-ipsquote-contentclass=\"forums_Topic

 //----------------------------------[ooc]-----------------------------------------------
if(strcmp(cmd, \"/ooc\", true) == 0 || strcmp(cmd, \"/o\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, \"   You havent logged in yet !\");
            return 1;
        }
   if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"   The OOC channel has been disabled by an Admin !\");
      return 1;
   }
   if(PlayerInfo[playerid][pMuted] == 1)
   {
      SendClientMessage(playerid, TEAM_CYAN_COLOR, \"   You can\'t speak, you have been silenced !\");
      return 1;
   }
   GetPlayerName(playerid, sendername, sizeof(sendername));
   new length = strlen(cmdtext);
   while ((idx < length) && (cmdtext[idx] <= \' \'))
   {
      idx++;
   }
   new offset = idx;
   new result[64];
   while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
   {
      result[idx - offset] = cmdtext[idx];
      idx++;
   }
   result[idx - offset] = EOS;
   if(!strlen(result))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"USAGE: (/o)oc [ooc chat]\");
      return 1;
   }
   format(string, sizeof(string), \"(( %s: %s ))\", sendername, result);
   OOCOff(COLOR_OOC,string);
   printf(\"%s\", string);
}
return 1;
}

 
 
 //----------------------------------[Emote]-----------------------------------------------
if(strcmp(cmd, \"/me\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, \"   You havent logged in yet !\");
            return 1;
        }
   GetPlayerName(playerid, sendername, sizeof(sendername));
   new length = strlen(cmdtext);
   while ((idx < length) && (cmdtext[idx] <= \' \'))
   {
      idx++;
   }
   new offset = idx;
   new result[64];
   while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
   {
      result[idx - offset] = cmdtext[idx];
      idx++;
   }
   result[idx - offset] = EOS;
   if(!strlen(result))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"USAGE: /me [action]\");
      return 1;
   }
   format(string, sizeof(string), \"* %s %s\", sendername, result);
   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   printf(\"%s\", string);
}
return 1;
}

 
Rem jó, a gf bõl vágtam:D
 
Legközelebb olvasd el figyelmesebben, hogy mit is kérnek.


Nem teszteltem.
 

public OnPlayerText( playerid, text[  ] ) {
    for( new x = 0; x < MAX_PLAYERS; ++x ) {
        if( !IsPlayerConnected( x ) || IsPlayerNPC( x ) ) continue;
        static Float: playerPos[ 3 ];
        GetPlayerPos( playerid, playerPos[ 0 ], playerPos[ 1 ], playerPos[ 2 ] );
        if( !IsPlayerInRangeOfPoint( x, 20.0, playerPos[ 0 ], playerPos[ 1 ], playerPos[ 2 ] ) ) continue;
        SendPlayerMessageToPlayer( x, playerid, text );
}
return 0;
}

Chat
« Válasz #3 Dátum: 2010. augusztus 24. - 22:12:03 »
0 Show voters
Háátt, beraktam a Ladminba, de látja mindenki, és kétszer jelenik meg a cseten, vagy a régit nem töröltem ki? Melyik sor felel az alap csetért?
« Utoljára szerkesztve: 2010. augusztus 24. - 22:15:36 írta negyes44 »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal