AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Console command registration not working. (https://forums.alliedmods.net/showthread.php?t=277446)

RSTFS 01-09-2016 10:20

Console command registration not working.
 
This code works:
Code:

public void OnPluginStart(){
        RegConsoleCmd("sm_glock", GiveGlock);
}

public Action GiveGlock(int client, int args){
        if(IsPlayerAlive(client)){
                GivePlayerItem(client, "weapon_glock", 0);
        }
        return Plugin_Handled;
}

However, when I do anything related to removing weapons that the client already has, the command does not register. For example, this code does not work:
Code:

public void OnPluginStart(){
        RegConsoleCmd("sm_glock", GiveGlock);
}

public Action GiveGlock(int client, int args){
        if(IsPlayerAlive(client)){
                RemovePlayerItem(client, GetPlayerWeaponSlot(client, 0));        //This is the only line changed.
                GivePlayerItem(client, "weapon_glock", 0);
        }
        return Plugin_Handled;
}

0 warnings or errors during compilation.

fysiks 01-09-2016 14:18

Re: Console command registration not working.
 
For issues with SourceMod code, post in the SourceMod forum.

RSTFS 01-09-2016 16:15

Re: Console command registration not working.
 
Whoops, I don't see a way to delete this post though.

fysiks 01-09-2016 16:57

Re: Console command registration not working.
 
Quote:

Originally Posted by RSTFS (Post 2381732)
Whoops, I don't see a way to delete this post though.

Use the "Report Post" button on your first post and request it be removed.


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

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