#1

so i want this road move but i don't know why i get these errors
pawn Код:
public OnGameModeInit()
{
    road = CreateObject(4168,2294.30004883,453.39999390,0.80000001,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;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/roadopen", cmdtext, true, 10) == 0)
    {
        MoveObject(road,2294.30004883,453.39999390,0.80000001,3);
        return 1;
    }
   
    if (strcmp("/roadclosed", cmdtext, true, 10) == 0)
    {
        MoveObject(road,2293.60009766,591.79998779,0.80000001,3);
        return 1;
    }
    return 0;
}
errors
pawn Код:
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.
Reply
#2

Oh god, perhaps because the variable "road" isn't declared?
Reply
#3

i don't understand
Reply
#4

on the top of your script, add this:
Код:
new road;
...then the script knows where to assign the object to.
Reply
#5

I suggest you read http://www.compuphase.com/pawn/pawn.htm. For your code, what you can do is declare the variable "road":

pawn Код:
new
    road
;
EDIT: Person above was faster, sorry.
Reply
#6

pawn Код:
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.
pawn Код:
public OnGameModeInit()
{
    road = CreateObject(4168,2294.30004883,453.39999390,0.80000001,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...
Reply
#7

Look the line before public OnGameModeInit().
You forgot a ";"
Reply
#8

it doesn't work in game
Reply
#9

do you have new road; anywhere in your script before line 34?
Reply
#10

yes
i got pawn compiler without any error
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)