SA-MP Forums Archive
VIP CMD error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: VIP CMD error (/showthread.php?tid=607322)



VIP CMD error - LifeRah - 18.05.2016

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


Re: VIP CMD error - 1fret - 18.05.2016

would be easier if you show us the line with the error


Re: VIP CMD error - Noris - 18.05.2016

Can you post what code is that line.


Re: VIP CMD error - tboysamp - 18.05.2016

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



Re: VIP CMD error - Stinged - 18.05.2016

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



Re: VIP CMD error - LifeRah - 18.05.2016

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!!