Jump to content
  • 0

Problema /facwarn


AlexVs

Question

Care imi poate face un tutorial mai explicit ...

1.Cautam Linia "enum pInfo" si adaugam:

Cod:

pFACWarns,

2.Cautam Linia "public OnPlayerConnect(playerid)" si adaugam:

Cod:

PlayerInfo[playerid][pFACWarns] = 0;

3.Cautam Linia "new warns = PlayerInfo[targetid][pWarns];" si adaugam:

Cod:

new facwarn = PlayerInfo[targetid][pFACWarns];

4.Cautam Linia "format(var, 32, "Warnings=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);" si adaugam:

Cod:

format(var, 32, "FactionWarnings=%d\n",PlayerInfo[playerid][pFACWarns]);fwrite(hFile, var);

5.Cautam Linia"format(var, 32, "Warnings=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);" si adaugam:

Cod:

format(var, 32, "FactionWarnings=%d\n",PlayerInfo[playerid][pFACWarns]);fwrite(hFile, var);

6.Cautam Linia "public OnPlayerLogin(playerid,password[])" si adaugam:

Cod:

if( strcmp( key , "FactionWarnings" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFACWarns] = strval( val ); }

7.Mergem la "/setstat" si facem un nou "case":

Cod:

  case 100:

  {

      PlayerInfo[giveplayerid][pFACWarns] = amount;

      format(string, sizeof(string), "  The Player Faction Warns set to %d", amount);

  }

8.Acuma Adaugam comanda pentru lideri & Admini:

Cod:

if(strcmp(cmd, "/facwarn", true) == 0)

  {

      if(IsPlayerConnected(playerid))

      {

          tmp = strtok(cmdtext, idx);

        if(!strlen(tmp))

        {

            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /facwarn [playerid/PartOfName] [reason]");

            return 1;

        }

        giveplayerid = ReturnUser(tmp);

        if (PlayerInfo[playerid][pLeader] >= 1)

        {

            if(IsPlayerConnected(giveplayerid))

            {

                if(giveplayerid != INVALID_PLAYER_ID)

                {

                  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

                  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: /facwarn [playerid/PartOfName] [reason]");

                    return 1;

                  }

                  PlayerInfo[giveplayerid][pFACWarns] += 1;

                  if(PlayerInfo[giveplayerid][pFACWarns] >= 3)

                  {

                      new year, month,day;

                    getdate(year, month, day);

                    format(string, sizeof(string), "AdmCmd: %s was kicked from the faction by %s (had 3 Faction Warnings), reason: %s", giveplayer, sendername, (result));

                    SendClientMessageToAll(COLOR_LIGHTRED, string);

                      PlayerInfo[giveplayerid][pMember]=0;

                        PlayerInfo[giveplayerid][pLeader]=0;

                          PlayerInfo[giveplayerid][pRank] = 0;

                    PlayerInfo[giveplayerid][pChar] = 0;

                    gTeam[giveplayerid] = 0;

                    PlayerInfo[giveplayerid][pFACWarns] = 0;

                    PlayerInfo[giveplayerid][pBLTime] = 604800;

                    PlayerInfo[giveplayerid][pBlackList] = 1;

                    new rand = random(sizeof(CIV));

                    SetSpawnInfo(giveplayerid, gTeam[giveplayerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);

                    PlayerInfo[giveplayerid][pModel] = CIV[rand];

                    MedicBill[giveplayerid] = 0;

                    SpawnPlayer(giveplayerid);

                    return 1;

                  }

                  format(string, sizeof(string), "You Faction Warned %s, reason: %s", giveplayer, (result));

                  SendClientMessage(playerid, COLOR_LIGHTRED, string);

                  format(string, sizeof(string), "You were Faction Warned by %s, reason: %s", sendername, (result));

                  SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);

                  format(string, sizeof(string), "AdmCmd: %s was Faction Warned by %s, reason: %s", giveplayer, sendername, (result));

                  SendClientMessageToAll(COLOR_LIGHTRED, string);

                  return 1;

              }

            }//not connected

        }

        else

        {

            format(string, sizeof(string), "  %d is not an active player.", giveplayerid);

            SendClientMessage(playerid, COLOR_GRAD1, string);

        }

      }

      return 1;

  }

* Nota: Cine nu are "PlayerInfo[giveplayerid][pBLTime] = 604800;" si "PlayerInfo[giveplayerid][pBlackList] = 1;" Sa le stearga din comanda !

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.