PDA

View Full Version : road


viosteaua98
24/11/2011, 02:38 PM
so i want this road move but i don't know why i get these errors
public OnGameModeInit()
{
road = CreateObject(4168,2294.30004883,453.39999390,0.800 00001,0.00000000,0.00000000,270.00000000); //object(roads23_lan) (1)
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/roadopen", cmdtext, true, 10) == 0)
{
MoveObject(road,2294.30004883,453.39999390,0.80000 001,3);
return 1;
}

if (strcmp("/roadclosed", cmdtext, true, 10) == 0)
{
MoveObject(road,2293.60009766,591.79998779,0.80000 001,3);
return 1;
}
return 0;
}

errors
C:\Users\Yayu\Desktop\road.pwn(35) : error 017: undefined symbol "road"
C:\Users\Yayu\Desktop\road.pwn(92) : error 017: undefined symbol "road"
C:\Users\Yayu\Desktop\road.pwn(98) : error 017: undefined symbol "road"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.

SmiT
24/11/2011, 02:40 PM
Oh god, perhaps because the variable "road" isn't declared?

viosteaua98
24/11/2011, 02:41 PM
i don't understand

Babul
24/11/2011, 02:45 PM
on the top of your script, add this:

new road;

...then the script knows where to assign the object to.

SmiT
24/11/2011, 02:46 PM
I suggest you read http://www.compuphase.com/pawn/pawn.htm. For your code, what you can do is declare the variable "road":

new
road
;

EDIT: Person above was faster, sorry.

viosteaua98
24/11/2011, 02:48 PM
C:\Users\Yayu\Desktop\road.pwn(34) : error 001: expected token: ";", but found "public"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

public OnGameModeInit()
{
road = CreateObject(4168,2294.30004883,453.39999390,0.800 00001,0.00000000,0.00000000,270.00000000); //object(roads23_lan) (1)
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
34 is public ongamemode...

Kostas'
24/11/2011, 02:51 PM
Look the line before public OnGameModeInit().
You forgot a ";"

viosteaua98
24/11/2011, 03:31 PM
it doesn't work in game

dowster
24/11/2011, 03:37 PM
do you have new road; anywhere in your script before line 34?

viosteaua98
24/11/2011, 03:45 PM
yes
i got pawn compiler without any error