SA-MP Forums Archive
Trying to log all the admin commands error - 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: Trying to log all the admin commands error (/showthread.php?tid=97412)



Trying to log all the admin commands error - MisterTickle - 14.09.2009

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?


Re: Trying to log all the admin commands error - Correlli - 14.09.2009

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,



Re: Trying to log all the admin commands error - MisterTickle - 14.09.2009

Код:
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.


Re: Trying to log all the admin commands error - Correlli - 14.09.2009

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.


Re: Trying to log all the admin commands error - MisterTickle - 14.09.2009

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


Re: Trying to log all the admin commands error - Correlli - 14.09.2009

You're welcome.