AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Only knives for CT (https://forums.alliedmods.net/showthread.php?t=163355)

RuleBreaker 07-29-2011 11:43

Only knives for CT
 
How to make that CT can use only knives? I tried this:
Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Stefan"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
        register_event("ResetHUD", "newRound", "b") 

        // Add your code here...
}
public fwHamPlayerSpawnPost(id) {
        if(cs_get_user_team(id) == CS_TEAM_CT) {
                new clip, ammo;
                new userweapon = get_user_weapon(id, clip, ammo);
                if(userweapon == CSW_KNIFE) {
                }
                else {
                        new origin[3];
                        get_user_origin ( id, origin );
                        origin[2] -= 500;
                        set_user_origin ( id, origin );
                        new iwpn, iwpns[32], nwpn[32];
                        get_user_weapons ( id, iwpns, iwpn );
                        for ( new a = 0; a < iwpn; ++a ) {
                                get_weaponname ( iwpns[a], nwpn, 31 );
                                engclient_cmd ( id, "drop", nwpn );
                        }
                        new origin2[3];
                        get_user_origin ( id, origin2 );
                        origin2[2] += 500;
                        set_user_origin ( id, origin2 );
                        client_cmd ( id, "weapon_knife" )
                }
        }
}
public newRound(id) {
        if(cs_get_user_team(id) == CS_TEAM_CT) {
                new clip, ammo;
                new userweapon = get_user_weapon(id, clip, ammo);
                if(userweapon == CSW_KNIFE) {
                }
                else {
                        new origin[3];
                        get_user_origin ( id, origin );
                        origin[2] -= 500;
                        set_user_origin ( id, origin );
                        new iwpn, iwpns[32], nwpn[32];
                        get_user_weapons ( id, iwpns, iwpn );
                        for ( new a = 0; a < iwpn; ++a ) {
                                get_weaponname ( iwpns[a], nwpn, 31 );
                                engclient_cmd ( id, "drop", nwpn );
                        }
                        new origin2[3];
                        get_user_origin ( id, origin2 );
                        origin2[2] += 500;
                        set_user_origin ( id, origin2 );
                        client_cmd ( id, "weapon_knife" )
                }
        }
}

but CT can still pick up weapons :\


All times are GMT -4. The time now is 01:09.

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