Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.62 KB | None | 0 0
  1. /******************
  2. *
  3. *    Tazer
  4. *
  5. ******************/
  6.  
  7. public Action:Command_Tazer(client, args)
  8. {
  9.     if (GetClientTeam(client) == 3)
  10.     {
  11.         if (g_tazer[client] > 0)
  12.         {
  13.             new i = GetClientAimTarget(client, true);
  14.            
  15.             if (!IsValidEdict(i) || g_IsTazed[i] == true || GetClientTeam(i) == 3 || !IsPlayerAlive(i) || !IsPlayerAlive(client))  
  16.                 return Plugin_Handled;
  17.             else
  18.             {
  19.                 if (!OnRend[i])
  20.                 {
  21.                     new Float:entorigin[3], Float:clientent[3];
  22.                     GetEntPropVector(i, Prop_Send, "m_vecOrigin", entorigin);
  23.                     GetEntPropVector(client, Prop_Send, "m_vecOrigin", clientent);
  24.                     new Float:distance = GetVectorDistance(entorigin, clientent);
  25.                    
  26.                     if (distance <= 500)
  27.                     {
  28.                         g_IsTazed[i] = true;
  29.                         decl String:player_name[65], String:gardien_name[65];
  30.                         GetClientName(i, player_name, sizeof(player_name));
  31.                         GetClientName(client, gardien_name, sizeof(gardien_name));
  32.                         g_Count[i] = 7.0;
  33.                         g_tazer[client]--;
  34.                        
  35.                         PrecacheSound("bot/aah.wav", true);
  36.                         EmitSoundToAll("bot/aah.wav", i, _, _, _, 1.0);
  37.                        
  38.                         PrecacheSound(SOUND_TAZER, true);
  39.                         EmitSoundToAll(SOUND_TAZER, client, _, _, _, 1.0);
  40.                        
  41.                         clientent[2] += 45;
  42.                         entorigin[2] += 45;
  43.                        
  44.                         TE_SetupBeamPoints(clientent, entorigin, g_LightingSprite, 0, 1, 0, 1.0, 20.0, 0.0, 2, 5.0, TAZER_COLORGRAY, 3);
  45.                        
  46.                         TE_SendToAll();
  47.                        
  48.                         disarm(i);
  49.                         SetEntityMoveType(i, MOVETYPE_NONE);
  50.                        
  51.                         CPrintToChat(client, "%s Vous avez tazé et désarmé le joueur {green}%N", Prefix, i);
  52.                        
  53.                         g_TazerTimer[i] = CreateTimer(0.1, DoTazer, i, TIMER_REPEAT);
  54.                        
  55.                     }
  56.                     else
  57.                     {
  58.                         CPrintToChat(client, "%s Vous êtes trop loin pour tazer.", Prefix);
  59.                     }
  60.                 }
  61.                 else
  62.                 {
  63.                     CPrintToChat(client, "%s Le joueur est en train de se rendre.", Prefix);
  64.                 }
  65.             }
  66.         }
  67.         else
  68.         {
  69.             CPrintToChat(client, "%s Vous n'avez plus de tazer.", Prefix);
  70.         }
  71.     }
  72.     else
  73.     {
  74.         CPrintToChat(client, "%s Vous n'avez pas accès à cette commande", Prefix);
  75.     }
  76.    
  77.     return Plugin_Handled;
  78. }
  79.  
  80. public Action:MettreEnBleu(Handle:timer, any:client)
  81. {
  82.     if (IsClientInGame(client))
  83.     {
  84.         if (g_IsTazed[client] == true && IsPlayerAlive(client))
  85.         {
  86.             CreateTimer(5.0, client)
  87.             SetEntityRenderColor(client, 0, 0, 255, 255);  
  88.         }
  89.     }      
  90. }
  91.  
  92. public Action:DoTazer(Handle:timer, any:client)
  93. {
  94.     if (IsClientInGame(client))
  95.     {
  96.         if (g_IsTazed[client] == true && IsPlayerAlive(client))
  97.         {      
  98.             g_Count[client] -= 0.1;
  99.             if (g_Count[client] >= 0.0)
  100.             {
  101.                
  102.                 new Float:entorigin[3];
  103.                 GetEntPropVector(client, Prop_Send, "m_vecOrigin", entorigin);
  104.                
  105.                 for(new ii=1; ii<8; ii++)
  106.                 {
  107.                     entorigin[2]+= (ii*9);
  108.                    
  109.                     TE_SetupBeamRingPoint(entorigin, 45.0, 45.1, g_modelLaser, g_modelHalo, 0, 1, 0.1, 8.0, 1.0, TAZER_COLORGRAY, 1, 0);
  110.                    
  111.                     TE_SendToAll();
  112.                    
  113.                     entorigin[2]-= (ii*9);
  114.                 }
  115.            
  116.                 return Plugin_Handled;
  117.                 SetEntProp(client, Prop_Data, "m_takedamage", 2, 1);   
  118.  
  119.             }
  120.             else
  121.             {
  122.                 g_IsTazed[client] = false;
  123.             }
  124.         }
  125.         else
  126.         {
  127.             g_IsTazed[client] = false;
  128.             g_Count[client] = 0.0;
  129.            
  130.             if (IsPlayerAlive(client)) 
  131.             {  
  132.                 SetEntityMoveType(client, MOVETYPE_WALK);
  133.             }
  134.             KillTazer(client);
  135.         }
  136.     }
  137.     else
  138.     {
  139.         KillTazer(client);
  140.     }
  141. }
  142.  
  143. public KillTazer(client)
  144. {
  145.     if (g_TazerTimer[client] != INVALID_HANDLE)
  146.     {
  147.         KillTimer(g_TazerTimer[client]);
  148.         g_TazerTimer[client] = INVALID_HANDLE;
  149.     }
  150. }
  151.  
  152. public Tazer(client)
  153. {
  154.     if (GetClientTeam(client) == 3)
  155.     {
  156.         if (VIP(client))
  157.         {
  158.             g_tazer[client] = 3;
  159.         }
  160.         else
  161.         {
  162.             g_tazer[client] = 1;
  163.         }
  164.     }
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement