SA-MP Forums Archive
stock isvehicleoccupied error - 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: stock isvehicleoccupied error (/showthread.php?tid=456285)



stock isvehicleoccupied error - Lisaax - 05.08.2013

C:\Documents and Settings\Lisa\Bureaublad\NQRP3Reported.pwn(2277) : error 017: undefined symbol "foreach"
C:\Documents and Settings\Lisa\Bureaublad\NQRP3Reported.pwn(2277) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Lisa\Bureaublad\NQRP3Reported.pwn(2277) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Lisa\Bureaublad\NQRP3Reported.pwn(2277) : fatal error 107: too many error messages on one line

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


4 Errors.

And this is the line

stock IsVehicleOccupied(iVehicleID, iSeatID = 0) {
foreach(new x: Player) ;(GetPlayerVehicleID(x) == iVehicleID && GetPlayerVehicleSeat(x) == iSeatID);
return 1;
}
return 0;
}


What is wrong? :S


Re: stock isvehicleoccupied error - Necip - 05.08.2013

Did you include foreach?


Re: stock isvehicleoccupied error - Konstantinos - 05.08.2013

I don't think he does. And after the loop, you have a semicolon which is not correct.

Download the foreach include or use:
pawn Код:
stock IsVehicleOccupied( vehicleid )
{
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( IsPlayerConnected( i ) )
        {
            if( IsPlayerInVehicle( i, vehicleid ) ) return 1;
        }
    }
    return 0;
}



Re: stock isvehicleoccupied error - Lisaax - 05.08.2013

With youre code i'll get 26 errors
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(3394) : error 004: function "splits" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4222) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4229) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4236) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4245) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4259) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4266) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4270) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4273) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4280) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4287) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4302) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4305) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4312) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4319) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4327) : error 017: undefined symbol "ABroadCast"
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4333) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4342) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4354) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4362) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4381) : error 017: undefined symbol "ABroadCast"
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4387) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4399) : error 017: undefined symbol "ABroadCast"
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4401) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4409) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4412) : error 017: undefined symbol "ABroadCast"
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4414) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4611) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4673) : warning 219: local variable "targetid" shadows a variable at a preceding level
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4877) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(487 : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4880) : error 004: function "SendFamilyMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4912) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(491 : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4933) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4940) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4955) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(4962) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5785) : error 017: undefined symbol "ABroadCast"
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5894) : error 004: function "SetAllFDCheckpoint" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5899) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5900) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5901) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5995) : error 004: function "SetAllFDCheckpoint" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5996) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(5997) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(599 : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6023) : warning 215: expression has no effect
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6056) : error 004: function "SetAllFDCheckpoint" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6057) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(605 : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6059) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6075) : error 004: function "SetAllFDCheckpoint" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6076) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6077) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(607 : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6093) : error 004: function "SetAllFDCheckpoint" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6094) : error 004: function "SendRadioMessage" is not implemented
C:\Documents and Settings\Lisa\Bureaublad\Scriptv1 perfect\SSS\Script[ONLY TO YOU]\AMRP\gamemodes\NQRP3Reported.pwn(6095) : error 004: function "SendRadioMessage" is not implemented

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


26 Errors.


Re : stock isvehicleoccupied error - Matnix - 05.08.2013

mhm, here you go.

pawn Код:
stock IsVehicleOccupied(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i,vehicleid))
        return 1;
    }
    return 0;
}



Re: stock isvehicleoccupied error - Smokeyy - 05.08.2013

stock IsVehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
you're done mate
EDIT: The guy above was faster


Re: stock isvehicleoccupied error - Konstantinos - 05.08.2013

The code does what it was meant to do. It's your fault if you didn't add it correctly to your mode. Check if you close the bracket at the end and be sure it's out of any callback.