SA-MP Forums Archive
help! invalid function or declaration - 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: help! invalid function or declaration (/showthread.php?tid=229135)



help! invalid function or declaration - Dennis_Smith - 21.02.2011

I can't figure out why I keep getting this error
Quote:

error 010: invalid function or declaration

I am using the line to open a gate. Hopefully One of you can figure out what's wrong here.

This is the section of the script:

Код:
	if (strcmp("/opengate", cmdtext, true, 10) == 0)
	
	MoveObject (Gate, 808.36328125,842.77441406,6.87612963, 1);
	
	return 1;
	}
Here is the line I am having the error with:

Код:
if (strcmp("/opengate", cmdtext, true, 10) == 0)



Re: help! invalid function or declaration - (SF)Noobanatior - 21.02.2011

Код:
if (strcmp("/opengate", cmdtext, true, 10) == 0)return MoveObject (Gate, 808.36328125,842.77441406,6.87612963, 1);
thatt should do it


Re: help! invalid function or declaration - Dennis_Smith - 21.02.2011

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
Код:
if (strcmp("/opengate", cmdtext, true, 10) == 0)return MoveObject (Gate, 808.36328125,842.77441406,6.87612963, 1);
thatt should do it
ok thanks for that much!

Next! lol Im getting the same error for closing the gate on the last two lines. (closing the gate and return 1)

Код:
	if (strcmp("/opengate", cmdtext, true, 10) == 0)return MoveObject (Gate, 808.36328125,842.77441406,6.87612963, 1);
	
	return 1;
	}
	
	if (strcmp("/closegate", cmdtext, true, 10) == 0)return MoveObject (Gate, 808.36328125,842.77441406,10.42612743, 1);

	return 1;
	}



Re: help! invalid function or declaration - austin070 - 21.02.2011

pawn Код:
if(strcmp("/opengate", cmdtext, true, 10) == 0)
    {
        MoveObject (Gate, 808.36328125,842.77441406,6.87612963, 1);
        return 1;
    }
    if (strcmp("/closegate", cmdtext, true, 10) == 0)
    {
        MoveObject(Gate, 808.36328125,842.77441406,10.42612743, 1);
        return 1;
    }
That's an easier way to do it, in my opinion.


Re: help! invalid function or declaration - Dennis_Smith - 21.02.2011

never mind guys i got it. thx for the help though. i had to get rid of the first return 1;