VIP CMD error
#6

Quote:
Originally Posted by tboysamp
Посмотреть сообщение
Код:
CMD:viptext(playerid, params[])
{
	static
	    Text[300],
		str[350];

    if(GetPVarInt(playerid,"DonateRank") >= 1)
		return SendClientMessage(playerid, 0xFFFFFF, "You dont have any donator rank");

	if (sscanf(params, "s[300]", Text))
	    return SendClientMessage(playerid, 0xFFFFFF, "/viptext[text]");

    for(new i=0; i < MAX_PLAYERS; i++)
    {
        format(str, sizeof(str), "[VIP CHAT] %s Says: %s", GetName(playerid), Text);
        SendClientMessage(i, 0xFFFFFF, str);
    }
	return 1;
}
Thanks, for helping but it still gives error!

Quote:
Originally Posted by Stinged
Посмотреть сообщение
You shouldn't use sscanf when you only want to use the params as a string, and especially not a string with 300 cells. And you shouldn't create two different strings if you only want to use 1 at a time.
Recycle the same one (Not sure if that's the correct term but meh)

SendClientMessage can only show 128 characters, why would you even need a string with 350 cells..

Код:
CMD:v(playerid, params[])
{
	if(GetPVarInt(playerid, "DonateRank") >= 1)
	{
		if (isnull(params)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /v text");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(GetPVarInt(i, "DonateRank") >= 1)
				{
					new str[128];
					format(str, sizeof(str), "[VIP CHAT] %s Says: %s", GetName(playerid), params);
					SendClientMessage(i, 0xFFFFFFFF, str);
				}
			}
		}
	}
	else SendClientMessage(playerid, 0xFFFFFFFF, "You dont have any donator rank");
	return 1;
}
Thanks to you and it worked for me! +rep for you!!
Reply


Messages In This Thread
VIP CMD error - by LifeRah - 18.05.2016, 02:46
Re: VIP CMD error - by 1fret - 18.05.2016, 02:55
Re: VIP CMD error - by Noris - 18.05.2016, 02:58
Re: VIP CMD error - by tboysamp - 18.05.2016, 03:07
Re: VIP CMD error - by Stinged - 18.05.2016, 03:35
Re: VIP CMD error - by LifeRah - 18.05.2016, 12:04

Forum Jump:


Users browsing this thread: 2 Guest(s)