Szerző Téma: Hiba  (Megtekintve 1514 alkalommal)

Nem elérhető SnicK

  • 7521
    • Profil megtekintése
Hiba
« Dátum: 2010. Április 05. - 16:16:59 »
0 Show voters

if(strcmp(cmd, \"/me\", true) == 0)
{
new   myName[MAX_PLAYER_NAME];
new message[256];
    if(IsPlayerConnected(playerid))
    {
   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_GRAD1, \"Használat: /me [Akció]\");
      return 1;
   }
   format(string, sizeof(string), \"* %s %s\", myName, message);
   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   printf(\"%s\", string);
}
return 1;
}

 
Gamestar RP Chat kódját behelyettesítettem a /me parancsba.
Az a gond hogy játék közben ennyit ír ki:
* csinál valamit.
A név sehol.
Mit rontok el?

Nem elérhető ZeRo

  • 4620
  • Ex Globális Moderátor
    • Profil megtekintése
Hiba
« Válasz #1 Dátum: 2010. Április 05. - 16:18:44 »
0 Show voters
Le kell kérned a játékos nevét( itt a myName karakterláncba ).
 

GetPlayerName( playerid, myName, sizeof myName );

Nem elérhető SnicK

  • 7521
    • Profil megtekintése
Hiba
« Válasz #2 Dátum: 2010. Április 05. - 16:25:18 »
0 Show voters
Most nem küldi el az üzenetet.

Hiba
« Válasz #3 Dátum: 2010. Április 06. - 08:48:12 »
0 Show voters
GetPlayerName( playerid, myName, sizeof(myName));

 
ezt nem így?:o

és ne message-t írj a formathoz hanem (result)ot ;)

Nem elérhető ZeRo

  • 4620
  • Ex Globális Moderátor
    • Profil megtekintése
Hiba
« Válasz #4 Dátum: 2010. Április 06. - 11:18:47 »
0 Show voters
Idézetet írta: Vampesz date=1270536492\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"1252\" data-ipsquote-contentclass=\"forums_Topic

GetPlayerName( playerid, myName, sizeof(myName));

 
ezt nem így?:o

és ne message-t írj a formathoz hanem (result)ot ;)

 
A sizeof csak egy operátor, a zárójelezés ilyen esetekben elhagyható.

Hiba
« Válasz #5 Dátum: 2010. Április 06. - 11:28:49 »
0 Show voters
   if(strcmp(cmd, \"/me\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, \"   Nem vagy bejelentkezve !\");
            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;
   }
   if(PlayerInfo[playerid][pMaskuse] == 1)
   {
       format(string, sizeof(string), \"* Ismeretlen %s\", result);
   }
   else
   {
      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;
}

 
LARP-bol kimásoltam... Nézd meg a hibádat.

Nem elérhető Stray

  • 617
    • Profil megtekintése
Hiba
« Válasz #6 Dátum: 2010. Április 06. - 11:35:53 »
0 Show voters
Talán..
 
    if(strcmp(cmd, \"/me\", true) == 0)
{
new   myName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, myName, sizeof(myName));
new message[256];
    if(IsPlayerConnected(playerid))
    {
   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_GRAD1, \"Használat: /me [Akció]\");
      return 1;
   }
   format(string, sizeof(string), \"* %s %s\", myName, message);
   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   printf(\"%s\", string);
}
return 1;
}

Hiba
« Válasz #7 Dátum: 2010. Április 06. - 11:38:37 »
0 Show voters
Másold ki amit mi beillesztettünk és jó lesz 100% :P

Hiba
« Válasz #8 Dátum: 2010. Április 06. - 11:49:48 »
0 Show voters
szileni a tied maszkkal eggyüt van :) mmint a tiedben akkor ismeretlen ha van maszkod :)



ha már kódokat adogatunk :D

 
if(strcmp(cmd, \"/me\", true) == 0)
{
if(IsPlayerConnected(playerid))
    {
       GetPlayerName(playerid, sendername, sizeof(sendername));
   new length = strlen(cmdtext);
   while ((idx < length) && (cmdtext[idx] <= \' \'))
   {
      idx++;
   }
   new offset = idx;
   new result[63];
   if(length > 63)
   {
       while ((idx < 63) && ((idx - offset) < (sizeof(result) - 1)))
      {
      result[idx - offset] = cmdtext[idx];
      idx++;
      }
             format(string, sizeof(string), \"* %s %s\", sendername, result);
      result[idx - offset] = EOS;
   }
   else
   {
      while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
      {
         result[idx - offset] = cmdtext[idx];
         idx++;
      }
      result[idx - offset] = EOS;
      format(string, sizeof(string), \"* %s %s\", sendername, result);
   }
   result[idx - offset] = EOS;
   if(!strlen(result))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"Használat: /me [action]\");
      return 1;
   }
   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   printf(\"%s\", string);
}
return 1;
}

 
Tessék :) 100%-osan muködik nállam :)


AM a tiédben a hiba:

a formatnál a message helyett kell result-t írni :)

Hiba
« Válasz #9 Dátum: 2010. Április 06. - 18:46:28 »
0 Show voters
Azt akartam írni  :D

Nem elérhető SnicK

  • 7521
    • Profil megtekintése
Hiba
« Válasz #10 Dátum: 2010. Április 06. - 19:01:55 »
0 Show voters
Már hamarabb megcsináltam mindegy köszi a segitséget mindenki.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal