Raised This Month: $ Target: $400
 0% 

Console command registration not working.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
RSTFS
Junior Member
Join Date: Jan 2016
Old 01-09-2016 , 10:20   Console command registration not working.
Reply With Quote #1

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.

Last edited by RSTFS; 01-09-2016 at 10:32.
RSTFS is offline
 



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 09:21.


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