SA-MP Forums Archive
ForceClassSelection - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ForceClassSelection (/showthread.php?tid=268684)



ForceClassSelection - zxc1 - 13.07.2011

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



Re: ForceClassSelection - veyron - 13.07.2011

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?


Re: ForceClassSelection - Basicz - 13.07.2011

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".


Re: ForceClassSelection - zxc1 - 13.07.2011

Код:
warning 211: possibly unintended assignment



Re: ForceClassSelection - zxc1 - 13.07.2011

Nevermind fixed it.