a question.
#1

i made this command
Код:
		if(strcmp(cmd, "/ame", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
	            return 1;
	        }
	        if(PlayerInfo[playerid][pMuted] == 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
				return 1;
			}
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ame [action]");
				return 1;
			}
		 	AmeLabel[playerid] = Create3DTextLabel("%s",0xFF000099,0,0,0,50,-1,1);
			Attach3DTextLabelToPlayer(AmeLabel[playerid], playerid,0,0,0);
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] [/AME] %s: %s",d,m,y,h,mi,s,sendername,giveplayer, result);
			ActionLog(string);
		}
		return 1;
	}
I wanted to make that command to be like when the player types /ame [Text] the text he types appears on his head but when he types anything it just appears as %s
Код:
		 	AmeLabel[playerid] = Create3DTextLabel("%s",0xFF000099,0,0,0,50,-1,1);
and i can only type things on the script and it appear when they type but i actually want that when the player types it appears. any ideas?
Reply
#2

It appears as %s because that's what you put in quotations in the const text[] parameter in Create3DTextLabel
Reply
#3

Quote:
Originally Posted by viddo
Посмотреть сообщение
i made this command
Код:
		if(strcmp(cmd, "/ame", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
	            return 1;
	        }
	        if(PlayerInfo[playerid][pMuted] == 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
				return 1;
			}
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ame [action]");
				return 1;
			}
		 	AmeLabel[playerid] = Create3DTextLabel("%s",0xFF000099,0,0,0,50,-1,1);
			Attach3DTextLabelToPlayer(AmeLabel[playerid], playerid,0,0,0);
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] [/AME] %s: %s",d,m,y,h,mi,s,sendername,giveplayer, result);
			ActionLog(string);
		}
		return 1;
	}
I wanted to make that command to be like when the player types /ame [Text] the text he types appears on his head but when he types anything it just appears as %s
Код:
		 	AmeLabel[playerid] = Create3DTextLabel("%s",0xFF000099,0,0,0,50,-1,1);
and i can only type things on the script and it appear when they type but i actually want that when the player types it appears. any ideas?
% specifiers (or normal specifiers) are (and can) only be used in functions that expect a pattern format or formatting functions, for example see the wiki format() function and have a look at sscanf() (look in plugins section), that will definetly help you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)