SA-MP Forums Archive
What am i doing wrong? - 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: What am i doing wrong? (/showthread.php?tid=333591)



What am i doing wrong? - nickdodd25 - 12.04.2012

Just trying to make a command for opening the trunk where i can do /boot and the trunk opens and when i do /boot again it closes then again it opens again and so on. but i have getting errors and i cant firgure it out.
Код:
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 017: undefined symbol "TrunkOpen"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : warning 215: expression has no effect
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 001: expected token: ";", but found "]"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : fatal error 107: too many error messages on one line
pawn Код:
CMD:boot( playerid, params[] )
{
    if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, -1, "Error: You need to be in a vehicle." );
    {
        if(TrunkOpen[playerid] == true);//this line is 5
        {
            TrunkOpen[playerid] = false;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 0, objective);
            SendClientMessage(playerid, -1, "Trunk Closed");
        }
        else
        {
            TrunkOpen[playerid] = true;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 1, objective);
            SendClientMessage(playerid, -1, "Trunk Open");
        }
    }
    return 1;
}
I know i prolly did something simple but i cant get it fixed.

Thanks


Re: What am i doing wrong? - Kitten - 12.04.2012

pawn Код:
// place it at top of you're script.
new TrunkOpen[MAX_PLAYERS];



Re: What am i doing wrong? - nickdodd25 - 12.04.2012

Quote:
Originally Posted by Kitten
Посмотреть сообщение
pawn Код:
// place it at top of you're script.
new TrunkOpen[MAX_PLAYERS];
I had that under OnGameModeInt() but i moved it under a_samp now and i get these

Код:
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 017: undefined symbol "TrunkOpen"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 036: empty statement
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(7) : error 017: undefined symbol "TrunkOpen"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(15) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(17) : error 017: undefined symbol "TrunkOpen"
Am i supposed to change TrunkOpen[playerid] in the command to TrunkOpen[MAX_PLAYERS] too?


Re: What am i doing wrong? - Kitten - 12.04.2012

No you do not need to add MAX_PLAYERS in TruckOpen in the command,

MAX_PLAYERS is getting the players amount out of the server slot (500), i can see you're using an include, mind sending the lines?


Re: What am i doing wrong? - nickdodd25 - 12.04.2012

Quote:
Originally Posted by Kitten
Посмотреть сообщение
No you do not need to add MAX_PLAYERS in TruckOpen in the command,

MAX_PLAYERS is getting the players amount out of the server slot (500), i can see you're using an include, mind sending the lines?
Its just a include with all my commands. Its the same as it was in the first post.


Re: What am i doing wrong? - nickdodd25 - 13.04.2012

Bump
Any suggestions?


Re: What am i doing wrong? - RollTi - 13.04.2012

pawn Код:
new bool:TrunkOpen[MAX_PLAYERS];
the first poster above was correct but it will not support True/False


Re: What am i doing wrong? - nickdodd25 - 14.04.2012

Still having some minor difficultys with this command.
Код:
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(6) : error 036: empty statement
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(16) : error 029: invalid expression, assumed zero
pawn Код:
CMD:boot( playerid, params[] )
{
    new bool:TrunkOpen[MAX_PLAYERS];
    if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, COLOR_RED, "Error: You need to be in a vehicle." );
    {
        if(!TrunkOpen[playerid] == true);//this line is 6
        {
            TrunkOpen[playerid] = false;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 0, objective);
            SendClientMessage(playerid, COLOR_GREY, "Trunk Closed");
        }
        else//line 16
        {
            TrunkOpen[playerid] = true;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 1, objective);
            SendClientMessage(playerid, COLOR_GREY, "Trunk Open");
        }
    }
    return 1;
}
I have searched around for fixes with no sucess, anyone know what would be wrong now?


Re: What am i doing wrong? - [LoF]Zak - 14.04.2012

if(!TrunkOpen[playerid] == true);//this line is 6

change to:

if(!TrunkOpen[playerid] == true)//this line is 6

you have ; outside the brackets for some reason?


Re: What am i doing wrong? - Neo Karls - 14.04.2012

if(condition) // dont have any semicolon because it is not closing just checking and executing files inside it

thanks [LoF]Zak


Re: What am i doing wrong? - nickdodd25 - 14.04.2012

Quote:
Originally Posted by [LoF]Zak
Посмотреть сообщение
if(!TrunkOpen[playerid] == true);//this line is 6

change to:

if(!TrunkOpen[playerid] == true)//this line is 6

you have ; outside the brackets for some reason?
Quote:
Originally Posted by Neo Karls
Посмотреть сообщение
if(condition) // dont have any semicolon because it is not closing just checking and executing files inside it

thanks [LoF]Zak

Thanks guys, totally looked over that one lol

Thanks for the help!