View Single Post
Gachl
BANNED
Join Date: Feb 2009
Old 07-05-2009 , 18:49   Re: [TF2] Ubercharge
Reply With Quote #3

pretty sure not really
noodleboy I did that already as you can see in the todo list of my credit plugin, here's the code:

PHP Code:
#include <tf2_stocks>

public OnPluginStart()
{
    
RegAdminCmd("sm_candy_buy_uber"cBuyUberADMFLAG_BAN"Get instant uber (medic)");
}

public 
Action:cBuyUber(cclientargs)
{
    new 
String:sErrStr[] = "[candypack] Usage: sm_candy_buy_uber <userid> <percent>";
    if (
args 2)
    {
        
PrintToServer(sErrStr);
        return 
Plugin_Handled;
    }
    new 
String:sclient[32];
    
GetCmdArg(1sclientsizeof(sclient));
    new 
client GetClientOfUserId(StringToInt(sclient));
    if (!
FullCheckClient(client))
    {
        
PrintToServer(sErrStr);
        return 
Plugin_Handled;
    }
    new 
String:sonoff[32];
    
GetCmdArg(2sonoffsizeof(sonoff));
    new 
onoff StringToInt(sonoff);
    
    if (
TF2_GetPlayerClass(client) == TF2_GetClass("medic"))
    {
        new 
iSlot GetPlayerWeaponSlot(client1);
        if (
iSlot 0)
        
SetEntPropFloat(iSlotProp_Send"m_flChargeLevel"onoff*0.01);
        new 
String:name[128];
        
GetClientName(clientnamesizeof(name));
        
PrintToChatAll("Gave %s %i\% ubercharge!"nameonoff);
    }
    return 
Plugin_Handled;
}

public 
bool:FullCheckClient(client)
{
    if (
client 1)
        return 
false;
    
    if (!
IsClientConnected(client))
        return 
false;
    
    if (!
IsClientInGame(client))
        return 
false;
    
    if (
IsFakeClient(client))
        return 
false;
    
    return 
true;


Last edited by Gachl; 07-05-2009 at 18:51.
Gachl is offline