Szerző Téma: /stats hiba  (Megtekintve 493 alkalommal)

Swat

  • Vendég
/stats hiba
« Dátum: 2012. február 03. - 16:06:51 »
0 Show voters
hello all azt szeretném megkérdezni h ennek a /stats parancsnak mi a bjaja beirom h /Stats és csak ugy lehet megnézni a saját adataim h ha au id-m is beirom valaki help
Parancs:
[pawn]CMD:stats(playerid,params[])
{
    if(!strlen(params)) return SendClientMessage(playerid,red,\"Használat: /stats [playerid]\");
    new player1, string[1000];
    player1 = strval(params);
    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
    new Float:player1health,Float:player1armour,ora,perc,mp,FavSkinID,GangStatus[64],P1Jailed[4],P1Frozen[4],P1GOD[12],P1FavPlace[10],P1InAFK[12];
   GetPlayerHealth(player1,player1health);
   GetPlayerArmour(player1,player1armour);
   ora = dUserINT(PlayerName2(player1)).(\"hours\");
   perc = dUserINT(PlayerName2(player1)).(\"minutes\");
   mp = dUserINT(PlayerName2(player1)).(\"seconds\");
        FavSkinID = dUserINT(PlayerName2(playerid)).(\"skin\");
   if(dUserINT(PlayerName2(player1)).(\"FavPlace\") == 1)
   {
      PlayerInfo[player1][FavPlace]=1;
   }
   else
   {
       PlayerInfo[player1][FavPlace]=0;
   }
   if((PlayerInfo[player1][Gang]) > 0)
   {
        switch(PlayerInfo[player1][Gang])
      {
          case 1:
         {
            GangStatus = \"Nincs\";
                }
          case 2:
         {
            GangStatus = \"Grove\";
         }
          case 3:
         {
            GangStatus = \"Aztecas\";
         }
          case 4:
         {
            GangStatus = \"Seville\";
         }
      }
   }
   if(PlayerInfo[player1][Jailed] == 1) P1Jailed = \"Van\"; else P1Jailed = \"Nem\";
   if(PlayerInfo[player1][Frozen] == 1) P1Frozen = \"Van\"; else P1Frozen = \"Nem\";
   if(PlayerInfo[player1][FavPlace] == 1) P1FavPlace =\"Van\"; else P1FavPlace = \"Nincs\";
   if(PlayerInfo[playerid][God] == 1) P1GOD = \"Bekapcsólva\"; else P1GOD = \"Kikapcsólva\";
   if(PlayerInfo[player1][inAFK] == 1) P1InAFK =\"Bekapcsólva\"; else P1InAFK = \"Kikapcsólva\";
   new Dstring[1000];
        format(string, sizeof(string),\"{00BFFF}---====> Név: {FF0000}%s(%d){00BFFF}<====---\",PlayerName2(player1), player1);
        format(Dstring, sizeof(Dstring),\"%s\",string);
   format(string, sizeof(string),\"{00BFFF}Adminszint: {FF0000}%d{00BFFF} Warnok: {FF0000}%d{00BFFF} Kedvenc Skin: {FF0000}%d{00BFFF}\", PlayerInfo[player1][Level], PlayerInfo[player1][Warnings],FavSkinID);
   format(Dstring, sizeof(Dstring),\"%s\\n%s\",Dstring,string);
   format(string, sizeof(string),\"{00BFFF}Életenergia: {FF0000}%d{00BFFF}  Páncél: {FF0000}%d{00BFFF} KedvencSpawn: {FF0000}%s{00BFFF}\",floatround(player1health),floatround(player1armour),P1FavPlace);
        format(Dstring, sizeof(Dstring),\"%s\\n%s\",Dstring,string);
   format(string, sizeof(string),\"{00BFFF}Ölések: {FF0000}%d{00BFFF}  Halálok: {FF0000}%d{00BFFF}  Arány: {FF0000}%0.2f{00BFFF}  Banda: {FF0000}%s{00BFFF}\",PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:PlayerInfo[player1][Deaths],GangStatus);
        format(Dstring, sizeof(Dstring),\"%s\\n%s\",Dstring,string);
   format(string, sizeof(string),\"{00BFFF}Pénze: {FF0000}%d{00BFFF} Pontja: {FF0000}%d{00BFFF} GOD: {FF0000}%s{00BFFF}\",GetPlayerMoney(player1),GetPlayerScore(player1), P1GOD);
        format(Dstring, sizeof(Dstring),\"%s\\n%s\",Dstring,string);
   format(string, sizeof(string),\"{00BFFF}Börtönözve: {FF0000}%s{00BFFF}  Lefagyasztva: {FF0000}%s{00BFFF} Afk: {FF0000}%s{00BFFF}\",P1Jailed, P1Frozen, P1InAFK);
        format(Dstring, sizeof(Dstring),\"%s\\n%s\",Dstring,string);
   format(string, sizeof(string),\"{00BFFF}Szerveren töltött idõ: {FF0000}%d{00BFFF} óra {FF0000}%d{00BFFF} perc {FF0000}%d{00BFFF} másodperc \",ora, perc, mp);
        format(Dstring, sizeof(Dstring),\"%s\\n%s\",Dstring,string);
        ShowPlayerDialog(playerid,1236,DIALOG_STYLE_MSGBOX,\"{FF0000}ADATOK\",Dstring,\"OK\",\"\");
   if(PlayerInfo[player1][Level] >= 1 || IsPlayerAdmin(player1))
   {
      format(string, sizeof(string),\"%s megnézte az adataidat!\",PlayerName2(playerid));
           SendClientMessage(player1,red,string);
        }
       
}
else return SendClientMessage(playerid,red,\"HIBA: Ilyen játékos nem létezik\");
return 1;
}[/pawn]

/stats hiba
« Válasz #1 Dátum: 2012. február 03. - 21:50:05 »
0 Show voters
Mert a parancs felépítése olyan ha nincs megadva a második paraméter /stats [playerid] akkor egy üzenettel tér vissza.
Ebbõl adódóan ha valaki nem ír be egy értéket akkor csak azt az üzenet részt kell lecserélni, mondjuk így:
[pawn]
new player1;
if(isnull(params)) player1 = playerid;
new string[128];
//...
[/pawn]
És zcmd-nél nem szabad használni strlen-t, isnull definíciót kell.

/stats hiba
« Válasz #2 Dátum: 2012. február 05. - 10:21:21 »
0 Show voters
[pawn]#if defined USE_STATS
dcmd_stats(playerid,params[]) {
new string[128], pDeaths, player1, h, m, s;
if(!strlen(params)) player1 = playerid;
else player1 = strval(params);
if(IsPlayerConnected(player1)) {
    TotalGameTime(player1, h, m, s);
       if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
       format(string, sizeof(string), \"| %s\'s Statisztika:  ölés: %d | halál: %d | arány: %0.2f | pénz: $%d | nap: %d óra %d perc %d mp |\",PlayerName2(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1), h, m, s);
   return SendClientMessage(playerid, green, string);
} else return SendClientMessage(playerid, red, \"HIBA: játékos nincs csatlakozva!\");
}
#endif
#endif
LoginPlayer(playerid)
{
if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).(\"money\") ); }
dUserSetINT(PlayerName2(playerid)).(\"loggedin\",1);
PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).(\"deaths\"));
PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).(\"kills\"));
    PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).(\"level\"));
      PlayerInfo[playerid][hours] = dUserINT(PlayerName2(playerid)).(\"hours\");
      PlayerInfo[playerid][mins] = dUserINT(PlayerName2(playerid)).(\"minutes\");
      PlayerInfo[playerid][secs] = dUserINT(PlayerName2(playerid)).(\"seconds\");
PlayerInfo[playerid][Registered] = 1;
    PlayerInfo[playerid][LoggedIn] = 1;
}
[/pawn]

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal