Raised This Month: $12 Target: $400
 3% 

css throving knives


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tonicLT
Member
Join Date: Apr 2012
Old 04-09-2012 , 12:34   css throving knives
Reply With Quote #1

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?

Last edited by tonicLT; 04-09-2012 at 13:05.
tonicLT is offline
Send a message via Skype™ to tonicLT
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-09-2012 , 23:49   Re: css throving knives
Reply With Quote #2

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.
Attached Files
File Type: sp Get Plugin or Get Source (cssthrowingknives.sp - 194 views - 13.4 KB)
__________________
View my Plugins | Donate

Last edited by TnTSCS; 04-09-2012 at 23:54.
TnTSCS is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 04-10-2012 , 07:49   Re: css throving knives
Reply With Quote #3

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.
__________________

Last edited by thetwistedpanda; 04-10-2012 at 07:49.
thetwistedpanda is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-10-2012 , 09:17   Re: css throving knives
Reply With Quote #4

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;
        }
    }

__________________
View my Plugins | Donate
TnTSCS is offline
tonicLT
Member
Join Date: Apr 2012
Old 04-10-2012 , 09:33   Re: css throving knives
Reply With Quote #5

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...

Last edited by tonicLT; 04-10-2012 at 10:37.
tonicLT is offline
Send a message via Skype™ to tonicLT
Reply


Thread Tools
Display Modes

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 00:35.


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