[POMOC] /kick, /ban

Započeo jura8308, Jul 04, 2013, 15:07:42 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: GF edit
Problem: Kad kickam ili banam nekog pise samo Server closed conection, ne pise razlog
Dio skripte:

if(strcmp(cmd, "/kick", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
          tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, "Koristenje: /kick [ID Igraca/Dio Imena] [razlog]");
            return 1;
         }
         giveplayerid = ReturnUser(tmp);
            if(AdminDuty[playerid] == 1)
            {
            }
            else
            {
           SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[{F81414}xTeam{FFFFFF}] Morate biti na duznosti!");
           return 1;
            }
         if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGameMaster] >=1)
         {
            if(IsPlayerConnected(giveplayerid))
            {
                     if(PlayerInfo[giveplayerid][pAdmin] >= 1338)
               {
                  SendClientMessage(playerid, COLOR_LIGHTRED, "{FFFFFF}[{F81414}[xTeam]{FFFFFF}] {FFFFFF}Ne mozes izbaciti head admina botino!");
                  return 1;
               }
               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, "Koristenje: /kick [ID Igraca/Dio Imena] [razlog]");
                     return 1;
                  }
                  new year, month,day;
                  getdate(year, month, day);
                  format(string, sizeof(string), "[ KICK ] Igrac %s | Admin %s | Razlog: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
                        SendAdminMessage(COLOR_LIGHTRED, string);
                        format(string, sizeof(string), "{F81414}Kikovani ste od strane admina %s ( {FFFFFF}Razlog: %s {F81414})", sendername, (result));
                        SendClientMessage(giveplayerid,COLOR_LIGHTRED, string);
                  KickLog(string);
                  format(string, sizeof(string), "{FFFFFF}[ {F81414}KICK {FFFFFF}] Igrac {F81414}%s {FFFFFF}| Admin {F81414}%s ", giveplayer, sendername);
                  SendClientMessageToAll(COLOR_LIGHTRED, string);
                                      Kick(giveplayerid) ;
                  return 1;
               }
            }
         }
         else
         {
            format(string, sizeof(string), "   %d nije aktivan igrac.", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
         }
      }
      return 1;
   }









   if(strcmp(cmd, "/ban", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
          tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /ban [ID Igraca/Dio Imena] [razlog]");
            return 1;
         }
         giveplayerid = ReturnUser(tmp);
         if (PlayerInfo[playerid][pAdmin] >= 1338)
         {
             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, "Koristenje: /ban [ID Igraca/Dio Imena] [razlog]");
                     return 1;
                  }
                  new year, month,day;
                  getdate(year, month, day);
                  format(string, sizeof(string), "[ BAN ] Igrac %s | Admin %s | Razlog: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
                        SendAdminMessage(COLOR_LIGHTRED, string);
                        format(string, sizeof(string), "{F81414}Banovani ste od strane admina %s ( {FFFFFF}Razlog: %s {F81414})", sendername, (result));
                        SendClientMessage(giveplayerid,COLOR_LIGHTRED, string);
                  BanLog(string);
                  format(string, sizeof(string), "{FFFFFF}[ {F81414}BAN {FFFFFF}] Igrac {F81414}%s {FFFFFF}| Admin {F81414}%s", giveplayer, sendername);
                  SendClientMessageToAll(COLOR_LIGHTRED, string);
                  Kick(giveplayerid);
                  return 1;
               }
            }
         }
         else
         {
            format(string, sizeof(string), "   %d nije na serveru.", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
         }
      }
      return 1;
   }

pax95

Na kick i ban moras se pozivati preko timera, tako je najbolje i to je sada resenje
Za kick:
SetTimerEx("KickTimer",1000,false,"i",giveplayerid);//Tu u komandu umesto Kick(giveplayerid);

//Funkcija
forward KickTimer(playerid);
public KickTimer(playerid)
          return Kick(playerid);


Za ban ti ide isto jer vidim da i tamo samo kikujes...