AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   css throving knives (https://forums.alliedmods.net/showthread.php?t=182421)

tonicLT 04-09-2012 12:34

css throving knives
 
Hi guys. I have a jailbreak server (sm_hosties). I have an idea to edit this plugin http://forums.alliedmods.net/showthread.php?t=125226 that ONLY terrorists that has admin/vip flag can use it. Can some one help me?

TnTSCS 04-09-2012 23:49

Re: css throving knives
 
1 Attachment(s)
Change this:
PHP Code:


public EventPlayerSpawn(Handle:event,const String:name[],bool:dontBroadcast) {

    if (
GetConVarBool(g_CVarEnable)) {
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
g_iKnives[client] = GetConVarInt(g_CVarKnives);
    }


to this:

PHP Code:


public EventPlayerSpawn(Handle:event,const String:name[],bool:dontBroadcast) {

    if (
GetConVarBool(g_CVarEnable)) {
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        if (
GetClientTeam(client) == && CheckCommandAccess(client"allow_throwing_knives"ADMFLAG_CUSTOM1))
        {
            
g_iKnives[client] = GetConVarInt(g_CVarKnives);
        }
    }


Then you can override the Admin/VIP flag to be whatever you want by setting the flag for "allow_throwing_knives" in the admin_overrides.cfg file.

Attached the modified version for you.

thetwistedpanda 04-10-2012 07:49

Re: css throving knives
 
g_iKnives[client] isn't reset on disconnect, so with that modification it would be possible for a future client to inherit the knives of the previous player. Just need an else clause to reset the knives go 0 or throw it in OnClientDisconnect.

TnTSCS 04-10-2012 09:17

Re: css throving knives
 
ya, I saw that possiblity, but didn't look through for the disconnect code to see if it got reset... just used the online compiler to make sure it would compile before I posted.

Here's the code suggested by thetwistedpanda so a new player doesn't glitch the plugin and get knives when they're not allowed to:
PHP Code:

public EventPlayerSpawn(Handle:event,const String:name[],bool:dontBroadcast) {

    if (
GetConVarBool(g_CVarEnable)) {
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        if (
GetClientTeam(client) == && CheckCommandAccess(client"allow_throwing_knives"ADMFLAG_CUSTOM1))
        {
            
g_iKnives[client] = GetConVarInt(g_CVarKnives);
        }
        else
        {
            
g_iKnives[client] = 0;
        }
    }



tonicLT 04-10-2012 09:33

Re: css throving knives
 
I don't know why, but it doesn't work... I haven't changed your code, i putted the file u attached in your post. Bu I can't throw any knifes... (i am an admin)

EDIT: Oh... sory, i added it to wrong folder. It works great, thanks! :)

One question, how to change knivies demage to 115? I have this cavar sm_throwingknives_damage "57" but when i put it in console it doesn't work...


All times are GMT -4. The time now is 07:02.

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