Jump to content
  • 0

un nou parametru la o comanda


Question

Posted

Problema intalnita (descriere):Revin cu alt topic cum naiba sa fac comanda /ban pe zile.
Ero(area / rile) / warning-(ul / urile):-
Liniile de cod / sursa / script-ul(obligatoriu):
Imagini / Video (optional):-
Ati incercat sa rezolvati singur?:Da am adaugat zile dar tot nu merge

if(strcmp(cmd, "/ban", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
           if(PlayerInfo[playerid][pAdmin] >= 1)
           {
             tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
               SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /ban [playerid/numejucator] [days - 0 for permanent] [reason]");
               return 1;
            }
            giveplayerid = ReturnUser(tmp);
             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[128];
                  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, "{00FF00}Folosire:{FFFFFF} /ban [playerid/numejucator] [days - 0 for permanent] [reason]");
                     return 1;
                  }
                  if(PlayerInfo[giveplayerid][pAdmin] > 0 && PlayerInfo[playerid][pAdmin] < 6)
                     {
                     SendClientMessage(playerid, COLOR_WHITE, "{0066FF}AdmCmd: {FFFFFF}Nu poti bana admini!");
                     format(string, sizeof(string), "{0066FF}AdmCmd: {FF0000}%s {FFFFFF}a incercat sa il baneze pe {FF0000}%s {FFFFFF}cu motivul: %s", sendername, giveplayer, (result));
                     ABroadCast(COLOR_LIGHTRED, string, 1);
                     return 1;
                     }
                     if(PlayerInfo[giveplayerid][pAdmin] > 6)
                     {
                        SendClientMessage(playerid, COLOR_WHITE, "{0066FF}AdmCmd: {FFFFFF}Nu poti bana Fondatorii!");
                     format(string, sizeof(string), "{0066FF}AdmCmd: {FF0000}%s {FFFFFF}a incercat sa il baneze pe {FF0000}%s {FFFFFF}cu motivul: %s", sendername, giveplayer, (result));
                     ABroadCast(COLOR_LIGHTRED, string, 1);
                     return 1;
                     }
                     if(strmatch(giveplayer, "Jimmi")) return SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Ban: {FFFFFF}Fraiere, e server-ul meu.");
                  new year, month,day;
                  getdate(year, month, day);
                  new hour, minute, second;
                  gettime(hour, minute, second);
                  format(string, sizeof(string), "Info: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
                  BanLog(string);
                  format(string, sizeof(string), "{0066FF}Info: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result));
                  SendClientMessageToAll(COLOR_LIGHTRED, string);
                  PlayerInfo[giveplayerid][pReg] = -999; Update(giveplayerid, pRegisteredx);
                  new playersip[256];
                  GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
                  strmid(PlayerInfo[giveplayerid][pIP], playersip, 0, 100, 255);
                  Update(giveplayerid, pIPx);
                    new query[512];
                  format(query, sizeof(query) ,"INSERT INTO `banslog` (`BanID`,`user_banned`,`user_banned_ip`,`user_banner`,`ban_reason`,`ban_timestamp`,`ban_time`) VALUES ('','%s','%s','%s','%s',CURRENT_TIMESTAMP,'%d')",
                  giveplayer,
                  PlayerInfo[giveplayerid][pIP],
                  sendername,
                  result,
                  0);
                  mysql_query(query);
                  SendClientMessage(giveplayerid, COLOR_WHITE, "|__________________[BAN]__________________|");
                  format(string, sizeof(string), "Adminul care te-a banat : {FFFF00}%s",sendername);
                  SendClientMessage(giveplayerid, COLOR_GREY, string);
                  format(string, sizeof(string), "Motivul : {FFFF00}%s",(result));
                  SendClientMessage(giveplayerid, COLOR_GREY, string);
                  format(string, sizeof(string), "Ban : {FFFF00}Permanent");
                  SendClientMessage(giveplayerid, COLOR_GREY, string);
                  format(string, sizeof(string), "Data curenta : {FFFF00}%d-%d-%d",month,day,year);
                  SendClientMessage(giveplayerid, COLOR_GREY, string);
                  format(string, sizeof(string), "Data expirarii : {FFFF00}%d-%d-%d",month,day,year,hour, minute, second);
                  SendClientMessage(giveplayerid, COLOR_GREY, string);
                  format(string, sizeof(string), "Pentru unban intrati pe forumul nostru: WWW.Forummy.ro");
                  SendClientMessage(giveplayerid, COLOR_GREY, string);
                  SendClientMessage(giveplayerid, COLOR_WHITE, "|__________________________________________|");
                  kicktimer[giveplayerid] = SetTimerEx( "KickS",100, true, "d", giveplayerid );
                  return 1;
               }
            }
         }
      }
      return 1;
   }

9 answers to this question

Recommended Posts

  • 0
  • Administrator
Posted

Eu propun sa folosesti sscanf e mult mai usor.

Acum eu nu vad unde iei din parametrii zilele pentru ban si unde verifici daca zilele sunt mai mari ca 0 ca sa nu ii dea ban permanent.

  • 0
  • 0
Posted

Stiu ca nu stiu ce fac acele functii.De aceea am postat aici ca sa mi se explice ce sa fac ca sa fac comanda /ban sa mearga si pe zile

  • 0
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.