Advertisement
MarechalSummers

Steal Weapons

Oct 8th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. #include <cstrike>
  2. #include <smlib>
  3.  
  4. new Handle:g_hTimerSteal[MAXPLAYERS+1] = INVALID_HANDLE;
  5. new bool:CanSteal[MAXPLAYERS+1];
  6.  
  7. public OnPluginStart()
  8. {
  9.     RegConsoleCmd("sm_pick", Comm_Pick, "Steal Weapon");
  10. }
  11.  
  12. public OnClientPutInServer(client)
  13. {
  14.     CanSteal[client] = true;
  15. }
  16.  
  17. public Action:Comm_Pick(client, args)
  18. {
  19.     if(!CanSteal[client]) {
  20.         PrintToChat(client, "\x05[Weapons Stealer] \x01: Vous ne pouvez pas encore voler d'arme.");
  21.         return Plugin_Handled;
  22.     }
  23.  
  24.     new receiver = GetClientAimTarget(client, true);
  25.     if(receiver == -1) {
  26.         PrintToChat(client, "\x05[Weapons Stealer] \x01: Vous ne visez aucun joueur ...");
  27.         return Plugin_Handled;
  28.     }
  29.  
  30.     decl String:WeaponName[32];
  31.     new Weapon = Client_GetActiveWeaponName(receiver, WeaponName, sizeof(WeaponName));
  32.     RemovePlayerItem(receiver, Weapon);
  33.     GivePlayerItem(client, WeaponName);
  34.  
  35.     CanSteal[client] = false;
  36.     g_hTimerSteal[client] = CreateTimer(30.0, UpdateStealStatus, client);
  37.  
  38.     PrintToChat(client, "\x05[Weapons Stealer] \x01: Vous avez volé l'arme de %N !", receiver);
  39.     PrintToChat(receiver, "\x05[Weapons Stealer] \x01: %N vous a volé votre arme !", client);
  40.  
  41.     return Plugin_Handled;
  42. }
  43.  
  44. public Action:UpdateStealStatus(Handle:timer, any:client)
  45. {
  46.     CanSteal[client] = true;
  47.  
  48.     return Plugin_Handled;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement