error 035: argument type mismatch (argument 1)??
#1

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
Reply
#2

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

Now it comes up with the error:

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

Код:
	Kick(i);
Reply
#4

Its beacuse you have it outside the loop :P
Reply
#5

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

instead of i , playerid
________
WASHINGTON MEDICAL MARIJUANA DISPENSARY
Reply
#7

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

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

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?
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)