id problem
#1

As i dont wish to post my whole script here this could be a long shot but every cmd i have that involes a player id doesnt work 100% soon as you go over id3 with a cmd e.g /kick 4 it will kick id 3 no matter what ill post one of my cmds here incase it is something in all the cmds creating the problem.

Код:
CMD:ban(playerid, params[])
{
	if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!");
    if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
	if ( sscanf( params, "us", params[ 0 ] ,params[ 1 ]) )return SendUsage( playerid, "/ban <id> [reason]" );
    if ( !IsPlayerConnected( params[ 0 ] ) )return SendError( playerid, "Player is not connected!");
    if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
	if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
	if( params[ 0 ] == playerid )return SendError( playerid, "You can't ban yourself!");

	FormMessageForAllEx(playerid,COLOR_GREEN, "Administrator %s banned %s from the server! [Reason: %s]",PlayerName2( playerid ), PlayerName2( params[ 0 ] ), params[ 1 ]);
	FormMessage( params[ 0 ], COLOR_GREEN, "Administrator %s banned you! [Reason: %s ]",PlayerName2( playerid ), params[ 1 ]);
	FormMessage( playerid, COLOR_GREEN, "You have banned %s [Reason: %s]",PlayerName2( params[ 0 ] ), params[ 1 ]);
	new gP_FILE[ 256 ];
	format( gP_FILE, 256, "Administration/Users/%s.ini", PlayerName2( params[ 0 ] ));
 	new
		iUID = BUD::GetNameUID( PlayerName2( params[ 0 ] ) )
	;
	BUD::SetIntEntry( iUID, "Banned", 1 );


	new iString[ 256 ],Y,M,D,H,Mi,File:FILE;
	getdate( Y, M, D );
	gettime( H, Mi );
	format( iString,    258, "===============================================\r\n\
							  Admin: %s\r\n\
  						      Level: %d\r\n\
							  Player: %s\r\n\
							  Date: %d/%d/%d at %d:%d\r\n\
							  Reason: %s\r\n\
							  ===============================================\r\n\r\n\r\n",
							  PlayerName2( playerid ),
							  P_DATA[ playerid ][ P_Level ],
							  PlayerName2( params[ 0 ] ),
							  D,
							  M,
							  Y,
							  H,
							  Mi,
							  params[ 1 ] );


	FILE = fopen(SlogBan, io_append);
	if (FILE)
	{
		fwrite(FILE, iString);
		fclose(FILE);
	}
	Ban(params[0]);
	return 1;
}
Any help would be great as it is a really big problem right now.
Many Thanks.
Reply
#2

If you're using 0.3d you need to replace u with d in sscanf.
Reply
#3

Thankyou so much all working now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)