SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/08/2019, 04:36 PM   #1
playstores
Big Clucker
 
Join Date: Feb 2018
Posts: 144
Reputation: 3
Default AIRPLANE Loop

Whats the matter with this ?


// up
new LSAirPlanes[13];
//

https://pastebin.com/igdRScQ1


Everything is defined correctly.


error 017: undefined symbol "LSAirPlanes"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line



Every Error is in Line 221 > "if(carid == LSAirPlanes[i])"
playstores is offline   Reply With Quote
Old 14/08/2019, 05:32 PM   #2
playstores
Big Clucker
 
Join Date: Feb 2018
Posts: 144
Reputation: 3
Default Re: AIRPLANE Loop

push
playstores is offline   Reply With Quote
Old 14/08/2019, 07:42 PM   #3
playstores
Big Clucker
 
Join Date: Feb 2018
Posts: 144
Reputation: 3
Default Re: AIRPLANE Loop

// update
playstores is offline   Reply With Quote
Old 14/08/2019, 08:26 PM   #4
Plastikmensch
Huge Clucker
 
Join Date: Aug 2016
Posts: 251
Reputation: 16
Default Re: AIRPLANE Loop

I can't tell you why you get this error, but I can say that even if there was no error it wouldn't work, because you do i < MAX_VEHICLES and use i as index, which will get out of bounds really quick.
(Highest index of LSAirPlanes is 12, MAX_VEHICLES is 2000)
If LSAirPlanes and SFAirplanes do not have the same size, you also have to use 2 loops.
Code:
stock GetCarFunction(carid)
{
    for(new i = 0; i < sizeof(LSAirPlanes); i++)
    {
        if(carid == LSAirPlanes[i])
        {
            return 1;
        }
    }
    for(new j; j < sizeof(SFAirPlanes); j++)
    {
        if(carid == SFAirPlanes[j])
        {
            return 2;
        }
    }
    return 0;
}
Plastikmensch is offline   Reply With Quote
Old 14/08/2019, 09:40 PM   #5
playstores
Big Clucker
 
Join Date: Feb 2018
Posts: 144
Reputation: 3
Default Re: AIRPLANE Loop

You're right, but I get the same errors
playstores is offline   Reply With Quote
Old 15/08/2019, 04:05 AM   #6
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,819
Reputation: 650
Default Re: AIRPLANE Loop

The code is fine, the errors says that LSAirPlanes isn't defined, check that you define it before the function
Thats all that we can tell you with the given information

But you could try to compile your script in list mode (-l flag on the commandline), this will create a .lst file after preprocessing (code after all #statement [like #include or #define] were executed)
Nero_3D is offline   Reply With Quote
Old 15/08/2019, 06:07 AM   #7
iorp
Big Clucker
 
iorp's Avatar
 
Join Date: Sep 2018
Location: I do not live
Posts: 68
Reputation: 1
Default Re: AIRPLANE Loop

It could be a single bracket or something like it, you can post complete code to find out real problem.

and because of this
Code:
for(new i = 0; i < MAX_VEHICLES; i++)
you will receive array errors too.
__________________
Indian Ocean Roleplay

iorp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Airplane velocity? Metharon Scripting Help 5 16/11/2014 09:46 PM
Car to Airplane LionCodeT4 Scripting Help 8 28/04/2013 11:48 AM
[Map] Map for with airplane boat and more... Mustafa6155 Maps 2 02/12/2012 07:50 PM
Airplane Heading Help! SoHidden Scripting Help 5 19/10/2012 10:37 PM
More players in airplane DonKmotr Help Archive 4 06/08/2010 12:14 PM


All times are GMT. The time now is 12:22 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.