ForceClassSelection
#1

I'm trying to make an admin command.
When admin type /class [playerid] it will kill the selected player and force him to the class selection....
Can someone help me with the command?

Код:
command(class, playerid, params[])
{
	new ID;
	if(AdminLevel[playerid] == 1337)
	if(sscanf(params, "i", ID))
	{
	    SendClientMessage(playerid, Red, "Usage: /class (playerid)");
	    return 1;
	}
	ForceClassSelection(playerid);
    SetPlayerHealth(playerid,0);
	return 1;
}
Reply
#2

for ForceCl.... and SetPlayerHealth you should use ID instead of playerid, because you want this to work on inserted player id. Have you tryed your code and what does it do wrong?
Reply
#3

pawn Код:
CMD:class( playerid, params[ ] ) {
    new
        id
    ;

    if ( AdminLevel[ playerid ] != 1337 )
        return SendClientMessage( playerid, -1, "You are not l33t." );

    if ( sscanf( params, "u", id ) )
        return SendClientMessage( playerid, -1, "Usage: /class [ playerid / partOfName ]" );

    if ( id = INVALID_PLAYER_ID )
        return SendClientMessage( playerid, -1, "Invalid player." );

    SendClientMessage( id, -1, "You have been forced to the class selection by a l33t admin." );

    ForceClassSelection( id ):
    SetPlayerHealth( id, 0.0 );

    return 1;
}
TIP:

Use "u" for players ( sscanf ),
it will detect if the player entered an ID,
or a partOfName ( e.G: Basicz ), can be used as "/class bas".
Reply
#4

Код:
warning 211: possibly unintended assignment
Reply
#5

Nevermind fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)