Help with making a timer for /ame
#5

Quote:
Originally Posted by NickMirra
Посмотреть сообщение
Hello, Tessa in game do you know how can i show the playername, I modified it alittle and it is at this now,

Код:
CMD:ame(playerid, params[])
{
    new activewep = GetPVarInt(playerid, "activesling");
	new message[100], string[128];
	if(sscanf(params, "s[100]", message))
		return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /ame [action]");

	if(activewep > 0)
	    return SendClientMessageEx(playerid, COLOR_GRAD2, "  You have a weapon slung around your back, you can't use /ame.");

	if(strlen(message) > 100) return SendClientMessageEx(playerid, COLOR_GRAD2, "  The action is too long, please reduce the length.");
	if(strlen(message) < 3) return SendClientMessageEx(playerid, COLOR_GRAD2, "  The action is too short, please increase the length.");

	format(string, sizeof(string), "--> %s", message);
 	SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 7.0, 10000);
  	format(string, sizeof(string), "--> %s", message);
   	SendClientMessageEx(playerid, COLOR_PURPLE, string);
   	return 1;
}
Hello, with showing the name, I assume its before the "-->"? If so, the following code should do the trick:

Код:
CMD:ame(playerid, params[])
{
    new activewep = GetPVarInt(playerid, "activesling");
	new message[100], string[128];
	if(sscanf(params, "s[100]", message))
		return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /ame [action]");

	if(activewep > 0)
	    return SendClientMessageEx(playerid, COLOR_GRAD2, "  You have a weapon slung around your back, you can't use /ame.");

	if(strlen(message) > 100) return SendClientMessageEx(playerid, COLOR_GRAD2, "  The action is too long, please reduce the length.");
	if(strlen(message) < 3) return SendClientMessageEx(playerid, COLOR_GRAD2, "  The action is too short, please increase the length.");

	format(string, sizeof(string), "%s --> %s", pName(playerid), message);
 	SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 10.0, 7000);
  	format(string, sizeof(string), "%s --> %s", pName(playerid), message);
   	SendClientMessageEx(playerid, COLOR_PURPLE, string);
   	return 1;
}
I added another %s and I used pName(playerid) to get the name.
Now most likely, it's going to error that it doesn't know what pName is.. if you indeed get an error, you can place the following code anywhere in the script (Preferred somewhere at the bottom).

Also make sure you don't have a similar function inside your script already.

Код:
pName(playerid)
{
	new pname[24];
	GetPlayerName(playerid,pname,24);
	return pname;
}
Kind regards.
Reply


Messages In This Thread
Help with making a timer for /ame - by NickMirra - 21.05.2015, 19:46
Re: Help with making a timer for /ame - by Tessa - 21.05.2015, 20:11
Re: Help with making a timer for /ame - by NickMirra - 21.05.2015, 20:15
Re: Help with making a timer for /ame - by NickMirra - 21.05.2015, 20:36
Re: Help with making a timer for /ame - by Tessa - 21.05.2015, 21:09

Forum Jump:


Users browsing this thread: 2 Guest(s)