help with creating rcon command
#1

This doesn't do much of anything in game. But I compiled it without errors. It's supposed to let the player put in /rcon onduty <the player's ID> What could keep this from working in game?

Код:
public OnRconCommand(cmd[])
{
	new acmd[280], idx;
	acmd = strtok(cmd, idx);

	if(!strcmp(acmd,"/onduty",true))
	{
		new Text3D:label = Create3DTextLabel("Admin On Duty", 0x990000FF, 30.0, 40.0, 50.0, 40.0, 0);
	 	Attach3DTextLabelToPlayer(label, idx, 0.0, 0.0, 0.6);
	}

	return 1;
	
}
Reply
#2

Quote:
Originally Posted by Dennis_Smith
Посмотреть сообщение
This doesn't do much of anything in game. But I compiled it without errors. It's supposed to let the player put in /rcon onduty <the player's ID> What could keep this from working in game?

Код:
public OnRconCommand(cmd[])
{
	new acmd[280], idx;
	acmd = strtok(cmd, idx);

	if(!strcmp(acmd,"/onduty",true))
	{
		new Text3D:label = Create3DTextLabel("Admin On Duty", 0x990000FF, 30.0, 40.0, 50.0, 40.0, 0);
	 	Attach3DTextLabelToPlayer(label, idx, 0.0, 0.0, 0.6);
	}

	return 1;
	
}
then its only working for "/rcon /onduty"

it should be:
pawn Код:
public OnRconCommand(cmd[])
{
    new acmd[256], idx;
    acmd = strtok(cmd, idx);
    if(!strcmp(acmd,"onduty",true))
    {
        new tmp[256];
        tmp = strtok(acmd,idx);
        if(!strlen(tmp))
            print("Usage: /RCON onduty <playerid>");
            return 1;
        }
        else if(!IsPlayerConnected(strval(tmp)))
            print("Error: player not found!");
            return 1;
        }
        new Text3D:label = Create3DTextLabel("Admin On Duty", 0x990000FF, 0.0, 0.0, 0.0, 0.0, 0);
        Attach3DTextLabelToPlayer(label, strval(tmp), 0.0, 0.0, 0.6);
        // your codes here
        return 1;
    }
    return 0;
}
Note: not tested, i hope it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)