SA-MP Forums Archive
help with creating rcon command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with creating rcon command (/showthread.php?tid=326911)



help with creating rcon command - Dennis_Smith - 19.03.2012

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;
	
}



Re: help with creating rcon command - RoboN1X - 19.03.2012

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