Beispiel #1
0
 public void SetPlayerAnim(Client sender, string animation)
 {
     if (!Animation.IsPlayerAvailableForAnim(sender))
     {
         return;
     }
     if (animation == "list")
     {
         string helpText = AnimationList.Aggregate(new StringBuilder(),
                                                   (sb, kvp) => sb.Append(kvp.Key + " "), sb => sb.ToString());
         API.sendChatMessageToPlayer(sender, "~b~Available animations:");
         var split = helpText.Split();
         for (int i = 0; i < split.Length; i += 5)
         {
             string output = "";
             if (split.Length > i)
             {
                 output += split[i] + " ";
             }
             if (split.Length > i + 1)
             {
                 output += split[i + 1] + " ";
             }
             if (split.Length > i + 2)
             {
                 output += split[i + 2] + " ";
             }
             if (split.Length > i + 3)
             {
                 output += split[i + 3] + " ";
             }
             if (split.Length > i + 4)
             {
                 output += split[i + 4] + " ";
             }
             if (!string.IsNullOrWhiteSpace(output))
             {
                 API.sendChatMessageToPlayer(sender, "~b~>> ~w~" + output);
             }
         }
     }
     else if (animation == "stop")
     {
         if (API.hasEntityData(sender, "Cuffed") || API.hasEntityData(sender, "Cuffed") == true)
         {
             API.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Kelepçeliyken bunu yapamazsınız.");
             return;
         }
         if (API.getEntityData(sender, "DeadSeconds") > 0)
         {
             API.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Yaralıyken bunu yapamazsınız.");
             return;
         }
         API.stopPlayerAnimation(sender);
         API.resetEntityData(sender, "Handsup");
     }
     else if (!AnimationList.ContainsKey(animation))
     {
         API.sendChatMessageToPlayer(sender, "~r~HATA: ~w~Animasyon bulunamadı!");
     }
     else
     {
         var flag = 0;
         if (animation == "handsup")
         {
             flag = 1;
         }
         API.setEntityData(sender, "Handsup", true);
         API.playPlayerAnimation(sender, flag, AnimationList[animation].Split()[0], AnimationList[animation].Split()[1]);
     }
 }