View Single Post
Author Message
Grafitosky
Member
Join Date: Jul 2020
Old 11-25-2020 , 05:51   EDIT - plugin turbo
Reply With Quote #1

Hello, I have a turbo plugin and I want to be able to use it every 60 seconds, now I have only a well-done message that displays that in X time it can be used. Can someone change it so that it can be used every 60 seconds?



Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>
#include <colorvariables>

public Plugin myinfo = {
    name        = "Turbo na 7 sekund dla vipa",
    author      = "",
    description = "Komenda dla vipa, ktora daje turbo na 7 sekund",
    version     = "0.0.0",
    url         = "-----"
};

#define IsValidAlive(%1) ( 1 <= %1 <= MaxClients && IsClientInGame(%1) && IsPlayerAlive(%1) )

int g_iZmiennaPrzetrzymujacaCzasAbySprawdzacCzyMoznaUzycKomendy[MAXPLAYERS+1];


public void OnMapStart() {
    for(int i = 0; i < MaxClients; i++)
        g_iZmiennaPrzetrzymujacaCzasAbySprawdzacCzyMoznaUzycKomendy[i] = 0;
}
public void OnPluginStart() {
	RegAdminCmd("sm_vturbo", CMD_SKILL, ADMFLAG_CUSTOM6);
}

public Action CMD_SKILL(int client, int args) {
    
    if(IsValidAlive(client))
	{
		SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.4);
		CreateTimer(7.0, TIMER_SKILL, GetClientUserId(client));
	}
		 if(g_iZmiennaPrzetrzymujacaCzasAbySprawdzacCzyMoznaUzycKomendy[client] >= GetTime()) {
        PrintToChat(client, " \x02 Aby użyć jeszcze raz turbo, poczekaj \x06 %i \x02 sekund!", g_iZmiennaPrzetrzymujacaCzasAbySprawdzacCzyMoznaUzycKomendy[client] - GetTime());
        return Plugin_Handled;
	}
    g_iZmiennaPrzetrzymujacaCzasAbySprawdzacCzyMoznaUzycKomendy[client] = GetTime()+60;
    return Plugin_Handled;
}

public Action TIMER_SKILL(Handle hTimer, int userid)
{
	int client = GetClientOfUserId(userid);
	
	if(IsValidAlive(client))
	{
		SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.0);
	}
}
Grafitosky is offline