Another Problem
#1

I was trying to make an economy system for my flterscript which uses commands: /eco <give/reset/set>, and i get a tag mismatch error, heres my codes, the tag mismatch errors goes to the GiveMoney.
Код:
CMD:eco(playerid, params[])
{
	new targetid;
	new amount[MAX_MONEY];
	new selection[5];
    if(!strcmp(selection,"give", true))
    {
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Error: Specified player is not connected.");
		{
		    if(!sscanf(amount, "i", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /eco give <playerid> <amount>");
			{
				GiveMoney(targetid, amount);
			}
		}
	}
	else if(!strcmp(selection,"set", true))
	{
	    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Error: Specified player is not connected.");
		{
		    if(!sscanf(amount, "i", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /eco set <playerid> <amount>");
			{
			    ResetPlayerMoney(playerid);
				GiveMoney(targetid, amount);
			}
		}
	}
	else if(!strcmp(selection,"reset", true))
	{
	    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Error: Specified player is not connected.");
		{
			ResetPlayerMoney(playerid);
		}
	}
	else
	{
	    SendClientMessage(playerid, -1, "[USAGE]: /eco <set/give/reset>");
	    return 1;
	}
	return 1;
}
GiveMoney Function
Код:
stock GiveMoney(playerid, money)
{
	ResetPlayerMoney(playerid);
	GivePlayerMoney(playerid, money);
	return 1;
}
Reply
#2

Change
PHP код:
new amount[MAX_MONEY]; 
to
PHP код:
new amount
Reply
#3

now its arguemnt one.
Reply
#4

You should change the "amount" to "params" on all "if(!sscanf"

For example:
PHP код:
if(!sscanf(params"id"targetidamount)) return SendClientMessage(playerid, -1"[USAGE]: /eco set <playerid> <amount>"); 
Reply
#5

the type mismatch arguement 1
Reply
#6

Quote:
Originally Posted by Escobabe
Посмотреть сообщение
You should change the "amount" to "params" on all "if(!sscanf"

For example:
PHP код:
if(!sscanf(params"id"targetidamount)) return SendClientMessage(playerid, -1"[USAGE]: /eco set <playerid> <amount>"); 
but this is a wrong syntax, it must be if(sscanf(....
PHP код:
if(sscanf(params"id"targetidamount)) return SendClientMessage(playerid, -1"[USAGE]: /eco set <playerid> <amount>");
//or
//=====================================================//
if(!sscanf(params"id"targetidamount)) 
{
//perform the function
}
else
{
SendClientMessage(playerid, -1"[USAGE]: /eco set <playerid> <amount>"); 
return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)