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.