This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

AWP Time Limit per player :: Timer Repeat...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Funky_AchTuNG
Junior Member
Join Date: Jul 2010
Old 08-20-2010 , 11:18   AWP Time Limit per player :: Timer Repeat...
Reply With Quote #1

I could not recode any plugin and began studying to do something myself. I made a plugin that defines what I shoot from the AWP and starts a timer. Upon the expiration of the timer, plugin wrote a message to me about that timelimit of the AWP use is up and takes me all the weapons except the knife. The problem is that the plugin will start a new timer each time when there is a shot of the AWP, and we need him to run only once after the first shot.

PHP Code:
#include <sourcemod>
#include <sdktools>

#define VERSION "0.0.1"

#define MAX_PLAYERS 256

public Plugin:myinfo = {
    
name "AWP Time LIMIT",
    
author "AchTuNG",
    
description "AWP timelimit per map.",
    
version VERSION,
    
url "http://www.soucemod.net"
};

 
new 
Handle:AWPTimer[MAX_PLAYERS+1]
new 
Handle:RestrictedWeapon;
new 
String:Weapon[20];

public 
OnPluginStart(){
    
RestrictedWeapon CreateConVar("timer_weapon","a","Sets The Weapons To Punish For",FCVAR_NOTIFY);
    
HookEvent("weapon_fire"IsAWP);
    
PrintToServer("[AWP Timelimit] by AchTuNG! loaded succesfully");
}
 
public 
Action:IsAWP(Handle:event, const String:name[], bool:dontBroadcast){
    
        new 
clientID GetEventInt(event,"userid");
        new 
client GetClientOfUserId(clientID);
        new 
String:Weps[20];
        
        
GetConVarString(RestrictedWeapon,Weps,20);
        
GetClientWeapon(client,Weapon,19)
     
        if(
StrEqual("weapon_awp",Weapon)== true && StrContains(Weps,"a")!= -1)   //flag a AWP
        
{
        
PrintToChat(client,"You have AWP! Timer Started!");
        
PrintToConsole(client"You have AWP! Timer Started!")
        
AWPTimer[client] = CreateTimer(15.0AWPRemoveclient)
        }
}
 
public 
OnClientDisconnect(client)
{
    if (
AWPTimer[client] != INVALID_HANDLE)
    {
        
KillTimer(AWPTimer[client])
        
AWPTimer[client] = INVALID_HANDLE
    
}
}
 
public 
Action:AWPRemove(Handle:timerany:client)
{
    
PrintToChat(client,"While using the AWP has expired!");
    
PrintToConsole(client"While using the AWP has expired!");
    
RemoveAWP(client);
    
AWPTimer[client] = INVALID_HANDLE
}

RemoveAWP(client)

    new 
wepIdx;
    for (new 
0<= 3x++)
    {
        if (
!= && (wepIdx GetPlayerWeaponSlot(clientx)) != -1)
        {  
            
RemovePlayerItem(clientwepIdx);
            
RemoveEdict(wepIdx);
            
PrintToChat(client,"AWP Remowed!");
        }
    }

Thank you in advance for your help!
Yours Funky_AchTuNG

Sorry my English
Funky_AchTuNG is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 08-20-2010 , 13:47   Re: AWP Time Limit per player :: Timer Repeat...
Reply With Quote #2

create a bool cvar that goes with the timer.

if (!active) {
// start awp timer
active = true
}

in awp timer:
active = false
dirka_dirka is offline
Funky_AchTuNG
Junior Member
Join Date: Jul 2010
Old 08-20-2010 , 15:48   Re: AWP Time Limit per player :: Timer Repeat...
Reply With Quote #3

Thx! it works!!
Funky_AchTuNG is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode