Programming problem :(
#1

I want to create car race in my server, i tryed and now i know what to do, but i don't know why i'm getting these errors:
Код:
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(54) : error 055: start of function body without function header
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : error 017: undefined symbol "cp1"
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : warning 215: expression has no effect
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
And off course you will need to know these lines so 54th line is:
Код:
53.COMMAND:lenktynes(playerid, params[]);
54.{
55.cp1[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2334.7681,-2179.3489,35.1945,
-2143.2742,-2006.9039,95.0157, 7);
56.}
And 152th is:

Код:
if (cp1[playerid] == 1)
Reply
#2

This is a syntax problem, look

53.COMMAND:lenktynes(playerid, params[]);

Take the ; out from the end.
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
This is a syntax problem, look

53.COMMAND:lenktynes(playerid, params[]);

Take the ; out from the end.
Thank you man, but there's still 4 errors and i don't know what's wrong there in 152 line.cp1 is defined in the top of pawno file, so why pawno explain to me that it's not defined?
Reply
#4

Well can you show me the rest of the code? And how you are initializing the cp variable?
Reply
#5

So this is all code of my checkpoints(starting with line 150 and end on line 246):
Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
	if (cp1[playerid] == 1)
   	{
   	race2[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2143.2742,-2006.9039,95.0157, -2145.5430,-1958.8540,117.9665, 9);
   	cp1[playerid] = -1;
   	}
   	else if (cp2[playerid] == 1)
   	{
   	cp3[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2145.5430,-1958.8540,117.9665, -2474.9404,-2077.9385,124.7880, 9);
   	cp2[playerid] = -1;
	}
   	else if(cp3[playerid] == 1)
	{
   	cp4[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2474.9404,-2077.9385,124.7880, -2769.8372,-1811.5950,141.6222, 9);
   	cp3[playerid] = -1;
	{
   	else if(cp4[playerid] == 1)
	}
	cp5[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2769.8372,-1811.5950,141.6222, -2753.8965,-1423.9955,140.5477, 9);
	cp4[playerid] = -1;
	{
	else if(cp5[playerid] == 1)
	}
	cp6[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2753.8965,-1423.9955,140.5477, -2569.9482,-1144.0555,173.2845, 9);
	cp5[playerid] = -1;
	{
	else if(cp6[playerid] == 1)
	}
	cp7[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2569.9482,-1144.0555,173.2845, -2609.3975,-1253.1088,214.2582, 9);
	cp6[playerid] = -1;
	{
	else if(cp7[playerid] == 1)
	}
	cp8[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2609.3975,-1253.1088,214.2582, -2370.8142,-1287.0472,304.5167, 9);
	cp7[playerid] = -1;
	{
	else if(cp8[playerid] == 10
	}
	cp9[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2370.8142,-1287.0472,304.5167, -2575.7139,-1495.2600,358.8549, 9);
	cp8[playerid] = -1;
	{
	else if(cp9[playerid] == 1)
	}
	cp10[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2575.7139,-1495.2600,358.8549, -2219.7107,-1495.7971,358.5630, 9);
	cp9[playerid] = -1;
	...
    {
	else if(cp10[playerid] == 1)
	}
	cp11[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2219.7107,-1495.7971,358.5630, -2217.4817,-1706.1759,376.4216, 9);
	cp10[playerid] = -1;
	{
	else if(cp11[playerid] == 1)
	}
	cp12[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2217.4817,-1706.1759,376.4216, -2335.3481,-1449.7220,382.4081, 9);
	cp11[playerid] = -1;
	{
	else if(cp12[playerid] == 1)
	}
	cp13[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2335.3481,-1449.7220,382.4081, -2514.5911,-1586.6542,396.9291, 9);
	cp12[playerid] = -1;
	{
	else if(cp13[playerid] == 1)
	}
	cp14[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2514.5911,-1586.6542,396.9291, -2433.9897,-1801.9481,410.8483, 9);
	cp13[playerid] = -1;
	{
	else if(cp14[playerid] == 1)
	}
	cp15[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2433.9897,-1801.9481,410.8483, -2283.3738,-1713.6462,474.5872, 9);
	cp14[playerid] = -1;
	{
	else if(cp15[playerid] == 1)
	}
	cp16[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2283.3738,-1713.6462,474.5872, -2329.8938,-1607.2220,483.5648, 9);
	cp15[playerid] = -1;
	{
	else if(cp16[playerid] == 1)
	}
	cp17[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2329.8938,-1607.2220,483.5648, , 9);
	cp16[playerid] = -1;
	{
	else if(cp17[playerid] == 1)
	}
	cp18[playerid] = SetPlayerRaceCheckpoint(playerid, 1, -2329.8938,-1607.2220,483.5648, 0.0,0.0,0.0, 9);
	cp17[playerid] = -1;
	{
	else if(cp18[playerid] == 1)
	}
	DisablePlayerRaceCheckpoint(playerid);
	GameTextForPlayer(playerid, "Tu esi pagydytas" ,1000,2);
		SetPlayerHealth(playerid, 100);
	race4[playerid] = -1;
    {
	return 1;
}
And this is my defined checkpoints(starting from line 8 and end on 27th line):
Код:
#if defined FILTERSCRIPT

new cp1[MAX_PLAYERS],
new cp2[MAX_PLAYERS],
new cp3[MAX_PLAYERS],
new cp4[MAX_PLAYERS],
new cp5[MAX_PLAYERS],
new cp6[MAX_PLAYERS],
new cp7[MAX_PLAYERS],
new cp8[MAX_PLAYERS],
new cp9[MAX_PLAYERS],
new cp10[MAX_PLAYERS],
new cp11[MAX_PLAYERS],
new cp12[MAX_PLAYERS],
new cp13[MAX_PLAYERS],
new cp14[MAX_PLAYERS],
new cp15[MAX_PLAYERS],
new cp16[MAX_PLAYERS],
new cp17[MAX_PLAYERS],
new cp18[MAX_PLAYERS];
And that's the last code, which start the race:
Код:
COMMAND:lenktynes(playerid, params[])
{
cp1[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2334.7681,-2179.3489,35.1945, -2143.2742,-2006.9039,95.0157, 7);
}
So that's everything what i wrote and that should be alright, so where's the problem?

P.S. and now i get these errors:
Код:
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : error 017: undefined symbol "cp1"
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : warning 215: expression has no effect
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(152) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

So can someone help me or not, I know that there is many great programmers and if they look into my problem it look for them like a joke
Reply
#7

Please people, it's only some errors and this thread is going lower and lower I'm so sad :P
Reply
#8

You have a lot of errors in the line 152 you have forget a ; and there is an invalid expression please read the errors and try to know what is the problem this is the best way to learn
Reply
#9

Quote:
Originally Posted by Miado_Hulk
Посмотреть сообщение
You have a lot of errors in the line 152 you have forget a ; and there is an invalid expression please read the errors and try to know what is the problem this is the best way to learn
Don't be stupid!This forum is support site, so it's not helping when you saying to find problem and fix it myself.Better don't write if you don't know what to write and only want to rise your post number.I already was looking for the problem many times, but I can't find it myself.So I asking you people for help, isn't it so simple to understand?!

So now i changed a bit my previous code and now it's like this(under " public OnPlayerEnterRaceCheckpoint(playerid")This code is from 130 to 224 line:
Код:
{
	if (cp1[playerid] == 1)
	{
	cp2[playerid] = SetPlayerRaceCheckpoint(playerid, -2143.2742,-2006.9039,95.0157, -2145.5430,-1958.8540,117.9665, 9);
	cp1[playerid] = -1;
    }
   	else if (cp2[playerid] == 1)
   	{
   	cp3[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2145.5430,-1958.8540,117.9665, -2474.9404,-2077.9385,124.7880, 9);
   	cp2[playerid] = -1;
	}
   	else if(cp3[playerid] == 1)
	{
   	cp4[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2474.9404,-2077.9385,124.7880, -2769.8372,-1811.5950,141.6222, 9);
   	cp3[playerid] = -1;
	{
   	else if(cp4[playerid] == 1)
	}
	cp5[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2769.8372,-1811.5950,141.6222, -2753.8965,-1423.9955,140.5477, 9);
	cp4[playerid] = -1;
	{
	else if(cp5[playerid] == 1)
	}
	cp6[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2753.8965,-1423.9955,140.5477, -2569.9482,-1144.0555,173.2845, 9);
	cp5[playerid] = -1;
	{
	else if(cp6[playerid] == 1)
	}
	cp7[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2569.9482,-1144.0555,173.2845, -2609.3975,-1253.1088,214.2582, 9);
	cp6[playerid] = -1;
	{
	else if(cp7[playerid] == 1)
	}
	cp8[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2609.3975,-1253.1088,214.2582, -2370.8142,-1287.0472,304.5167, 9);
	cp7[playerid] = -1;
	{
	else if(cp8[playerid] == 1)
	}
	cp9[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2370.8142,-1287.0472,304.5167, -2575.7139,-1495.2600,358.8549, 9);
	cp8[playerid] = -1;
	{
	else if(cp9[playerid] == 1)
	}
	cp10[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2575.7139,-1495.2600,358.8549, -2219.7107,-1495.7971,358.5630, 9);
	cp9[playerid] = -1;
    {
	else if(cp10[playerid] == 1)
	}
	cp11[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2219.7107,-1495.7971,358.5630, -2217.4817,-1706.1759,376.4216, 9);
	cp10[playerid] = -1;
	{
	else if(cp11[playerid] == 1)
	}
	cp12[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2217.4817,-1706.1759,376.4216, -2335.3481,-1449.7220,382.4081, 9);
	cp11[playerid] = -1;
	{
	else if(cp12[playerid] == 1)
	}
	cp13[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2335.3481,-1449.7220,382.4081, -2514.5911,-1586.6542,396.9291, 9);
	cp12[playerid] = -1;
	{
	else if(cp13[playerid] == 1)
	}
	cp14[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2514.5911,-1586.6542,396.9291, -2433.9897,-1801.9481,410.8483, 9);
	cp13[playerid] = -1;
	{
	else if(cp14[playerid] == 1)
	}
	cp15[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2433.9897,-1801.9481,410.8483, -2283.3738,-1713.6462,474.5872, 9);
	cp14[playerid] = -1;
	{
	else if(cp15[playerid] == 1)
	}
	cp16[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2283.3738,-1713.6462,474.5872, -2329.8938,-1607.2220,483.5648, 9);
	cp15[playerid] = -1;
	{
	else if(cp16[playerid] == 1)
	}
	cp17[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2329.8938,-1607.2220,483.5648, , 9);
	cp16[playerid] = -1;
	{
	else if(cp17[playerid] == 1)
	}
	cp18[playerid] = SetPlayerRaceCheckpoint(playerid, 1, -2329.8938,-1607.2220,483.5648, 0.0,0.0,0.0, 9);
	cp17[playerid] = -1;
	{
	else if(cp18[playerid] == 1)
	}
	DisablePlayerRaceCheckpoint(playerid);
	GameTextForPlayer(playerid, "Tu esi pagydytas" ,1000,2);
		SetPlayerHealth(playerid, 100);
	race4[playerid] = -1;
    {
	return 1;
}
Under "public OnPlayerCommandText(playerid, cmdtext[])"This code is from 96 to 102 line:
Код:
{
    if (strcmp("/race", cmdtext, true, 4) == 0)
	{
	cp1[playerid] = SetPlayerRaceCheckpoint(playerid, -2334.7681,-2179.3489,35.1945, -2143.2742,-2006.9039,95.0157, 9);
	return 1;
	}
}
And in the top of file, there is my defined checkpoints(This is 8th line):
Код:
new cp[19][MAX_PLAYERS];
And I get the same errors like earlier:
Код:
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(99) : error 017: undefined symbol "cp1"
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(99) : warning 215: expression has no effect
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(99) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(99) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(99) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
So what I need to fix to solve this shit?!I'm very nervous@@@@@@@@@
Reply
#10

Put the numbers in square brackets now that you're using an array, e.g.

"cp1[playerid]" should now be "cp[1][playerid]"

Do that for all of the "cpx" variables, so "cpx" is changed to "cp[x]".
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)