SA-MP Forums Archive
road - 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)
+--- Thread: road (/showthread.php?tid=299148)



road - viosteaua98 - 24.11.2011

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.



Re: road - SmiT - 24.11.2011

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


Re: road - viosteaua98 - 24.11.2011

i don't understand


Re: road - Babul - 24.11.2011

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


Re: road - SmiT - 24.11.2011

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.


Re: road - viosteaua98 - 24.11.2011

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...


Re: road - Kostas' - 24.11.2011

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


Re: road - viosteaua98 - 24.11.2011

it doesn't work in game


Re: road - dowster - 24.11.2011

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


Re: road - viosteaua98 - 24.11.2011

yes
i got pawn compiler without any error