VIP CMD error
#1

I am making this cmd so that VIPS can talk to each other:-
PHP код:
CMD:v(playeridparams[])
{
new 
Text[300];
if(
GetPVarInt(playerid,"DonateRank") >= 1)
{
if(
sscanf(params"s[300]"Text)) return SendClientMessage(playerid0xFFFFFF"USAGE: /v text");
for(new 
i=0MAX_PLAYERSi++)
{
if(
IsPlayerConnected(i))
{
if(
GetPVarInt(i,"DonateRank") >= 1)
{
new 
str[350];
format(strsizeof(str), "[VIP CHAT] %s Says: %s"GetName(playerid), Text);
SendClientMessage(i0xFFFFFFstr);
}
}
}
}
else 
SendClientMessage(playerid0xFFFFFF"You dont have any donator rank");
return 
1;

But I am getting this error:-
PHP код:
D:\farhan\ARP.pwn(1293) : error 035argument type mismatch (argument 1
Kindly tell me how to fix it
Reply
#2

would be easier if you show us the line with the error
Reply
#3

Can you post what code is that line.
Reply
#4

Код:
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;
}
Reply
#5

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;
}
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)