SA-MP Forums Archive
error 035: argument type mismatch (argument 1)?? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 035: argument type mismatch (argument 1)?? (/showthread.php?tid=131090)



error 035: argument type mismatch (argument 1)?? - Naxix - 01.03.2010

Hey there!

I was makeing a timer to kick a player if they have more than 0 cash.
But i get those 2 errors:

Код:
(256) : error 035: argument type mismatch (argument 1)
(259) : error 035: argument type mismatch (argument 1)
Of top of my script:

Код:
forward moneyhack(i);
on public OnFilterScriptInit():

Код:
SetTimer("moneyhack",1000,1);
Bottom of script:

Код:
public moneyhack()
{
	new cash;
	for(new i=0; i < MAX_PLAYERS; i++)
	cash = GetPlayerMoney("i"); (Line 256)
	if(cash < 0)
	{
	Kick("i"); (Line 259)
	return 1;
	}
	return 1;
}
Any1 know how to to fix this? Also please explain why/how to fix it, as i'm trying to learn how to script

-Naxix



Re: error 035: argument type mismatch (argument 1)?? - Fj0rtizFredde - 01.03.2010

This: GetPlayerMoney("i"); should be: GetPlayerMoney(i); and Kick("i"); should be: Kick(i);



Re: error 035: argument type mismatch (argument 1)?? - Naxix - 01.03.2010

Now it comes up with the error:

Код:
(260) : error 017: undefined symbol "i"
on the line:

Код:
	Kick(i);



Re: error 035: argument type mismatch (argument 1)?? - Fj0rtizFredde - 01.03.2010

Its beacuse you have it outside the loop :P


Re: error 035: argument type mismatch (argument 1)?? - dice7 - 01.03.2010

pawn Код:
public moneyhack()
{
    new cash;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        cash = GetPlayerMoney(i);
        if(cash < 0)
        {
        Kick(i);
        return 1;
        }
    }
    return 1;
}



Re: error 035: argument type mismatch (argument 1)?? - aircombat - 01.03.2010

instead of i , playerid
________
WASHINGTON MEDICAL MARIJUANA DISPENSARY


Re: error 035: argument type mismatch (argument 1)?? - Gozerr - 01.03.2010

Quote:
Originally Posted by [AC
Etch ]
instead of i , playerid
No, Because the for loops through all players with the variable "i"


Re: error 035: argument type mismatch (argument 1)?? - CaHbKo - 01.03.2010

You forward "moneyhack(i)" when your function is called "moneyhack()". Remove the "i" fro the forward.


Re: error 035: argument type mismatch (argument 1)?? - Naxix - 01.03.2010

Thanks every1, the code Dice made it with no errors, tho it dosen't kick a player with 1 dollar+, any1 know why this happens?


Re: error 035: argument type mismatch (argument 1)?? - dice7 - 01.03.2010

because 1 isn't smaller then 0 ?
pawn Код:
if(cash < 0)