Advertisement
Guest User

Untitled

a guest
Aug 21st, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. #include <sourcemod>
  2.  
  3. #define PLUGIN_VERSION "0.3"
  4.  
  5. new g_iAccount = -1;
  6. new Handle:Switch;
  7. new Handle:Cash;
  8. new Handle:AdminCash;
  9.  
  10. public Plugin:myinfo =
  11. {
  12.     name = "Extra Cash",
  13.     author = "Peoples Army, DoK",
  14.     description = "Adds Extra Cash On Each Spawn",
  15.     version = PLUGIN_VERSION,
  16.     url = "www.sourcemod.net"
  17. };
  18.  
  19. public OnPluginStart()
  20. {
  21.     g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");
  22.     Switch = CreateConVar("extra_Cash_on","1","Включение = 1/ отключение = 0 плагина", FCVAR_NOTIFY);
  23.     Cash = CreateConVar("extra_cash_amount","16000","Количество денег, выдаваемое в начале раунда", FCVAR_NOTIFY);
  24.     AdminCash = CreateConVar("extra_cash_admin","1","Вкючение = 1/ отлючение = 0 вывода денег только админам", FCVAR_NOTIFY);
  25.     HookEvent("player_spawn" , PlayerSpawn);
  26.    
  27.     AutoExecConfig(true, "ExtraCash");
  28. }
  29.  
  30. public PlayerSpawn(Handle: event , const String: name[] , bool: dontBroadcast)
  31. {
  32.     new clientID = GetEventInt(event,"userid");
  33.     new client = GetClientOfUserId(clientID);
  34.     new AdminId:admin_cash = GetUserAdmin(client);
  35.     if(GetConVarInt(Switch))
  36.     {
  37.         if(GetConVarInt (AdminCash) == 1)
  38.         {
  39.             if(admin_cash != INVALID_ADMIN_ID)
  40.             {
  41.                 SetMoney(client, GetConVarInt(Cash));
  42.             }
  43.         }
  44.         if(GetConVarInt (AdminCash) == 0)
  45.         {
  46.             SetMoney(client, GetConVarInt(Cash));
  47.         }
  48.     }
  49. }
  50.  
  51. public SetMoney(client, amount)
  52. {
  53.     if (g_iAccount != -1)
  54.     {
  55.         SetEntData(client, g_iAccount, amount);
  56.     }  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement