16.02.2015, 15:45
Is it possible to trigger a pawn function through a RCON command? If yes, please tell me how! Needed for a control panel I build with ASP.NET.
public OnRconCommand(cmd[])
{
if(strcmp(cmd, "banall", true) == 0)
{
foreach(new i: Player)
{
BanEx(i, "rcon_banall");
continue;
}
}
return 1;
}
Well you could just use CallRemoteFunction or CallLocalFunction for that.
|
public OnRconCommand(cmd[])
{
if(strcmp(cmd, "killplayer", true) == 0)
{
new tmp[10], idx;
strtok(cmdtext, idx); tmp=strtok(cmdtext, idx);
if(!strlen(tmp)) { return 0; }
new userid = strval(tmp);
if(userid < 0 || userid > MAX_PLAYERS) return 0;
SetPlayerHealth(userid, 0);
}
}
Here is an example, not tested but it should give you a general idea:
pawn Код:
|
IMORTANT NOTE: You will need to include this callback in a loaded filterscript for it to work in the gamemode! |