String ends up in a blanco line.
#1

Good morning everyone,
Well, I've been trying to fix this the whole morning..
But I just cant get it fixed.

I hope somebody could help me by this one..

Well, i've tried to add the ''Admin Level number'', into the admin rank names.. when using /makemapper & /makeadmin..
But it ended up like shit..
When i do /makeadmin & /makemapper, it just shows an blanco line INGAME.

This is the code.


/makemapper
Код:
CMD:makemapper(playerid, params[])
{
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] >= 6 || PlayerInfo[playerid][pMapper] >= 5)
	{
	    new playerb, admin, string[128], string2[128];
	    if(sscanf(params, "ui", playerb, admin)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /makemapper [playerid] [level]");
		if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
		if(admin < 0 || admin > 5) return SendClientMessage(playerid, COLOR_GREY, "Mapper levels are between 1 and 5.");
	    if(PlayerInfo[playerb][pMapper] != admin)
	    {
	        new log[256];
	        PlayerInfo[playerb][pMapper] = admin;
		    if(PlayerInfo[playerb][pMapper] < admin)
			{
		    	format(string, sizeof(string), "AdmWarn: %s %s has {33AA33}promoted {AA3333}%s to {33AA33}%s",RPALN(playerid), RPN(playerid), RPN(playerb), RPALN(playerb));
    		    format(string2, sizeof(string2), "MapperWarn: %s %s has {33AA33}promoted {AA3333}%s to {33AA33}%s",RPALN(playerid), RPN(playerid), RPN(playerb), RPALN(playerb));
            	format(log, sizeof(log), "AdmWarn: %s %s (%s) has promoted %s (%s) to level %d Mapper.",RPALN(playerid), RPN(playerid), RPIP(playerid), RPN(playerb), RPIP(playerb), admin);
			}
			else if(PlayerInfo[playerb][pMapper] > admin)
			{
	  	    	format(string, sizeof(string), "AdmWarn: %s %s has {FF9900}demoted {AA3333}%s to {FF9900}%s",RPALN(playerid), RPN(playerid), RPN(playerb), RPALN(playerb));
	  	    	format(string2, sizeof(string2), "MapperWarn: %s %s has {FF9900}demoted {AA3333}%s to {FF9900}%s",RPALN(playerid), RPN(playerid), RPN(playerb), RPALN(playerb));
	  	    	format(log, sizeof(log), "AdmWarn: %s %s (%s) has demoted %s (%s) to level %d Mapper.",RPALN(playerid), RPN(playerid), RPIP(playerid), RPN(playerb), RPIP(playerb), admin);
			}
			Log("logs/makehelper.log", log);
			SendAdminMessage(COLOR_DARKRED, 1, string);
			SendMapperMessage(COLOR_DARKRED, 1, string2);
			if(!PlayerInfo[playerb][pMapper])
			{
			    SendClientMessage(playerb, COLOR_DARKRED, string2);
			}
		}
		else SendClientMessage(playerid, COLOR_GREY, "Player already has this Mapper level.");
	}
	else
	{
	    SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}
/makeadmin
Код:
CMD:makeadmin(playerid, params[])
{
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
	if(PlayerInfo[playerid][pAdmin] >= 7)
	{
	    new playerb, admin, string[128];
	    if(sscanf(params, "ui", playerb, admin)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /makeadmin [playerid] [level]");
		if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
		if(admin < 0 || admin > 8) return SendClientMessage(playerid, COLOR_GREY, "Admin levels are between 1-8");
	    if(PlayerInfo[playerb][pAdmin] != admin)
	    {
	        new log[256];
	        PlayerInfo[playerb][pAdmin] = admin;
		    if(PlayerInfo[playerb][pAdmin] < admin)
			{
		    	format(string, sizeof(string), "AdmWarn: %s %s has {33AA33}promoted {AA3333}%s to {33AA33}%s",RPALN(playerid), RPN(playerid), RPN(playerb), RPALN(playerb));
            	format(log, sizeof(log), "AdmWarn: %s %s (%s) has promoted %s (%s) to %s",RPALN(playerid), RPN(playerid), RPIP(playerid), RPN(playerb), RPIP(playerb), RPALN(playerb));
			}
			else if(PlayerInfo[playerb][pAdmin] > admin)
			{
	  	    	format(string, sizeof(string), "AdmWarn: %s %s has {FF9900}demoted {AA3333}%s to {FF9900}%s {AA3333}.",RPALN(playerid), RPN(playerid), RPN(playerb), RPALN(playerb));
	  	    	format(log, sizeof(log), "AdmWarn: %s %s (%s) has demoted %s (%s) to %s",RPALN(playerid), RPN(playerid), RPIP(playerid), RPN(playerb), RPIP(playerb), RPALN(playerb));
			}
			Log("logs/makeadmin.log", log);
			PlayerInfo[playerb][pSafeAdmin] = 1;
			SendAdminMessage(COLOR_DARKRED, 1, string);
			if(!PlayerInfo[playerb][pAdmin])
			{
			    PlayerInfo[playerb][pSafeAdmin] = 0;
			    PlayerInfo[playerid][pGangMod] = 0;
			    PlayerInfo[playerid][pFacMod] = 0;
			    PlayerInfo[playerid][pBanAppealer] = 0;
			    SendClientMessage(playerb, COLOR_DARKRED, string);
			}
			new file[32];
			format(file, sizeof(file), "users/%s.ini", RPNU(playerb));
			format(file, sizeof(file), "users/%s.ini", dini_Get(file, "AdminName"));
			if(dini_Exists(file))
			{
				dini_IntSet(file, "Admin", PlayerInfo[playerb][pAdmin]);
			}
			format(file, sizeof(file), "users/%s.ini", RPNU(playerb));
			if(dini_Int(file, "AdminAccount") == 1)
			{
			    format(file, sizeof(file), "users/%s.ini", dini_Get(file, "OldName"));
			    dini_IntSet(file, "Admin", PlayerInfo[playerb][pAdmin]);
			}
		}
		else SendClientMessage(playerid, COLOR_GREY, "Player already has this admin level.");
	}
	else
	{
	    SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	return 1;
}
This is the (stock) for Admin/Mapper names.

Код:
stock RPALN(playerid)
{
	new name[32];
	if(PlayerInfo[playerid][pAdmin] == 1) format(name, sizeof(name), "Trial Moderator");
	else if(PlayerInfo[playerid][pAdmin] == 2) format(name, sizeof(name), "Server Moderator");
	else if(PlayerInfo[playerid][pAdmin] == 3) format(name, sizeof(name), "Junior Administrator");
	else if(PlayerInfo[playerid][pAdmin] == 4) format(name, sizeof(name), "General Administrator");
	else if(PlayerInfo[playerid][pAdmin] == 5) format(name, sizeof(name), "Senior Administrator");
	else if(PlayerInfo[playerid][pAdmin] == 6) format(name, sizeof(name), "Executive Administrator");
	else if(PlayerInfo[playerid][pAdmin] == 7) format(name, sizeof(name), "Community Owner");
	else if(PlayerInfo[playerid][pAdmin] == 8) format(name, sizeof(name), "Community Developer");
	else if(PlayerInfo[playerid][pMapper] == 1) format(name, sizeof(name), "Trial Mapper");
	else if(PlayerInfo[playerid][pMapper] == 2) format(name, sizeof(name), "General Mapper");
	else if(PlayerInfo[playerid][pMapper] == 3) format(name, sizeof(name), "Senior Mapper");
	else if(PlayerInfo[playerid][pMapper] == 4) format(name, sizeof(name), "Asst. Head mapper");
	else if(PlayerInfo[playerid][pMapper] == 5) format(name, sizeof(name), "Head Mapper");
	return name;
}
Reply
#2

Bump
Reply
#3

Which SendClientMessage is failing EXACTLY?
Reply
#4

All of them, They got blanco after i editted the String lines..
Reply
#5

Increase the length of the strings.

IE, string[128];
TO, string[256];

See if that works.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)