Trying to log all the admin commands error
#1

Whole Code:

Код:
dcmd_oaccban(playerid,params[]) {
  if(PlayerInfo[playerid][pAdmin] == 0) return SystemMsg(playerid, "You must be a admin to use this command!");
  if(!strlen(params)) return SystemMsg(playerid, "/oaccban [playername]");
  if(IsNumeric(params)) return SystemMsg(playerid, "That player is not connected!");
  new player2[128]; format(player2, sizeof(player2), params);
  if(!udb_Exists(player2)) {
  SystemMsg(playerid, "Account does not exist");
  }
  else {
  new file[128];format(file,sizeof(file),"%s.dudb.sav",udb_encode(player2));
  dini_IntSet(file, "pBanned", 1);
  SystemMsg(playerid, "The selected user has been banned");
  	new str2[MAX_STRING], second, minute, hour, day, month, year;
  	gettime(hour, minute, second);
	getdate(year, month, day);
  format(str2, sizeof(str2), "ADMIN %s offline account banned %s on %d/%d/%d at %d:%d:%d.)", PlayerName(playerid), PlayerName(player2), month, day, year, hour, minute, second);
  ServerLog(str2);
  return 1;
  }
  return 1;
  }
Line Erroring:

Код:
format(str2, sizeof(str2), "ADMIN %s offline account banned %s on %d/%d/%d at %d:%d:%d.)", PlayerName(playerid), PlayerName(player2), month, day, year, hour, minute, second);
Error

C:\Documents and Settings\.pwn(873) : error 035: argument type mismatch (argument 1)

Works fine on everything else so whats the problem?
Reply
#2

pawn Код:
format(str2, sizeof(str2), "ADMIN %s offline account banned %s on %d/%d/%d at %d:%d:%d.)", PlayerName(playerid), PlayerName(player2), month, day, year, hour, minute, second);
As i see player2 is a string, and PlayerName is function to get the player's name from playerid, not from a playername.
Just change:
pawn Код:
PlayerName(player2),
to:
pawn Код:
player2,
Reply
#3

Код:
stock PlayerName(playerid) {
	new playerName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
	return playerName;
}
Don't believe this is the problem, This is used in every other log and they work fine.
Reply
#4

Quote:
Originally Posted by MisterTickle
Don't believe this is the problem, This is used in every other log and they work fine.
Re-read my post again and you'll see what i mean.
Reply
#5

Ok you were right, It worked. Thank you for your help.
Reply
#6

You're welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)