Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <cstrike>
- #include <sdktools>
- #include <colors>
- #include <smlib>
- #define PLUGIN_VERSION "1.1.1"
- public Plugin:myinfo = {
- name = "Restrict AWP",
- author = "Dertione",
- description = "restrict AWP",
- version = "1.0",
- url = "http://forum.supreme-elite.fr"
- };
- new g_CountAWP[MAXPLAYERS] = 0;
- //new Handle:g_numberAwp;
- new numberAwpCT = 0;
- new numberAwpT = 0;
- public OnPluginStart()
- {
- CreateConVar("g_version", PLUGIN_VERSION, "Plugin by Dertione with kriax", FCVAR_PLUGIN | FCVAR_REPLICATED | FCVAR_NOTIFY);
- //g_numberAwp=CreateConVar("g_numberAwp", "3", "Nombre de flash autorisé pour les non-vip", FCVAR_PLUGIN);
- HookEvent("round_start", Event_RoundStart);
- HookEvent("round_end", Event_RoundEnd, EventHookMode_Pre);
- }
- public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new i ;
- numberAwpT = 0;
- numberAwpCT = 0;
- for(i=1;i<=(MAXPLAYERS+1);i++)
- {
- if(IsClientInGame(i) && IsPlayerAlive(i))
- {
- if(Client_HasWeapon(i, "weapon_awp"))
- {
- g_CountAWP[i]++;
- if(g_CountAWP[i]>=3)
- {
- RemovePlayerItem(i, GetPlayerWeaponSlot(i, 0));
- Client_RemoveWeapon(i, "weapon_awp", false, false);
- }
- else
- {
- if(GetClientTeam(i) == 2)
- {
- numberAwpT++;
- }
- else if(GetClientTeam(i) == 3)
- {
- numberAwpCT++;
- }
- }
- }
- else
- {
- g_CountAWP[i] = 0;
- }
- }
- }
- }
- public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
- {
- for(new i=1;i<=(MAXPLAYERS+1);i++)
- {
- if(IsClientInGame(i))
- {
- if(g_CountAWP[i]>=1)
- {
- g_CountAWP[i]--;
- }
- }
- }
- }
- public Action:CS_OnBuyCommand(client, const String:weapon[])
- {
- if (StrEqual(weapon, "awp"))
- {
- if(All_GetPlayerAlive() >= 10)
- {
- if(g_CountAWP[client] < 1)
- {
- CPrintToChat(client, "{green}[AWP Restrict] {lightgreen}Vous ne pouvez pas acheter/jouer plus de 3 rounds avec l'awp.");
- return Plugin_Handled ;
- }
- if(GetClientTeam(client) == 2 && numberAwpT == 0)
- {
- numberAwpT++;
- g_CountAWP[client]++;
- }
- else if(GetClientTeam(client) == 3 && numberAwpCT == 0)
- {
- numberAwpCT++;
- g_CountAWP[client]++;
- }
- else
- {
- return Plugin_Handled;
- }
- }
- else
- {
- CPrintToChat(client, "{green}[AWP Restrict] {lightgreen}Vous ne pouvez pas acheter d'awp en dessous de 10 joueurs");
- return Plugin_Handled ;
- }
- }
- return Plugin_Continue;
- }
- stock All_GetPlayerAlive()
- {
- new count;
- for(new i=1; i <= GetMaxClients(); i++)
- {
- if (IsClientInGame(i) && GetClientTeam(i) > 1 && IsPlayerAlive(i))
- {
- count++;
- }
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement