PDA

View Full Version : [CS:GO]Disabled command still works


Scrumilation
10-07-2014, 21:40
Original post on the wrong board:
I am having some problems with this code:
Code:

...
AddCommandListener(BlockKill, "kill");
...
public Action:BlockKill(client, const String:command[], args)
{
if (GetConVarInt(deathrun_enabled) == 1 && (GetConVarInt(deathrun_block_suicide) == 1))
{
PrintToChat(client, MESS, "kill blocked");
PrintToChat(client, MESS, "join spec");
return Plugin_Handled;
}
return Plugin_Continue;
}

This is from the Deathrun Mod plugin, I am currently trying to fix it but nothing seems to work, I even tried to return Plugin_Stop but the user still suicides.

New info: Ok so after posting that on the wrong place i decided to do another test, i changed the second plugin_ thing to plugin_handled and now it works, i don't really know what is going on, after the first print the if statement just ends and it goes to the rest of the code which is the plugin_continue? Is this a problem with sourcemod or is the code wrong?

bl4nk
10-08-2014, 00:13
The code appears to be fine, however I'm not sure what "MESS" is. Is there anything being printed to your error logs?

Scrumilation
10-08-2014, 00:39
The code appears to be fine, however I'm not sure what "MESS" is. Is there anything being printed to your error logs?

#define MESS "{GREEN}[DeathRun] %t"

Just some prefix stuff, the code is now working, i don't really know why but adding an else statement made it work.

public Action:BlockKill(client, const String:command[], args)
{
if (GetConVarInt(deathrun_enabled) == 1 && (GetConVarInt(deathrun_block_suicide) == 1))
{
CPrintToChat(client, MESS, "kill blocked");
return Plugin_Handled;
}
else
{
return Plugin_Continue;
}
}

Mitchell
10-08-2014, 10:48
strange that works.
usually you need a return at the end of the function. But i guess the "else" catches that.

LambdaLambda
10-08-2014, 11:54
strange that works.
usually you need a return at the end of the function. But i guess the "else" catches that.
It will work without it, but will return warning during compiling.

Scrumilation
10-08-2014, 17:28
It will work without it, but will return warning during compiling.

talk about warnings...
http://i.imgur.com/0KouqOj.png

But the ones from line 28 to 51 are because of this array, what's wrong with it?


new RadioCommands[][] =
{
"coverme",
"cheer",
"thanks",
"compliment",
"takepoint",
"holdpos",
"regroup",
"followme",
"takingfire",
"go",
"fallback",
"sticktog",
"getinpos",
"stormfront",
"report",
"roger",
"enemyspot",
"needbackup",
"sectorclear",
"inposition",
"reportingin",
"getout",
"negative",
"enemydown"
};

bl4nk
10-09-2014, 00:32
Need to tag that as a String.